MythTV  master
dvbcam.h
Go to the documentation of this file.
1 #ifndef DVBCAM_H
2 #define DVBCAM_H
3 
4 #include <deque>
5 using namespace std;
6 
7 #include <QWaitCondition>
8 #include <QRunnable>
9 #include <QString>
10 #include <QMutex>
11 
12 #include "mpegtables.h"
13 
14 #include "dvbtypes.h"
15 
16 class ChannelBase;
17 class cCiHandler;
18 class MThread;
19 class DVBCam;
20 
21 using pmt_list_t = QMap<const ChannelBase*, ProgramMapTable*>;
22 
23 class DVBCam : public QRunnable
24 {
25  public:
26  explicit DVBCam(QString device);
27  ~DVBCam();
28 
29  bool Start(void);
30  bool Stop(void);
31  bool IsRunning(void) const
32  {
33  QMutexLocker locker(&m_ciHandlerLock);
34  return m_ciHandlerRunning;
35  }
36 
37  void SetPMT(const ChannelBase *chan, const ProgramMapTable *pmt);
38  void SetTimeOffset(double offset_in_seconds);
39 
40  private:
41  void run(void) override; // QRunnable
42  void HandleUserIO(void);
43  void HandlePMT(void);
44 
45  void SendPMT(const ProgramMapTable &pmt, uint cplm);
46 
47  QString m_device;
48  int m_numslots {0};
49 
50  mutable QMutex m_ciHandlerLock;
51  QWaitCondition m_ciHandlerWait;
52  bool m_ciHandlerDoRun {false};
53  bool m_ciHandlerRunning {false};
54  cCiHandler *m_ciHandler {nullptr};
55  MThread *m_ciHandlerThread {nullptr};
56 
57  QMutex m_pmtLock;
60  bool m_havePmt {false};
61  bool m_pmtSent {false};
62  bool m_pmtUpdated {false};
63  bool m_pmtAdded {false};
64 };
65 
66 #endif // DVBCAM_H
67 
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
QMutex m_pmtLock
Definition: dvbcam.h:57
QMap< const ChannelBase *, ProgramMapTable * > pmt_list_t
Definition: dvbcam.h:21
bool IsRunning(void) const
Definition: dvbcam.h:31
pmt_list_t m_pmtList
Definition: dvbcam.h:58
Definition: dvbcam.h:23
QString m_device
Definition: dvbcam.h:47
pmt_list_t m_pmtAddList
Definition: dvbcam.h:59
unsigned int uint
Definition: compat.h:140
QMutex m_ciHandlerLock
Definition: dvbcam.h:50
Abstract class providing a generic interface to tuning hardware.
Definition: channelbase.h:31
QWaitCondition m_ciHandlerWait
Definition: dvbcam.h:51
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
Definition: mpegtables.h:656