16#define LOC QString("ATSCStream[%1]: ").arg(m_cardId)
37 int desiredMinorChannel,
38 int cardnum,
bool cacheTables)
40 m_desiredMajorChannel(desiredMajorChannel),
41 m_desiredMinorChannel(desiredMinorChannel)
67 if (mgt && (!tvcts.empty() || !cvcts.empty()))
72 for (
uint i = 0; (i < tvcts.size()) && (chan_idx < 0); i++)
77 for (
uint i = (chan_idx < 0) ? 0 : cvcts.size();
78 (i < cvcts.size()) && (chan_idx < 0); i++)
166 const int table_id = psip.
TableID();
279 listener->HandleRRT(&rrt);
293 listener->HandleEIT(pid, &eit);
307 listener->HandleETT(pid, &ett);
330 listener->HandleSTT(&stt);
344 listener->HandleDCCT(&dcct);
354 listener->HandleDCCSCT(&dccsct);
366 listener->HandleAEIT(pid, &aeit);
376 listener->HandleAETT(pid, &aett);
388 listener->HandleNIT(&nit);
398 listener->HandleNTT(&ntt);
408 listener->HandleSVCT(&svct);
418 listener->HandleSTT(&stt);
430 listener->HandlePIM(&pim);
441 listener->HandlePNM(&pnm);
453 listener->HandleADET(&adet);
486 LOG(VB_RECORD, LOG_ERR,
LOC +
487 QString(
"ATSCStreamData::HandleTables(): Unknown table 0x%1 version:%2 pid:%3 0x%4")
488 .arg(psip.
TableID(),0,16).arg(psip.
Version()).arg(pid).arg(pid,0,16));
500 return (in_use_pids.size() != (eit_count + ett_count) ||
m_atscEitReset);
515 LOG(VB_GENERAL, LOG_DEBUG,
LOC + QString(
"eit size: %1, rate: %2, cnt: %3")
520 atsc_eit_pid_map_t::const_iterator it =
m_atscEitPids.begin();
522 add_pids_tmp.push_back(*it);
524 atsc_ett_pid_map_t::const_iterator it2 =
m_atscEttPids.begin();
526 add_pids_tmp.push_back(*it2);
528 uint_vec_t::const_iterator it3;
529 for (
uint pid : cur_pids)
531 it3 =
find(add_pids_tmp.begin(), add_pids_tmp.end(), pid);
532 if (it3 == add_pids_tmp.end())
533 del_pids.push_back(pid);
536 for (
uint pid : add_pids_tmp)
538 it3 =
find(cur_pids.begin(), cur_pids.end(), pid);
539 if (it3 == cur_pids.end())
540 add_pids.push_back(pid);
543 return !add_pids.empty() || !del_pids.empty();
572 listener->HandleMGT(mgt);
578 listener->HandleVCT(tsid, vct);
585 LOG(VB_EIT, LOG_INFO,
LOC +
586 QString(
"%1 chan %2-%3 is hidden in guide")
595 LOG(VB_EIT, LOG_INFO,
LOC + QString(
"Ignoring NTSC chan %1-%2")
601 LOG(VB_EIT, LOG_INFO,
LOC + QString(
"Adding Source #%1 ATSC chan %2-%3")
617 listener->HandleTVCT(tsid, vct);
626 listener->HandleCVCT(tsid, vct);
632 LOG(VB_GENERAL, LOG_WARNING,
LOC +
633 "Currently we ignore \'current\' param");
644 for (
size_t i = 0; i < tvct.size() && !hasit; i++)
646 if (tvct[i]->Find(major,
minor) >= 0)
647 hasit |=
HasProgram(tvct[i]->ProgramNumber(i));
655 for (
size_t i = 0; i < cvct.size() && !hasit; i++)
657 if (cvct[i]->Find(major,
minor) >= 0)
658 hasit |=
HasProgram(cvct[i]->ProgramNumber(i));
669 LOG(VB_GENERAL, LOG_WARNING,
LOC +
670 "Currently we ignore \'current\' param");
673 tvct_cache_t::const_iterator it =
m_cachedTvcts.constFind(pid);
683 LOG(VB_GENERAL, LOG_WARNING,
LOC +
684 "Currently we ignore \'current\' param");
687 cvct_cache_t::const_iterator it =
m_cachedCvcts.constFind(pid);
697 LOG(VB_GENERAL, LOG_WARNING,
LOC +
698 "Currently we ignore \'current\' param");
728 LOG(VB_GENERAL, LOG_WARNING,
LOC +
729 "Currently we ignore \'current\' param");
759 LOG(VB_GENERAL, LOG_WARNING,
LOC +
760 "Currently we ignore \'current\' param");
769 LOG(VB_GENERAL, LOG_WARNING,
LOC +
770 "Currently we ignore \'current\' param");
779 LOG(VB_GENERAL, LOG_WARNING,
LOC +
780 "Currently we ignore \'current\' param");
793 LOG(VB_GENERAL, LOG_WARNING,
LOC +
794 "Currently we ignore \'current\' param");
799 tvct_cache_t::const_iterator it =
m_cachedTvcts.constFind(pid);
810 LOG(VB_GENERAL, LOG_WARNING,
LOC +
811 "Currently we ignore \'current\' param");
816 cvct_cache_t::const_iterator it =
m_cachedCvcts.constFind(pid);
827 LOG(VB_GENERAL, LOG_WARNING,
LOC +
828 "Currently we ignore \'current\' param");
830 std::vector<const TerrestrialVirtualChannelTable*> tvcts;
836 tvcts.push_back(tvct);
846 LOG(VB_GENERAL, LOG_WARNING,
LOC +
847 "Currently we ignore \'current\' param");
849 std::vector<const CableVirtualChannelTable*> cvcts;
855 cvcts.push_back(cvct);
919 psip_refcnt_map_t::iterator it;
929 for (
auto & tvct : tvcts)
936 for (
auto & cvct : cvcts)
946 [val](
auto & listener){ return val == listener; } ))
957 if (((
void*)val) == ((
void*)*it))
970 [val](
auto & listener){ return val == listener; } ))
982 if (((
void*)val) == ((
void*)*it))
995 [val](
auto & listener){ return val == listener; } ))
1007 if (((
void*)val) == ((
void*)*it))
1020 [val](
auto & listener){ return val == listener; } ))
1032 if (((
void*)val) == ((
void*)*it))
1045 [val](
auto & listener){ return val == listener; } ))
1057 if (((
void*)val) == ((
void*)*it))
std::vector< const TerrestrialVirtualChannelTable * > tvct_vec_t
std::vector< const CableVirtualChannelTable * > cvct_vec_t
QMap< uint, int > m_cvctVersion
bool HasCachedAnyCVCTs(bool current=true) const
atsc_eit_listener_vec_t m_atscEitListeners
void RemoveATSC81EITListener(ATSC81EITStreamListener *val)
cvct_vec_t GetCachedCVCTs(bool current=true) const
cvct_const_ptr_t GetCachedCVCT(uint pid, bool current=true) const
void RemoveATSCMainListener(ATSCMainStreamListener *val)
void SetVersionTVCT(uint tsid, int version)
void SetVersionCVCT(uint tsid, int version)
atsc_ett_pid_map_t m_atscEttPids
bool GetEITPIDChanges(const uint_vec_t &cur_pids, uint_vec_t &add_pids, uint_vec_t &del_pids) const override
bool IsRedundant(uint pid, const PSIPTable &psip) const override
Returns true if table already seen.
void SetVersionMGT(int version)
void RemoveATSCAuxListener(ATSCAuxStreamListener *val)
void AddATSCEITListener(ATSCEITStreamListener *val)
void ReturnCachedTVCTTables(tvct_vec_t &tvcts) const
void CacheTVCT(uint pid, TerrestrialVirtualChannelTable *tvct)
atsc81_eit_listener_vec_t m_atsc81EitListeners
void ProcessMGT(const MasterGuideTable *mgt)
void Reset(void) override
void AddSCTEMainListener(SCTEMainStreamListener *val)
bool HasChannel(uint major, uint minor) const
void ProcessVCT(uint tsid, const VirtualChannelTable *vct)
const MasterGuideTable * GetCachedMGT(bool current=true) const
bool HasCachedAllTVCTs(bool current=true) const
bool DeleteCachedTable(const PSIPTable *psip) const override
uint GPSOffset(void) const
Current UTC to GPS time offset in seconds.
tvct_const_ptr_t GetCachedTVCT(uint pid, bool current=true) const
tvct_cache_t m_cachedTvcts
bool HasCachedTVCT(uint pid, bool current=true) const
MasterGuideTable * m_cachedMgt
void ProcessCVCT(uint tsid, const CableVirtualChannelTable *vct)
void SetVersionRRT(uint region, int version)
atsc_eit_pid_map_t m_atscEitPids
TableStatusMap m_eitStatus
bool HasCachedCVCT(uint pid, bool current=true) const
uint GetATSCMajorMinor(uint eit_sourceid) const
cvct_cache_t m_cachedCvcts
void ProcessTVCT(uint tsid, const TerrestrialVirtualChannelTable *vct)
void ReturnCachedCVCTTables(cvct_vec_t &cvcts) const
bool HasEITPIDChanges(const uint_vec_t &in_use_pid) const override
bool HasCachedAnyTVCTs(bool current=true) const
void RemoveSCTEMainListener(SCTEMainStreamListener *val)
void RemoveATSCEITListener(ATSCEITStreamListener *val)
ATSCStreamData(int desiredMajorChannel, int desiredMinorChannel, int cardnum, bool cacheTables=false)
Initializes ATSCStreamData.
bool HandleTables(uint pid, const PSIPTable &psip) override
Process PSIP packets.
void CacheCVCT(uint pid, CableVirtualChannelTable *cvct)
tvct_vec_t GetCachedTVCTs(bool current=true) const
int VersionCVCT(uint tsid) const
~ATSCStreamData() override
void AddATSCAuxListener(ATSCAuxStreamListener *val)
void AddATSC81EITListener(ATSC81EITStreamListener *val)
atsc_main_listener_vec_t m_atscMainListeners
void AddATSCMainListener(ATSCMainStreamListener *val)
int VersionTVCT(uint tsid) const
int m_desiredMinorChannel
void CacheMGT(MasterGuideTable *mgt)
int m_desiredMajorChannel
bool HasCachedMGT(bool current=true) const
scte_main_listener_vec_t m_scteMainlisteners
QMap< uint, int > m_tvctVersion
int VersionRRT(uint region) const
void SetDesiredChannel(int major, int minor)
bool HasCachedAllCVCTs(bool current=true) const
atsc_aux_listener_vec_t m_atscAuxListeners
QMap< uint, uint > m_sourceIdToAtscMajMin
This table contains information about the cable channels transmitted on this multiplex.
No one has had time to decode this table yet...
No one has had time to decode this table yet...
void AddETT(uint, uint, const ExtendedTextTable *)
uint GetGPSOffset(void) const
void AddEIT(uint, uint, const EventInformationTable *)
void SetGPSOffset(uint gps_offset)
ExtendedTextTable contain additional text not contained in EventInformationTables.
uint SourceID(void) const
bool IsEventETM(void) const
Encapsulates data about MPEG stream and emits events for each table.
void SetDesiredProgram(int p)
QRecursiveMutex m_listenerLock
psip_refcnt_map_t m_cachedSlatedForDeletion
void UpdateTimeOffset(uint64_t si_utc_time)
QRecursiveMutex m_cacheLock
virtual bool DeleteCachedTable(const PSIPTable *psip) const
psip_refcnt_map_t m_cachedRefCnt
virtual bool IsRedundant(uint pid, const PSIPTable &psip) const
Returns true if table already seen.
virtual void ReturnCachedTable(const PSIPTable *psip) const
bool HasProgram(uint progNum) const
virtual void AddListeningPID(uint pid, PIDPriority priority=kPIDPriorityNormal)
virtual bool HandleTables(uint pid, const PSIPTable &psip)
Process PSIP packets.
void IncrementRefCnt(const PSIPTable *psip) const
This table tells the decoder on which PIDs to find other tables, and their sizes and each table's cur...
uint TableType(uint i) const
uint TablePID(uint i) const
int TableClass(uint i) const
const TSHeader * tsheader() const
A PSIP table is a variant of a PES packet containing an MPEG, ATSC or DVB table.
uint LastSection(void) const
uint TableIDExtension(void) const
No one has had time to decode this table yet...
void SetSectionSeen(uint32_t key, int32_t version, uint32_t section, uint32_t last_section, uint32_t segment_last_section=0xffff)
bool IsSectionSeen(uint32_t key, int32_t version, uint32_t section) const
This table contains information about the terrestrial channels transmitted on this multiplex.
This table contains information about the channels transmitted on this multiplex.
bool IsHiddenInGuide(uint i) const
bool IsHidden(uint i) const
uint MajorChannel(uint i) const
uint TransportStreamID() const
uint MinorChannel(uint i) const
int Find(int major, int minor) const
uint ProgramNumber(uint i) const
uint SourceID(uint i) const
uint ModulationMode(uint i) const
uint ChannelCount() 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)
std::vector< uint > uint_vec_t
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.