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 <utility>
39 #include <vector>
40 using namespace std;
41 
42 // Qt headers
43 #include <QString>
44 
45 // MythTV headers
46 #include "dtvmultiplex.h"
47 
48 class QStringList;
49 
51 {
52  public:
53  DTVChannelInfo() = default;
54  QString toString() const;
55 
56  public:
57  QString m_name;
58  uint m_serviceid {0};
59  int m_lcn {-1};
60 };
61 using DTVChannelInfoList = vector<DTVChannelInfo>;
62 
63 class DTVTransport : public DTVMultiplex
64 {
65  public:
66  explicit DTVTransport(const DTVMultiplex &other) : DTVMultiplex(other) { }
67 
68  public:
70 };
71 using DTVChannelList = vector<DTVTransport>;
72 
77 {
78  public:
79  enum return_t { ERROR_CARDTYPE, ERROR_OPEN, ERROR_PARSE, OK };
80  enum cardtype_t { ATSC, OFDM, QPSK, QAM, DVBS2, UNKNOWN };
81 
82  DTVConfParser(enum cardtype_t type, uint sourceid, QString file)
83  : m_type(type), m_sourceid(sourceid), m_filename(std::move(file)) {}
84  virtual ~DTVConfParser() = default;
85 
86  return_t Parse(void);
87 
88  DTVChannelList GetChannels(void) const { return m_channels; }
89 
90  private:
91  bool ParseVDR( const QStringList &tokens, int channelNo = -1);
92  bool ParseConf( const QStringList &tokens);
93  bool ParseConfOFDM(const QStringList &tokens);
94  bool ParseConfQPSK(const QStringList &tokens);
95  bool ParseConfQAM( const QStringList &tokens);
96  bool ParseConfATSC(const QStringList &tokens);
97 
98  private:
101  QString m_filename;
102 
103  void AddChannel(const DTVMultiplex &mux, DTVChannelInfo &chan);
104 
106 };
107 
108 #endif // DTVCONFPARSER_H
DTVMultiplex
Definition: dtvmultiplex.h:25
DTVConfParser::cardtype_t
cardtype_t
Definition: dtvconfparser.h:80
DTVConfParser::GetChannels
DTVChannelList GetChannels(void) const
Definition: dtvconfparser.h:88
DTVChannelList
vector< DTVTransport > DTVChannelList
Definition: dtvconfparser.h:71
DTVConfParser::ParseConf
bool ParseConf(const QStringList &tokens)
build_compdb.file
file
Definition: build_compdb.py:55
dtvmultiplex.h
DTVConfParser::~DTVConfParser
virtual ~DTVConfParser()=default
Parse
Definition: rssparse.h:189
toString
QString toString(MarkTypes type)
Definition: programtypes.cpp:26
DTVConfParser::DTVConfParser
DTVConfParser(enum cardtype_t type, uint sourceid, QString file)
Definition: dtvconfparser.h:82
DTVChannelInfo::m_name
QString m_name
Definition: dtvconfparser.h:57
DTVConfParser
Parses dvb-utils channel scanner output files.
Definition: dtvconfparser.h:77
DTVConfParser::m_filename
QString m_filename
Definition: dtvconfparser.h:101
DTVConfParser::m_type
cardtype_t m_type
Definition: dtvconfparser.h:99
uint
unsigned int uint
Definition: compat.h:140
DTVTransport::channels
DTVChannelInfoList channels
Definition: dtvconfparser.h:69
DTVConfParser::m_sourceid
uint m_sourceid
Definition: dtvconfparser.h:100
DTVChannelInfoList
vector< DTVChannelInfo > DTVChannelInfoList
Definition: dtvconfparser.h:61
DTVConfParser::m_channels
DTVChannelList m_channels
Definition: dtvconfparser.h:105
DTVChannelInfo::DTVChannelInfo
DTVChannelInfo()=default
DTVTransport::DTVTransport
DTVTransport(const DTVMultiplex &other)
Definition: dtvconfparser.h:66
DTVTransport
Definition: dtvconfparser.h:64
DTVConfParser::return_t
return_t
Definition: dtvconfparser.h:79
OK
#define OK
Definition: dvbci.cpp:69
DTVChannelInfo
Definition: dtvconfparser.h:51