Go to the documentation of this file.
5 #include <sys/select.h>
17 #define LOC QString("FireSigMon[%1](%2): ") \
18 .arg(m_inputid).arg(m_channel->GetDevice())
53 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"ctor");
68 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"dtor");
77 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Stop() -- begin");
86 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Stop() -- end");
101 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"HandlePAT() ignoring PAT");
109 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Wait for valid PAT timed out");
118 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"HandlePMT()");
125 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"HandlePMT() ignoring PMT");
138 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"RunTableMonitor(): -- begin");
146 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"RunTableMonitor(): -- err");
148 std::this_thread::sleep_for(std::chrono::milliseconds(10));
150 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"RunTableMonitor(): -- err end");
160 std::this_thread::sleep_for(std::chrono::milliseconds(10));
162 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"RunTableMonitor(): -- shutdown ");
168 std::this_thread::sleep_for(std::chrono::milliseconds(10));
170 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"RunTableMonitor(): -- end");
221 bool retried =
false;
232 fwchan->SetPowerState(
true);
239 if (qfailed && !retried)
245 LOG(VB_RECORD, LOG_WARNING,
246 "Can't determine if STB is power on, assuming it is...");
290 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"UpdateValues() -- "
291 "Waiting for table monitor to start");
294 std::this_thread::sleep_for(std::chrono::milliseconds(5));
296 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"UpdateValues() -- "
297 "Table monitor started");
void AddFlags(uint64_t _flags) override
virtual void RemoveListener(TSDataListener *listener)
static QMutex s_patKeysLock
void SetValue(int _value)
static const uint64_t kFWSigMon_WaitForPower
void SetThreshold(int _threshold)
static QHash< void *, uint > s_patKeys
void RunTableMonitor(void)
static const uint kPowerTimeout
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
~FirewireSignalMonitor() override
Stops signal monitoring and table monitoring threads.
static const uint64_t kDTVSigMon_WaitForMGT
void HandlePAT(const ProgramAssociationTable *pat) override
virtual void AddListener(TSDataListener *listener)
MPEGStreamData * GetStreamData()
Returns the MPEG stream data if it exists.
void start(void)
starts measuring elapsed time.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
FirewireSignalMonitor(void)
bool HasAnyFlag(uint64_t _flags) const
static const uint64_t kSigMon_WaitForSig
SignalMonitorValue m_scriptStatus
void HandlePMT(uint program_num, const ProgramMapTable *pmt) override
void Stop(void) override
Stop signal monitoring and table monitoring threads.
SignalMonitorValue m_signalStrength
uint TransportStreamID(void) const
static const uint64_t kFWSigMon_PowerSeen
We've seen the FireWire STB power state.
SignalMonitorValue m_signalLock
bool m_stbNeedsToWaitForPat
bool m_stbNeedsToWaitForPower
void SendMessageAllGood(void)
FirewireChannel Copyright (c) 2005 by Jim Westfall and Dave Abrahams Distributed as part of MythTV un...
FirewireTableMonitorThread * m_tableMonitorThread
void SetVersionPAT(uint tsid, int version, uint last_section)
virtual int ProcessData(const unsigned char *buffer, int len)
static const uint64_t kDTVSigMon_WaitForPMT
static const uint64_t kDTVSigMon_WaitForPAT
static const uint64_t kDTVSigMon_WaitForNIT
virtual void EmitStatus(void)
static const uint64_t kDTVSigMon_WaitForSDT
virtual void UpdateValues(void)
This should be overridden to actually do signal monitoring.
MythTimer m_stbWaitForPatTimer
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
static const uint64_t kFWSigMon_PowerMatch
We've seen a FireWire STB power state matching our requirements.
static const uint64_t kDTVSigMon_PATSeen
We've seen a PAT, which maps MPEG program numbers to pids where we find PMTs.
static const uint64_t kDTVSigMon_PMTSeen
We've seen a PMT, which maps program to audio, video and other stream PIDs.
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
The Program Association Table lists all the programs in a stream, and is always found on PID 0.
void AddData(const unsigned char *data, uint len) override
Callback function to add MPEG2 TS data.
virtual FirewireDevice::PowerState GetPowerState(void) const
bool IsGood() const
Returns true if the value is equal to the threshold, or on the right side of the threshold (depends o...
static const uint kBufferTimeout
int elapsed(void)
Returns milliseconds elapsed since last start() or restart()
bool HasFlags(uint64_t _flags) const
void HandlePMT(uint pnum, const ProgramMapTable *pmt) override
static const uint64_t kDTVSigMon_PATMatch
We've seen a PAT matching our requirements.
virtual FirewireDevice * GetFirewireDevice(void)
friend class FirewireTableMonitorThread
This class is intended to detect the presence of needed tables.
FirewireSignalMonitor * m_parent
volatile bool m_dtvMonitorRunning
MythTimer m_stbWaitForPowerTimer
void SetVersionPMT(uint pnum, int version, uint last_section)
bool IsSTBBufferCleared(void) const
bool wait(unsigned long time=ULONG_MAX)
Wait for the MThread to exit, with a maximum timeout.
virtual void Stop()
Stop signal monitoring thread.
void HandlePAT(const ProgramAssociationTable *pat) override
bool IsAllGood(void) const override
virtual bool ClosePort(void)=0
void UpdateValues(void) override
Fills in frontend stats and emits status Qt signals.
static const uint64_t kDTVSigMon_WaitForVCT
virtual bool OpenPort(void)=0