MythTV  master
dtvconfparser.h
Go to the documentation of this file.
1 /* -*- Mode: c++ -*-
2  * vim: set expandtab tabstop=4 shiftwidth=4:
3  *
4  * Original Project
5  * MythTV http://www.mythtv.org
6  *
7  * Author(s):
8  * John Pullan (john@pullan.org)
9  *
10  * Description:
11  * Collection of classes to provide dvb channel scanning
12  * functionallity
13  *
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
29  *
30  */
31 
32 #ifndef _DTVCONFPARSER_H_
33 #define _DTVCONFPARSER_H_
34 
35 // C++ headers
36 #include <cstdint>
37 #include <unistd.h>
38 #include <vector>
39 using namespace std;
40 
41 // Qt headers
42 #include <QString>
43 
44 // MythTV headers
45 #include "dtvmultiplex.h"
46 
47 class QStringList;
48 
50 {
51  public:
52  DTVChannelInfo() = default;
53  QString toString() const;
54 
55  public:
56  QString m_name;
57  uint m_serviceid {0};
58  int m_lcn {-1};
59 };
60 typedef vector<DTVChannelInfo> DTVChannelInfoList;
61 
62 class DTVTransport : public DTVMultiplex
63 {
64  public:
65  explicit DTVTransport(const DTVMultiplex &other) : DTVMultiplex(other) { }
66 
67  public:
69 };
70 typedef vector<DTVTransport> DTVChannelList;
71 
76 {
77  public:
78  enum return_t { ERROR_CARDTYPE, ERROR_OPEN, ERROR_PARSE, OK };
79  enum cardtype_t { ATSC, OFDM, QPSK, QAM, DVBS2, UNKNOWN };
80 
81  DTVConfParser(enum cardtype_t type, uint sourceid, const QString &file)
82  : m_type(type), m_sourceid(sourceid), m_filename(file) {}
83  virtual ~DTVConfParser() = default;
84 
85  return_t Parse(void);
86 
87  DTVChannelList GetChannels(void) const { return m_channels; }
88 
89  private:
90  bool ParseVDR( const QStringList &tokens, int channelNo = -1);
91  bool ParseConf( const QStringList &tokens);
92  bool ParseConfOFDM(const QStringList &tokens);
93  bool ParseConfQPSK(const QStringList &tokens);
94  bool ParseConfQAM( const QStringList &tokens);
95  bool ParseConfATSC(const QStringList &tokens);
96 
97  private:
100  QString m_filename;
101 
102  void AddChannel(const DTVMultiplex &mux, DTVChannelInfo &chan);
103 
105 };
106 
107 #endif // _DTVCONFPARSER_H_
cardtype_t m_type
Definition: dtvconfparser.h:98
#define OK
Definition: dvbci.cpp:69
QString toString(MarkTypes type)
vector< DTVTransport > DTVChannelList
Definition: dtvconfparser.h:70
DTVConfParser(enum cardtype_t type, uint sourceid, const QString &file)
Definition: dtvconfparser.h:81
unsigned int uint
Definition: compat.h:140
DTVChannelList GetChannels(void) const
Definition: dtvconfparser.h:87
Parses dvb-utils channel scanner output files.
Definition: dtvconfparser.h:75
QString m_filename
DTVTransport(const DTVMultiplex &other)
Definition: dtvconfparser.h:65
vector< DTVChannelInfo > DTVChannelInfoList
Definition: dtvconfparser.h:60
DTVChannelInfoList channels
Definition: dtvconfparser.h:68
DTVChannelList m_channels