Go to the documentation of this file.
13 #define LOC QString("ATSCStream[%1]: ").arg(m_cardId)
34 int desiredMinorChannel,
35 int cardnum,
bool cacheTables)
37 m_desiredMajorChannel(desiredMajorChannel),
38 m_desiredMinorChannel(desiredMinorChannel)
64 if (mgt && (!tvcts.empty() || !cvcts.empty()))
69 for (
uint i = 0; (i < tvcts.size()) && (chan_idx < 0); i++)
74 for (
uint i = (chan_idx < 0) ? 0 : cvcts.size();
75 (i < cvcts.size()) && (chan_idx < 0); i++)
163 const int table_id = psip.
TableID();
276 listener->HandleRRT(&rrt);
290 listener->HandleEIT(pid, &eit);
304 listener->HandleETT(pid, &ett);
327 listener->HandleSTT(&stt);
341 listener->HandleDCCT(&dcct);
351 listener->HandleDCCSCT(&dccsct);
363 listener->HandleAEIT(pid, &aeit);
373 listener->HandleAETT(pid, &aett);
385 listener->HandleNIT(&nit);
395 listener->HandleNTT(&ntt);
405 listener->HandleSVCT(&svct);
415 listener->HandleSTT(&stt);
427 listener->HandlePIM(&pim);
438 listener->HandlePNM(&pnm);
450 listener->HandleADET(&adet);
483 LOG(VB_RECORD, LOG_ERR,
LOC +
484 QString(
"ATSCStreamData::HandleTables(): Unknown table 0x%1 version:%2 pid:%3 0x%4")
485 .arg(psip.
TableID(),0,16).arg(psip.
Version()).arg(pid).arg(pid,0,16));
497 return (in_use_pids.size() != (eit_count + ett_count) ||
m_atscEitReset);
512 LOG(VB_GENERAL, LOG_DEBUG,
LOC + QString(
"eit size: %1, rate: %2, cnt: %3")
517 atsc_eit_pid_map_t::const_iterator it =
m_atscEitPids.begin();
519 add_pids_tmp.push_back(*it);
521 atsc_ett_pid_map_t::const_iterator it2 =
m_atscEttPids.begin();
523 add_pids_tmp.push_back(*it2);
525 uint_vec_t::const_iterator it3;
526 for (
uint pid : cur_pids)
528 it3 =
find(add_pids_tmp.begin(), add_pids_tmp.end(), pid);
529 if (it3 == add_pids_tmp.end())
530 del_pids.push_back(pid);
533 for (
uint pid : add_pids_tmp)
535 it3 =
find(cur_pids.begin(), cur_pids.end(), pid);
536 if (it3 == cur_pids.end())
537 add_pids.push_back(pid);
540 return !add_pids.empty() || !del_pids.empty();
569 listener->HandleMGT(mgt);
575 listener->HandleVCT(tsid, vct);
582 LOG(VB_EIT, LOG_INFO,
LOC +
583 QString(
"%1 chan %2-%3 is hidden in guide")
592 LOG(VB_EIT, LOG_INFO,
LOC + QString(
"Ignoring NTSC chan %1-%2")
598 LOG(VB_EIT, LOG_INFO,
LOC + QString(
"Adding Source #%1 ATSC chan %2-%3")
614 listener->HandleTVCT(tsid, vct);
623 listener->HandleCVCT(tsid, vct);
629 LOG(VB_GENERAL, LOG_WARNING,
LOC +
630 "Currently we ignore \'current\' param");
641 for (
size_t i = 0; i < tvct.size() && !hasit; i++)
643 if (tvct[i]->Find(major,
minor) >= 0)
644 hasit |=
HasProgram(tvct[i]->ProgramNumber(i));
652 for (
size_t i = 0; i < cvct.size() && !hasit; i++)
654 if (cvct[i]->Find(major,
minor) >= 0)
655 hasit |=
HasProgram(cvct[i]->ProgramNumber(i));
666 LOG(VB_GENERAL, LOG_WARNING,
LOC +
667 "Currently we ignore \'current\' param");
670 tvct_cache_t::const_iterator it =
m_cachedTvcts.constFind(pid);
680 LOG(VB_GENERAL, LOG_WARNING,
LOC +
681 "Currently we ignore \'current\' param");
684 cvct_cache_t::const_iterator it =
m_cachedCvcts.constFind(pid);
694 LOG(VB_GENERAL, LOG_WARNING,
LOC +
695 "Currently we ignore \'current\' param");
725 LOG(VB_GENERAL, LOG_WARNING,
LOC +
726 "Currently we ignore \'current\' param");
756 LOG(VB_GENERAL, LOG_WARNING,
LOC +
757 "Currently we ignore \'current\' param");
766 LOG(VB_GENERAL, LOG_WARNING,
LOC +
767 "Currently we ignore \'current\' param");
776 LOG(VB_GENERAL, LOG_WARNING,
LOC +
777 "Currently we ignore \'current\' param");
790 LOG(VB_GENERAL, LOG_WARNING,
LOC +
791 "Currently we ignore \'current\' param");
796 tvct_cache_t::const_iterator it =
m_cachedTvcts.constFind(pid);
807 LOG(VB_GENERAL, LOG_WARNING,
LOC +
808 "Currently we ignore \'current\' param");
813 cvct_cache_t::const_iterator it =
m_cachedCvcts.constFind(pid);
824 LOG(VB_GENERAL, LOG_WARNING,
LOC +
825 "Currently we ignore \'current\' param");
827 std::vector<const TerrestrialVirtualChannelTable*> tvcts;
833 tvcts.push_back(tvct);
843 LOG(VB_GENERAL, LOG_WARNING,
LOC +
844 "Currently we ignore \'current\' param");
846 std::vector<const CableVirtualChannelTable*> cvcts;
852 cvcts.push_back(cvct);
916 psip_refcnt_map_t::iterator it;
926 for (
auto & tvct : tvcts)
933 for (
auto & cvct : cvcts)
943 [val](
auto & listener){ return val == listener; } ))
954 if (((
void*)val) == ((
void*)*it))
967 [val](
auto & listener){ return val == listener; } ))
979 if (((
void*)val) == ((
void*)*it))
992 [val](
auto & listener){ return val == listener; } ))
1004 if (((
void*)val) == ((
void*)*it))
1017 [val](
auto & listener){ return val == listener; } ))
1029 if (((
void*)val) == ((
void*)*it))
1042 [val](
auto & listener){ return val == listener; } ))
1054 if (((
void*)val) == ((
void*)*it))
psip_refcnt_map_t m_cachedRefCnt
int TableClass(uint i) const
This table contains information about the channels transmitted on this multiplex.
atsc_aux_listener_vec_t m_atscAuxListeners
uint SourceID(void) const
void AddATSCAuxListener(ATSCAuxStreamListener *val)
int VersionTVCT(uint tsid) const
QRecursiveMutex m_cacheLock
void ProcessVCT(uint tsid, const VirtualChannelTable *vct)
void RemoveSCTEMainListener(SCTEMainStreamListener *val)
~ATSCStreamData() override
bool DeleteCachedTable(const PSIPTable *psip) const override
void AddETT(uint atsc_major, uint atsc_minor, const ExtendedTextTable *ett)
std::vector< const CableVirtualChannelTable * > cvct_vec_t
void SetDesiredProgram(int p)
No one has had time to decode this table yet...
void AddSCTEMainListener(SCTEMainStreamListener *val)
void SetGPSOffset(uint gps_offset)
void SetSectionSeen(uint32_t key, int32_t version, uint32_t section, uint32_t last_section, uint32_t segment_last_section=0xffff)
bool HasCachedAllCVCTs(bool current=true) const
virtual bool DeleteCachedTable(const PSIPTable *psip) const
No one has had time to decode this table yet...
bool HasCachedMGT(bool current=true) const
QMap< uint, int > m_cvctVersion
bool HasChannel(uint major, uint minor) const
cvct_vec_t GetCachedCVCTs(bool current=true) const
std::vector< const TerrestrialVirtualChannelTable * > tvct_vec_t
QMap< uint, int > m_tvctVersion
const TSHeader * tsheader() const
QMap< uint, uint > m_sourceIdToAtscMajMin
void CacheCVCT(uint pid, CableVirtualChannelTable *cvct)
virtual bool IsRedundant(uint pid, const PSIPTable &psip) const
Returns true if table already seen.
atsc_ett_pid_map_t m_atscEttPids
uint SourceID(uint i) const
void ProcessTVCT(uint tsid, const TerrestrialVirtualChannelTable *vct)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
std::vector< uint > uint_vec_t
bool HasCachedAnyCVCTs(bool current=true) const
No one has had time to decode this table yet...
uint ProgramNumber(uint i) const
bool IsHiddenInGuide(uint i) const
MasterGuideTable * m_cachedMgt
bool HandleTables(uint pid, const PSIPTable &psip) override
Process PSIP packets.
void AddATSCEITListener(ATSCEITStreamListener *val)
bool HasCachedAllTVCTs(bool current=true) const
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
void UpdateTimeOffset(uint64_t si_utc_time)
bool IsHidden(uint i) const
void ProcessMGT(const MasterGuideTable *mgt)
int VersionRRT(uint region) const
void Reset(void) override
void AddEIT(uint atsc_major, uint atsc_minor, const EventInformationTable *eit)
void SetVersionMGT(int version)
A PSIP table is a variant of a PES packet containing an MPEG, ATSC or DVB table.
uint GPSOffset(void) const
Current UTC to GPS time offset in seconds.
void ReturnCachedTVCTTables(tvct_vec_t &tvcts) const
uint MajorChannel(uint i) const
atsc_eit_pid_map_t m_atscEitPids
virtual void ReturnCachedTable(const PSIPTable *psip) const
atsc_eit_listener_vec_t m_atscEitListeners
void SetDesiredChannel(int major, int minor)
tvct_const_ptr_t GetCachedTVCT(uint pid, bool current=true) const
int Find(int major, int minor) const
uint TablePID(uint i) const
void RemoveATSC81EITListener(ATSC81EITStreamListener *val)
bool HasEITPIDChanges(const uint_vec_t &in_use_pid) const override
cvct_cache_t m_cachedCvcts
QRecursiveMutex m_listenerLock
virtual bool HandleTables(uint pid, const PSIPTable &psip)
Process PSIP packets.
bool HasCachedCVCT(uint pid, bool current=true) const
Encapsulates data about MPEG stream and emits events for each table.
bool HasCachedTVCT(uint pid, bool current=true) const
tvct_cache_t m_cachedTvcts
void ReturnCachedCVCTTables(cvct_vec_t &cvcts) const
ATSCStreamData(int desiredMajorChannel, int desiredMinorChannel, int cardnum, bool cacheTables=false)
Initializes ATSCStreamData.
int m_desiredMinorChannel
void AddATSCMainListener(ATSCMainStreamListener *val)
int m_desiredMajorChannel
void RemoveATSCAuxListener(ATSCAuxStreamListener *val)
uint LastSection(void) const
void SetVersionRRT(uint region, int version)
tvct_vec_t GetCachedTVCTs(bool current=true) const
scte_main_listener_vec_t m_scteMainlisteners
void CacheTVCT(uint pid, TerrestrialVirtualChannelTable *tvct)
void IncrementRefCnt(const PSIPTable *psip) const
uint GetGPSOffset(void) const
void RemoveATSCMainListener(ATSCMainStreamListener *val)
This table tells the decoder on which PIDs to find other tables, and their sizes and each table's cur...
void CacheMGT(MasterGuideTable *mgt)
void AddATSC81EITListener(ATSC81EITStreamListener *val)
bool IsEventETM(void) const
bool IsRedundant(uint pid, const PSIPTable &psip) const override
Returns true if table already seen.
uint TableIDExtension(void) const
This table contains information about the terrestrial channels transmitted on this multiplex.
psip_refcnt_map_t m_cachedSlatedForDeletion
atsc81_eit_listener_vec_t m_atsc81EitListeners
uint GetATSCMajorMinor(uint eit_sourceid) const
This table contains information about the cable channels transmitted on this multiplex.
virtual void AddListeningPID(uint pid, PIDPriority priority=kPIDPriorityNormal)
ExtendedTextTable contain additional text not contained in EventInformationTables.
int VersionCVCT(uint tsid) const
void RemoveATSCEITListener(ATSCEITStreamListener *val)
void SetVersionCVCT(uint tsid, int version)
bool IsSectionSeen(uint32_t key, int32_t version, uint32_t section) const
void ProcessCVCT(uint tsid, const CableVirtualChannelTable *vct)
atsc_main_listener_vec_t m_atscMainListeners
uint ModulationMode(uint i) const
uint TableType(uint i) const
uint ChannelCount() const
bool HasCachedAnyTVCTs(bool current=true) const
uint TransportStreamID() const
bool HasProgram(uint progNum) const
const MasterGuideTable * GetCachedMGT(bool current=true) const
uint MinorChannel(uint i) const
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)
cvct_const_ptr_t GetCachedCVCT(uint pid, bool current=true) const
TableStatusMap m_eitStatus
bool GetEITPIDChanges(const uint_vec_t &cur_pids, uint_vec_t &add_pids, uint_vec_t &del_pids) const override
void SetVersionTVCT(uint tsid, int version)