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")
73 }
74 
82 {
83  if (!m_running || m_exit)
84  return;
85 
87  if (channel == nullptr)
88  return;
89 
90  if (!m_locked && channel->IsOpen())
91  {
92  QMutexLocker locker(&m_statusLock);
95  m_locked = true;
96  }
97 
98  EmitStatus();
99  if (IsAllGood())
101 
102  m_updateDone = true;
103 
105  return;
106 
107  // Start table monitoring if we are waiting on any table
108  // and we have a lock.
109  if (GetStreamData() &&
113  {
114  LOG(VB_CHANNEL, LOG_INFO, LOC + "UpdateValues: start sigmon");
115  channel->SetStreamData(GetStreamData());
116  m_streamHandlerStarted = true;
117  }
118 }
LOC
#define LOC
Definition: iptvsignalmonitor.cpp:9
channel
QDomElement channel
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:501
SignalMonitorValue::SetValue
void SetValue(int _value)
Definition: signalmonitorvalue.h:74
SignalMonitor::m_channel
ChannelBase * m_channel
Definition: signalmonitor.h:202
SignalMonitor::kDTVSigMon_WaitForMGT
static const uint64_t kDTVSigMon_WaitForMGT
Definition: signalmonitor.h:182
SignalMonitor::m_exit
volatile bool m_exit
Definition: signalmonitor.h:226
arg
arg(title).arg(filename).arg(doDelete))
DTVSignalMonitor::GetStreamData
MPEGStreamData * GetStreamData()
Returns the MPEG stream data if it exists.
Definition: dtvsignalmonitor.h:59
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
iptvsignalmonitor.h
IPTVSignalMonitor::HandlePAT
void HandlePAT(const ProgramAssociationTable *pat) override
Definition: iptvsignalmonitor.cpp:68
IPTVSignalMonitor::IPTVSignalMonitor
IPTVSignalMonitor(void)
SignalMonitor::m_running
volatile bool m_running
Definition: signalmonitor.h:225
SignalMonitor::HasAnyFlag
bool HasAnyFlag(uint64_t _flags) const
Definition: signalmonitor.cpp:282
SignalMonitor::m_signalStrength
SignalMonitorValue m_signalStrength
Definition: signalmonitor.h:218
mythlogging.h
SignalMonitor::m_signalLock
SignalMonitorValue m_signalLock
Definition: signalmonitor.h:217
SignalMonitor::SendMessageAllGood
void SendMessageAllGood(void)
Definition: signalmonitor.cpp:467
SignalMonitor::kDTVSigMon_WaitForPMT
static const uint64_t kDTVSigMon_WaitForPMT
Definition: signalmonitor.h:181
SignalMonitor::kDTVSigMon_WaitForPAT
static const uint64_t kDTVSigMon_WaitForPAT
Definition: signalmonitor.h:180
SignalMonitor::m_updateDone
bool m_updateDone
Definition: signalmonitor.h:209
SignalMonitor::kDTVSigMon_WaitForNIT
static const uint64_t kDTVSigMon_WaitForNIT
Definition: signalmonitor.h:184
SignalMonitor::EmitStatus
virtual void EmitStatus(void)
Definition: signalmonitor.cpp:474
SignalMonitor::kDTVSigMon_WaitForSDT
static const uint64_t kDTVSigMon_WaitForSDT
Definition: signalmonitor.h:185
MPEGStreamData
Encapsulates data about MPEG stream and emits events for each table.
Definition: mpegstreamdata.h:85
IPTVChannel
Definition: iptvchannel.h:25
IPTVSignalMonitor::~IPTVSignalMonitor
~IPTVSignalMonitor() override
Stops signal monitoring and table monitoring threads.
Definition: iptvsignalmonitor.cpp:39
IPTVSignalMonitor::SetStreamData
void SetStreamData(MPEGStreamData *data) override
Sets the MPEG stream data for DTVSignalMonitor to use, and connects the table signals to the monitor.
Definition: iptvsignalmonitor.cpp:62
ProgramAssociationTable
The Program Association Table lists all the programs in a stream, and is always found on PID 0.
Definition: mpegtables.h:605
IPTVChannel::SetStreamData
void SetStreamData(MPEGStreamData *sd)
Definition: iptvchannel.cpp:60
mpegstreamdata.h
iptvchannel.h
IPTVSignalMonitor::GetIPTVChannel
IPTVChannel * GetIPTVChannel(void)
Definition: iptvsignalmonitor.cpp:45
IPTVSignalMonitor::Stop
void Stop(void) override
Stop signal monitoring and table monitoring threads.
Definition: iptvsignalmonitor.cpp:53
SignalMonitor::m_statusLock
QMutex m_statusLock
Definition: signalmonitor.h:228
DTVSignalMonitor::SetStreamData
virtual void SetStreamData(MPEGStreamData *data)
Sets the MPEG stream data for DTVSignalMonitor to use, and connects the table signals to the monitor.
Definition: dtvsignalmonitor.cpp:260
DTVSignalMonitor
This class is intended to detect the presence of needed tables.
Definition: dtvsignalmonitor.h:19
IPTVSignalMonitor::UpdateValues
void UpdateValues(void) override
Fills in frontend stats and emits status Qt signals.
Definition: iptvsignalmonitor.cpp:81
IPTVSignalMonitor::m_streamHandlerStarted
bool m_streamHandlerStarted
Definition: iptvsignalmonitor.h:35
IPTVSignalMonitor::m_locked
bool m_locked
Definition: iptvsignalmonitor.h:36
SignalMonitor::Stop
virtual void Stop()
Stop signal monitoring thread.
Definition: signalmonitor.cpp:306
DTVSignalMonitor::HandlePAT
void HandlePAT(const ProgramAssociationTable *pat) override
Definition: dtvsignalmonitor.cpp:293
DTVSignalMonitor::IsAllGood
bool IsAllGood(void) const override
Definition: dtvsignalmonitor.cpp:566
DTVSignalMonitor::m_programNumber
int m_programNumber
Definition: dtvsignalmonitor.h:137
SignalMonitor::kDTVSigMon_WaitForVCT
static const uint64_t kDTVSigMon_WaitForVCT
Definition: signalmonitor.h:183