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