00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _DTVCONFPARSER_H_
00033 #define _DTVCONFPARSER_H_
00034
00035
00036 #include <stdint.h>
00037 #include <unistd.h>
00038
00039
00040 #include <vector>
00041 using namespace std;
00042
00043
00044 #include <qstring.h>
00045
00046
00047 #include "dtvchannel.h"
00048
00049 class QStringList;
00050
00051 class DTVChannelInfo
00052 {
00053 public:
00054 DTVChannelInfo() :
00055 name(QString::null), serviceid(0), lcn(-1) {}
00056
00057 QString toString() const;
00058
00059 public:
00060 QString name;
00061 uint serviceid;
00062 int lcn;
00063 };
00064 typedef vector<DTVChannelInfo> DTVChannelInfoList;
00065
00066 class DTVTransport : public DTVMultiplex
00067 {
00068 public:
00069 DTVTransport(const DTVMultiplex &other) : DTVMultiplex(other) { }
00070
00071 public:
00072 DTVChannelInfoList channels;
00073 };
00074 typedef vector<DTVTransport> DTVChannelList;
00075
00079 class DTVConfParser
00080 {
00081 public:
00082 enum return_t { ERROR_OPEN, ERROR_PARSE, OK };
00083 enum cardtype_t { ATSC, OFDM, QPSK, QAM, UNKNOWN };
00084
00085 DTVConfParser(enum cardtype_t _type, uint sourceid, const QString &_file);
00086 virtual ~DTVConfParser() { }
00087
00088 return_t Parse(void);
00089
00090 DTVChannelList GetChannels(void) const { return channels; }
00091
00092 private:
00093 bool ParseVDR( const QStringList &tokens, int channelNo = -1);
00094 bool ParseConf( const QStringList &tokens);
00095 bool ParseConfOFDM(const QStringList &tokens);
00096 bool ParseConfQPSK(const QStringList &tokens);
00097 bool ParseConfQAM( const QStringList &tokens);
00098 bool ParseConfATSC(const QStringList &tokens);
00099
00100 private:
00101 cardtype_t type;
00102 uint sourceid;
00103 QString filename;
00104
00105 void AddChannel(const DTVMultiplex &mux, DTVChannelInfo &chan);
00106
00107 DTVChannelList channels;
00108 };
00109
00110 #endif // _DTVCONFPARSER_H_