MythTV  master
firewiresignalmonitor.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef FIREWIRESIGNALMONITOR_H
4 #define FIREWIRESIGNALMONITOR_H
5 
6 // C++ headers
7 #include <vector>
8 
9 // Qt headers
10 #include <QMutex>
11 #include <QMap>
12 
13 // MythTV headers
14 #include "dtvsignalmonitor.h"
15 #include "firewiredevice.h"
16 #include "mthread.h"
17 
18 class FirewireChannel;
19 
21 
23 {
24  public:
26  MThread("FirewireTableMonitor"), m_parent(p) { start(); }
27  ~FirewireTableMonitorThread() override { wait(); m_parent = nullptr; }
28  void run(void) override; // MThread
29  private:
31 };
32 
34 {
36  public:
37  FirewireSignalMonitor(int db_cardnum, FirewireChannel *_channel,
38  bool _release_stream,
39  uint64_t _flags = kFWSigMon_WaitForPower);
40 
41  void HandlePAT(const ProgramAssociationTable *pat) override; // DTVSignalMonitor
42  void HandlePMT(uint pnum, const ProgramMapTable *pmt) override; // DTVSignalMonitor
43 
44  void Stop(void) override; // SignalMonitor
45 
46  protected:
49  ~FirewireSignalMonitor() override;
50 
51  void UpdateValues(void) override; // SignalMonitor
52 
53  void RunTableMonitor(void);
54 
55  bool SupportsTSMonitoring(void);
56 
57  void AddData(const unsigned char *data, uint len) override; // TSDataListener
58 
59  public:
60  static const uint kPowerTimeout;
61  static const uint kBufferTimeout;
62 
63  protected:
64  volatile bool m_dtvMonitorRunning {false};
66  bool m_stbNeedsRetune {true};
67  bool m_stbNeedsToWaitForPat {false};
71 
72  std::vector<unsigned char> m_buffer;
73 
74  static QHash<void*,uint> s_patKeys;
75  static QMutex s_patKeysLock;
76 };
77 
78 #endif // FIREWIRESIGNALMONITOR_H
MThread::start
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:288
FirewireSignalMonitor::s_patKeysLock
static QMutex s_patKeysLock
Definition: firewiresignalmonitor.h:75
SignalMonitor::kFWSigMon_WaitForPower
static const uint64_t kFWSigMon_WaitForPower
Definition: signalmonitor.h:187
MythTimer
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition: mythtimer.h:13
FirewireSignalMonitor::s_patKeys
static QHash< void *, uint > s_patKeys
Definition: firewiresignalmonitor.h:74
FirewireSignalMonitor::RunTableMonitor
void RunTableMonitor(void)
Definition: firewiresignalmonitor.cpp:132
FirewireSignalMonitor
Definition: firewiresignalmonitor.h:33
FirewireSignalMonitor::kPowerTimeout
static const uint kPowerTimeout
Definition: firewiresignalmonitor.h:60
FirewireTableMonitorThread
Definition: firewiresignalmonitor.h:22
ProgramMapTable
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
Definition: mpegtables.h:692
FirewireSignalMonitor::~FirewireSignalMonitor
~FirewireSignalMonitor() override
Stops signal monitoring and table monitoring threads.
Definition: firewiresignalmonitor.cpp:66
FirewireSignalMonitor::HandlePAT
void HandlePAT(const ProgramAssociationTable *pat) override
Definition: firewiresignalmonitor.cpp:89
FirewireSignalMonitor::m_stbNeedsRetune
bool m_stbNeedsRetune
Definition: firewiresignalmonitor.h:66
firewiredevice.h
TSDataListener
Definition: streamlisteners.h:52
FirewireSignalMonitor::FirewireSignalMonitor
FirewireSignalMonitor(void)
FirewireSignalMonitor::Stop
void Stop(void) override
Stop signal monitoring and table monitoring threads.
Definition: firewiresignalmonitor.cpp:75
hardwareprofile.config.p
p
Definition: config.py:33
FirewireSignalMonitor::m_stbNeedsToWaitForPat
bool m_stbNeedsToWaitForPat
Definition: firewiresignalmonitor.h:67
FirewireTableMonitorThread::~FirewireTableMonitorThread
~FirewireTableMonitorThread() override
Definition: firewiresignalmonitor.h:27
FirewireSignalMonitor::m_stbNeedsToWaitForPower
bool m_stbNeedsToWaitForPower
Definition: firewiresignalmonitor.h:68
FirewireChannel
FirewireChannel Copyright (c) 2005 by Jim Westfall and Dave Abrahams Distributed as part of MythTV un...
Definition: firewirechannel.h:14
FirewireSignalMonitor::m_tableMonitorThread
FirewireTableMonitorThread * m_tableMonitorThread
Definition: firewiresignalmonitor.h:65
FirewireSignalMonitor::m_stbWaitForPatTimer
MythTimer m_stbWaitForPatTimer
Definition: firewiresignalmonitor.h:69
FirewireTableMonitorThread::run
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: firewiresignalmonitor.cpp:20
uint
unsigned int uint
Definition: compat.h:141
ProgramAssociationTable
The Program Association Table lists all the programs in a stream, and is always found on PID 0.
Definition: mpegtables.h:615
FirewireSignalMonitor::AddData
void AddData(const unsigned char *data, uint len) override
Callback function to add MPEG2 TS data.
Definition: firewiresignalmonitor.cpp:173
FirewireSignalMonitor::kBufferTimeout
static const uint kBufferTimeout
Definition: firewiresignalmonitor.h:61
FirewireSignalMonitor::HandlePMT
void HandlePMT(uint pnum, const ProgramMapTable *pmt) override
Definition: firewiresignalmonitor.cpp:116
FirewireSignalMonitor::m_buffer
std::vector< unsigned char > m_buffer
Definition: firewiresignalmonitor.h:72
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:48
mthread.h
DTVSignalMonitor
This class is intended to detect the presence of needed tables.
Definition: dtvsignalmonitor.h:14
FirewireTableMonitorThread::m_parent
FirewireSignalMonitor * m_parent
Definition: firewiresignalmonitor.h:30
FirewireSignalMonitor::m_dtvMonitorRunning
volatile bool m_dtvMonitorRunning
Definition: firewiresignalmonitor.h:64
FirewireSignalMonitor::m_stbWaitForPowerTimer
MythTimer m_stbWaitForPowerTimer
Definition: firewiresignalmonitor.h:70
FirewireTableMonitorThread::FirewireTableMonitorThread
FirewireTableMonitorThread(FirewireSignalMonitor *p)
Definition: firewiresignalmonitor.h:25
MThread::wait
bool wait(unsigned long time=ULONG_MAX)
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:305
dtvsignalmonitor.h
FirewireSignalMonitor::UpdateValues
void UpdateValues(void) override
Fills in frontend stats and emits status Qt signals.
Definition: firewiresignalmonitor.cpp:192
FirewireSignalMonitor::SupportsTSMonitoring
bool SupportsTSMonitoring(void)