MythTV  master
eitscanner.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 #ifndef EITSCANNER_H
3 #define EITSCANNER_H
4 
5 // Qt includes
6 #include <QWaitCondition>
7 #include <QStringList>
8 #include <QDateTime>
9 #include <QRunnable>
10 #include <QMutex>
11 
12 class TVRec;
13 class MThread;
14 class ChannelBase;
15 class DVBSIParser;
16 class EITHelper;
17 class ProgramMapTable;
18 
19 class EITSource
20 {
21  protected:
22  virtual ~EITSource() = default;
23  public:
24  virtual void SetEITHelper(EITHelper*) = 0;
25  virtual void SetEITRate(float rate) = 0;
26 };
27 
28 class EITScanner;
29 
30 class EITScanner : public QRunnable
31 {
32  public:
33  explicit EITScanner(uint cardnum);
35 
37  void StopPassiveScan(void);
38 
39  void StartActiveScan(TVRec*, uint max_seconds_per_source);
40 
41  void StopActiveScan(void);
42 
43  protected:
44  void run(void) override; // QRunnable
45 
46  private:
47  void TeardownAll(void);
48  static void *SpawnEventLoop(void*);
49  void RescheduleRecordings(void);
50 
51  QMutex m_lock;
52  ChannelBase *m_channel {nullptr};
53  EITSource *m_eitSource {nullptr};
54 
55  EITHelper *m_eitHelper {nullptr};
56  MThread *m_eventThread {nullptr};
57  volatile bool m_exitThread {false};
58  QWaitCondition m_exitThreadCond; // protected by lock
59 
60  TVRec *rec {nullptr};
61  volatile bool m_activeScan {false};
62  volatile bool m_activeScanStopped {true}; // protected by lock
63  QWaitCondition m_activeScanCond; // protected by lock
66  QStringList m_activeScanChannels;
67  QStringList::iterator m_activeScanNextChan;
69 
71 
72  static QMutex s_resched_lock;
73  static QDateTime s_resched_next_time;
74 
77 };
78 
79 #endif // EITSCANNER_H
ChannelBase * m_channel
Definition: eitscanner.h:52
static QDateTime s_resched_next_time
Definition: eitscanner.h:73
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
virtual ~EITSource()=default
uint m_activeScanNextChanIndex
Definition: eitscanner.h:68
void run(void) override
This runs the event loop for EITScanner until 'exitThread' is true.
Definition: eitscanner.cpp:66
virtual void SetEITHelper(EITHelper *)=0
QStringList m_activeScanChannels
Definition: eitscanner.h:66
MThread * m_eventThread
Definition: eitscanner.h:56
void TeardownAll(void)
Definition: eitscanner.cpp:42
QMutex m_lock
Definition: eitscanner.h:51
unsigned int uint
Definition: compat.h:140
QWaitCondition m_exitThreadCond
Definition: eitscanner.h:58
void StopPassiveScan(void)
Stops inserting Event Information Tables into DB.
Definition: eitscanner.cpp:218
void RescheduleRecordings(void)
Tells scheduler about programming changes.
Definition: eitscanner.cpp:190
QDateTime m_activeScanNextTrig
Definition: eitscanner.h:64
QStringList::iterator m_activeScanNextChan
Definition: eitscanner.h:67
static const uint kMinRescheduleInterval
Minumum number of seconds between reschedules.
Definition: eitscanner.h:76
This is the coordinating class of the Recorder Subsystem.
Definition: tv_rec.h:150
Acts as glue between ChannelBase, EITSource, and EITHelper.
Definition: eitscanner.h:30
volatile bool m_activeScanStopped
Definition: eitscanner.h:62
static QMutex s_resched_lock
Definition: eitscanner.h:72
void StartPassiveScan(ChannelBase *, EITSource *)
Start inserting Event Information Tables from the multiplex we happen to be tuned to into the databas...
Definition: eitscanner.cpp:199
EITHelper * m_eitHelper
Definition: eitscanner.h:55
virtual void SetEITRate(float rate)=0
Abstract class providing a generic interface to tuning hardware.
Definition: channelbase.h:31
TVRec * rec
Definition: eitscanner.h:60
volatile bool m_exitThread
Definition: eitscanner.h:57
void StartActiveScan(TVRec *, uint max_seconds_per_source)
Definition: eitscanner.cpp:234
QWaitCondition m_activeScanCond
Definition: eitscanner.h:63
uint m_cardnum
Definition: eitscanner.h:70
static long int random(void)
Definition: compat.h:149
volatile bool m_activeScan
Definition: eitscanner.h:61
static void * SpawnEventLoop(void *)
EITSource * m_eitSource
Definition: eitscanner.h:53
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
Definition: mpegtables.h:656
EITScanner(uint cardnum)
Definition: eitscanner.cpp:32
void StopActiveScan(void)
Definition: eitscanner.cpp:298
uint m_activeScanTrigTime
Definition: eitscanner.h:65