MythTV  master
iptvsignalmonitor.cpp
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 // MythTV headers
4 #include "iptvsignalmonitor.h"
5 #include "mpegstreamdata.h"
6 #include "iptvchannel.h"
7 #include "mythlogging.h"
8 
9 #define LOC QString("IPTVSigMon[%1](%2): ") \
10  .arg(m_inputid).arg(m_channel->GetDevice())
11 
26  IPTVChannel *_channel,
27  bool _release_stream,
28  uint64_t _flags)
29  : DTVSignalMonitor(db_cardnum, _channel, _release_stream, _flags)
30 {
31  LOG(VB_CHANNEL, LOG_INFO, LOC + "ctor");
34 }
35 
40 {
41  LOG(VB_CHANNEL, LOG_INFO, LOC + "dtor");
43 }
44 
46 {
47  return dynamic_cast<IPTVChannel*>(m_channel);
48 }
49 
54 {
55  LOG(VB_CHANNEL, LOG_INFO, LOC + "Stop() -- begin");
57  GetIPTVChannel()->SetStreamData(nullptr);
58  m_streamHandlerStarted = false;
59  LOG(VB_CHANNEL, LOG_INFO, LOC + "Stop() -- end");
60 }
61 
63 {
66 }
67 
69 {
70  LOG(VB_CHANNEL, LOG_INFO, LOC + QString("HandlePAT pn: %1")
71  .arg(m_programNumber));
73 }
74 
82 {
83  if (!m_running || m_exit)
84  return;
85 
86  if (!m_locked && GetIPTVChannel()->IsOpen())
87  {
88  QMutexLocker locker(&m_statusLock);
91  m_locked = true;
92  }
93 
94  EmitStatus();
95  if (IsAllGood())
97 
98  m_update_done = true;
99 
101  return;
102 
103  // Start table monitoring if we are waiting on any table
104  // and we have a lock.
105  if (GetStreamData() &&
109  {
110  LOG(VB_CHANNEL, LOG_INFO, LOC + "UpdateValues: start sigmon");
112  m_streamHandlerStarted = true;
113  }
114 }
QMutex m_statusLock
#define LOC
virtual void SetStreamData(MPEGStreamData *data)
Sets the MPEG stream data for DTVSignalMonitor to use, and connects the table signals to the monitor.
static const uint64_t kDTVSigMon_WaitForPMT
static const uint64_t kDTVSigMon_WaitForPAT
bool HasAnyFlag(uint64_t _flags) const
static const uint64_t kDTVSigMon_WaitForVCT
static const uint64_t kDTVSigMon_WaitForMGT
void SetValue(int _value)
static const uint64_t kDTVSigMon_WaitForNIT
virtual void Stop()
Stop signal monitoring thread.
ChannelBase * m_channel
volatile bool m_exit
void SetStreamData(MPEGStreamData *data) override
Sets the MPEG stream data for DTVSignalMonitor to use, and connects the table signals to the monitor.
MPEGStreamData * GetStreamData()
Returns the MPEG stream data if it exists.
void SendMessageAllGood(void)
volatile bool m_running
void HandlePAT(const ProgramAssociationTable *) override
The Program Association Table lists all the programs in a stream, and is always found on PID 0.
Definition: mpegtables.h:579
void HandlePAT(const ProgramAssociationTable *) override
This class is intended to detect the presence of needed tables.
void Stop(void) override
Stop signal monitoring and table monitoring threads.
void SetStreamData(MPEGStreamData *)
Definition: iptvchannel.cpp:57
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
bool IsAllGood(void) const override
SignalMonitorValue m_signalStrength
IPTVChannel * GetIPTVChannel(void)
static const uint64_t kDTVSigMon_WaitForSDT
void UpdateValues(void) override
Fills in frontend stats and emits status Qt signals.
SignalMonitorValue m_signalLock
Encapsulates data about MPEG stream and emits events for each table.
virtual void EmitStatus(void)
virtual ~IPTVSignalMonitor()
Stops signal monitoring and table monitoring threads.