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 "libmythbase/mthread.h"
15#include "dtvsignalmonitor.h"
16#include "firewiredevice.h"
17
18class 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
56
57 void AddData(const unsigned char *data, uint len) override; // TSDataListener
58
59 public:
60 static constexpr std::chrono::milliseconds kPowerTimeout { 3s };
61 static constexpr std::chrono::milliseconds kBufferTimeout { 5s };
62
63 protected:
64 volatile bool m_dtvMonitorRunning {false};
66 bool m_stbNeedsRetune {true};
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
This class is intended to detect the presence of needed tables.
FirewireChannel Copyright (c) 2005 by Jim Westfall and Dave Abrahams Distributed as part of MythTV un...
void Stop(void) override
Stop signal monitoring and table monitoring threads.
void AddData(const unsigned char *data, uint len) override
Callback function to add MPEG2 TS data.
void HandlePMT(uint pnum, const ProgramMapTable *pmt) override
void UpdateValues(void) override
Fills in frontend stats and emits status Qt signals.
FirewireTableMonitorThread * m_tableMonitorThread
bool SupportsTSMonitoring(void)
static constexpr std::chrono::milliseconds kBufferTimeout
~FirewireSignalMonitor() override
Stops signal monitoring and table monitoring threads.
FirewireSignalMonitor(const FirewireSignalMonitor &)
std::vector< unsigned char > m_buffer
static constexpr std::chrono::milliseconds kPowerTimeout
static QHash< void *, uint > s_patKeys
void HandlePAT(const ProgramAssociationTable *pat) override
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
FirewireSignalMonitor * m_parent
FirewireTableMonitorThread(FirewireSignalMonitor *p)
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:283
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:300
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition: mythtimer.h:14
The Program Association Table lists all the programs in a stream, and is always found on PID 0.
Definition: mpegtables.h:599
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
Definition: mpegtables.h:676
static const uint64_t kFWSigMon_WaitForPower
unsigned int uint
Definition: compat.h:68