Go to the documentation of this file.
14 #define DBG_SM(FUNC, MSG) LOG(VB_CHANNEL, LOG_INFO, \
15 QString("DTVSigMon[%1]: %2 %3").arg(m_inputid).arg(FUNC, MSG))
17 #define LOC QString("DTVSigMon[%1]: ").arg(m_inputid)
23 uint64_t key = (((uint64_t)psip.
TableID()) << 32) | psip.
CRC();
25 QList<uint64_t>::iterator it =
26 std::lower_bound(seen_crc.begin(), seen_crc.end(), key);
28 if ((it == seen_crc.end()) || (*it != key))
30 seen_crc.insert(it, key);
44 uint64_t wait_for_mask)
45 :
SignalMonitor(db_cardnum, _channel, _release_stream, wait_for_mask),
46 m_seenPAT(QObject::tr(
"Seen")+
" PAT",
"seen_pat", 1,
true, 0, 1, 0ms),
47 m_seenPMT(QObject::tr(
"Seen")+
" PMT",
"seen_pmt", 1,
true, 0, 1, 0ms),
48 m_seenMGT(QObject::tr(
"Seen")+
" MGT",
"seen_mgt", 1,
true, 0, 1, 0ms),
49 m_seenVCT(QObject::tr(
"Seen")+
" VCT",
"seen_vct", 1,
true, 0, 1, 0ms),
50 m_seenNIT(QObject::tr(
"Seen")+
" NIT",
"seen_nit", 1,
true, 0, 1, 0ms),
51 m_seenSDT(QObject::tr(
"Seen")+
" SDT",
"seen_sdt", 1,
true, 0, 1, 0ms),
52 m_seenCrypt(QObject::tr(
"Seen")+
" Crypt",
"seen_crypt", 1,
true, 0, 1, 0ms),
53 m_matchingPAT(QObject::tr(
"Matching")+
" PAT",
"matching_pat", 1,
true, 0, 1, 0ms),
54 m_matchingPMT(QObject::tr(
"Matching")+
" PMT",
"matching_pmt", 1,
true, 0, 1, 0ms),
55 m_matchingMGT(QObject::tr(
"Matching")+
" MGT",
"matching_mgt", 1,
true, 0, 1, 0ms),
56 m_matchingVCT(QObject::tr(
"Matching")+
" VCT",
"matching_vct", 1,
true, 0, 1, 0ms),
57 m_matchingNIT(QObject::tr(
"Matching")+
" NIT",
"matching_nit", 1,
true, 0, 1, 0ms),
58 m_matchingSDT(QObject::tr(
"Matching")+
" SDT",
"matching_sdt", 1,
true, 0, 1, 0ms),
59 m_matchingCrypt(QObject::tr(
"Matching")+
" Crypt",
"matching_crypt",
89 static int seenGood = -1;
90 static int matchingGood = -1;
98 DBG_SM(
"GetStatusList", QString(
"WaitForPMT seen(%1) matching(%2)")
173 std::vector<uint> add_eit;
174 std::vector<uint> del_eit;
179 for (
uint eit : del_eit)
181 uint_vec_t::iterator it;
188 for (
uint eit : add_eit)
198 DBG_SM(QString(
"SetChannel(%1, %2)").arg(major).arg(
minor),
"");
216 DBG_SM(QString(
"SetProgramNumber(%1)").arg(progNum),
"");
231 DBG_SM(QString(
"SetDVBService(transport_id: %1, network_id: %2, "
232 "service_id: %3)").arg(transport_id).arg(network_id).arg(service_id),
"");
313 LOG(VB_CHANNEL, LOG_DEBUG,
LOC + QString(
"HandlePAT() ") +
314 QString(
"Received PAT for tsid %1 waiting for tsid %2")
318 int spts_program = 0;
341 if (spts_program > 0)
343 LOG(VB_GENERAL, LOG_INFO,
LOC +
344 QString(
"Program %1 found in PAT of SPTS").arg(spts_program));
352 QString errStr = QString(
"Program #%1 not found in PAT!")
370 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
371 QString(
"Wrong PMT; pmt->ProgramNumber(%1) desired(%2)")
377 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
378 QString(
"Found PMT; pmt->ProgramNumber(%1)")
382 LOG(VB_GENERAL, LOG_NOTICE,
LOC +
399 if ((hasVideo >=
GetStreamData()->GetVideoStreamsRequired()) &&
410 LOG(VB_GENERAL, LOG_ERR,
LOC +
411 QString(
"We want %1 audio and %2 video streams")
414 QString(
"\n\t\t\tBut have %1 audio and %2 video streams")
415 .arg(hasAudio).arg(hasVideo));
421 LOG(VB_CHANNEL, LOG_DEBUG,
LOC + QString(
"Time Offset: %1")
457 LOG(VB_GENERAL, LOG_ERR,
LOC +
458 QString(
"Could not find channel %1_%2 in TVCT")
468 DBG_SM(
"HandleTVCT()", QString(
"tvct->ProgramNumber(idx %1): prog num %2")
484 LOG(VB_GENERAL, LOG_ERR,
LOC +
485 QString(
"Could not find channel %1_%2 in CVCT")
495 DBG_SM(
"HandleCVCT()", QString(
"cvct->ProgramNumber(idx %1): prog num %2")
504 LOG(VB_CHANNEL, LOG_DEBUG,
LOC + QString(
"Time Offset: %1")
541 DBG_SM(
"HandleSDT()", QString(
"tsid = %1 orig_net_id = %2")
int TableClass(uint i) const
void RemoveDVBMainListener(DVBMainStreamListener *val)
uint ProgramPID(uint i) const
void AddFlags(uint64_t _flags) override
volatile uint64_t m_flags
void AddATSCAuxListener(ATSCAuxStreamListener *val)
void RemoveFlags(uint64_t _flags) override
SignalMonitorValue m_matchingMGT
void SetDVBService(uint network_id, uint transport_id, int service_id)
void SetValue(int _value)
uint StreamCount(void) const
void SetDesiredProgram(int p)
This table gives the current DVB stream time.
virtual bool IsAllGood(void) const
void SetVersionSDT(uint tsid, int version, uint last_section)
QString GetStatus() const
Returns a signal monitor value as one long string.
static const uint64_t kDTVSigMon_NITMatch
We've seen an NIT matching our requirements.
ScanStreamData * GetScanStreamData()
Returns the scan stream data if it exists.
static const uint64_t kDTVSigMon_VCTMatch
We've seen a VCT matching our requirements.
SignalMonitorValue m_matchingPMT
SignalMonitorValue m_seenVCT
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
SignalMonitorValue m_seenMGT
static const uint64_t kDTVSigMon_WaitForMGT
#define DBG_SM(FUNC, MSG)
void HandleSTT(const SystemTimeTable *stt) override
static const uint64_t kDTVSigMon_CVCTSeen
We've seen a CVCT, the cable version of the VCT.
void RemoveMPEGListener(MPEGStreamListener *val)
bool IsVideo(uint i, const QString &sistandard) const
Returns true iff the stream at index i is a video stream.
MPEGStreamData * GetStreamData()
Returns the MPEG stream data if it exists.
static const uint64_t kDTVSigMon_SDTMatch
We've seen an SDT matching our requirements.
uint ProgramNumber(void) const
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void HandleTDT(const TimeDateTable *tdt) override
uint ProgramCount(void) const
SignalMonitorValue m_matchingSDT
uint ProgramNumber(uint i) const
QString GetName(void) const
Returns the long name of this value.
bool IsEncrypted(const QString &sistandard) const
Returns true iff PMT contains CA descriptor for a vid/aud stream.
QString toString(void) const override
void UpdateListeningForEIT(void)
static const uint64_t kDTVSigMon_PMTMatch
We've seen a PMT matching our requirements.
virtual void AddFlags(uint64_t _flags)
VERBOSE_PREAMBLE Most true
QRecursiveMutex m_statusLock
void HandlePMT(uint program_num, const ProgramMapTable *pmt) override
void HandleCVCT(uint pid, const CableVirtualChannelTable *cvct) override
DTVChannel * GetDTVChannel(void)
A PSIP table is a variant of a PES packet containing an MPEG, ATSC or DVB table.
static bool insert_crc(QList< uint64_t > &seen_crc, const PSIPTable &psip)
void UpdateMonitorValues(void)
SignalMonitorValue m_seenSDT
void SetDesiredChannel(int major, int minor)
virtual void RemoveFlags(uint64_t _flags)
static const uint64_t kDVBSigMon_WaitForPos
Wait for rotor to complete turning the antenna.
uint TransportStreamID(void) const
int Find(int major, int minor) const
uint ProgramNumber(uint i) const
uint TablePID(uint i) const
uint OriginalNetworkID() const
original_network_id 16 8.0
SignalMonitorValue m_seenCrypt
QList< uint64_t > m_seenTableCrc
void SetVersionPAT(uint tsid, int version, uint last_section)
SignalMonitorValue m_seenPAT
Encapsulates data about ATSC stream and emits events for most tables.
static const uint64_t kDTVSigMon_CVCTMatch
We've seen a CVCT matching our requirements.
static const uint64_t kDTVSigMon_WaitForPMT
static const uint64_t kDTVSigMon_WaitForPAT
static const uint64_t kDTVSigMon_WaitForNIT
static const uint64_t kDTVSigMon_WaitForSDT
Encapsulates data about MPEG stream and emits events for each table.
DVBStreamData * GetDVBStreamData()
Returns the DVB stream data if it exists.
QStringList GetStatusList(void) const override
Returns QStringList containing all signals and their current values.
This table tells the decoder on which PIDs to find A/V data.
static const uint64_t kDTVSigMon_SDTSeen
We've seen a SDT, which maps DVB Channels to MPEG program numbers, and provides additional data.
QString toString(void) const override
SignalMonitorValue m_matchingVCT
static const uint64_t kDTVSigMon_NITSeen
We've seen a NIT, which tells us where to find SDT and other DVB tables.
void HandleMGT(const MasterGuideTable *mgt) override
SignalMonitorValue m_matchingCrypt
static const uint64_t kDTVSigMon_TVCTSeen
We've seen a TVCT, the terrestrial version of the VCT.
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.
MPEGStreamData * m_streamData
~DTVSignalMonitor() override
void AddATSCMainListener(ATSCMainStreamListener *val)
The Program Association Table lists all the programs in a stream, and is always found on PID 0.
void RemoveATSCAuxListener(ATSCAuxStreamListener *val)
ATSCStreamData * GetATSCStreamData()
Returns the ATSC stream data if it exists.
Signal monitoring base class.
bool IsAudio(uint i, const QString &sistandard) const
Returns true iff the stream at index i is an audio stream.
bool IsGood() const
Returns true if the value is equal to the threshold, or on the right side of the threshold (depends o...
void SetDesiredService(uint netid, uint tsid, int serviceid)
static const uint64_t kDTVSigMon_VCTSeen
We've seen a VCT, which maps ATSC Channels to MPEG program numbers, and provides additional data.
void AddMPEGListener(MPEGStreamListener *val)
void SetProgramNumber(int progNum)
void RemoveATSCMainListener(ATSCMainStreamListener *val)
This table tells the decoder on which PIDs to find other tables, and their sizes and each table's cur...
static const uint64_t kDTVSigMon_CryptSeen
We've seen something indicating whether the data stream is encrypted.
static const uint64_t kDTVSigMon_MGTMatch
We've seen an MGT matching our requirements.
void AddDVBMainListener(DVBMainStreamListener *val)
SignalMonitorValue m_matchingNIT
void SetChannel(int major, int minor)
std::vector< uint > m_eitPids
static const uint64_t kDTVSigMon_MGTSeen
We've seen a MGT, which tells us on which PIDs to find VCT and other ATSC tables.
DTVSignalMonitor(int db_cardnum, DTVChannel *_channel, bool _release_stream, uint64_t wait_for_mask)
void HandleEncryptionStatus(uint pnum, bool enc_status) override
static const uint64_t kDTVSigMon_PATMatch
We've seen a PAT matching our requirements.
This table contains information about the terrestrial channels transmitted on this multiplex.
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_TVCTMatch
We've seen a TVCT matching our requirements.
void HandleNIT(const NetworkInformationTable *nit) override
This table contains information about the cable channels transmitted on this multiplex.
virtual void AddListeningPID(uint pid, PIDPriority priority=kPIDPriorityNormal)
uint FindPID(uint progNum) const
virtual QStringList GetStatusList(void) const
Returns QStringList containing all signals and their current values.
Class providing a generic interface to digital tuning hardware.
void SetVersionCVCT(uint tsid, int version)
static const uint64_t kDTVSigMon_CryptMatch
We've seen unencrypted data in data stream.
SignalMonitorValue m_matchingPAT
void HandlePAT(const ProgramAssociationTable *pat) override
bool IsAllGood(void) const override
uint TransportStreamID() const
void HandleTVCT(uint pid, const TerrestrialVirtualChannelTable *tvct) override
void HandleSDT(uint tsid, const ServiceDescriptionTable *sdt) override
void TestDecryption(const ProgramMapTable *pmt)
SignalMonitorValue m_seenNIT
virtual void RemoveListeningPID(uint pid)
uint TSID() const
transport_stream_id 16 3.0 0x0000
static const uint64_t kDTVSigMon_WaitForCrypt
static pid_list_t::iterator find(const PIDInfoMap &map, pid_list_t &list, pid_list_t::iterator begin, pid_list_t::iterator end, bool find_open)
uint m_detectedTransportID
static const uint64_t kDTVSigMon_WaitForVCT
SignalMonitorValue m_seenPMT
void SetVersionTVCT(uint tsid, int version)