5#include <QSharedPointer>
18#define LOC QString("DVBStream[%1]: ").arg(m_cardId)
22 int desired_program,
int cardnum,
bool cacheTables)
24 m_desiredNetId(desired_netid), m_desiredTsId(desired_tsid)
51 uint networkID = first_sdt->OriginalNetworkID();
52 if (networkID == netid)
57 uint last_section = first_sdt->LastSection();
60 for (
uint i = 1; i <= last_section; ++i)
71 Reset(netid, tsid, serviceid);
84 const int table_id = psip.
TableID();
117 uint key = (table_id<<16) | service_id;
152 uint key = (table_id<<16) | service_id;
167 int desired_serviceid)
186 for (
const auto & nit : std::as_const(
m_cachedNit))
248 listener->HandleNIT(nit);
255 listener->HandleNIT(&nit);
288 listener->HandleTDT(&tdt);
300 listener->HandleNITo(&nit);
337 listener->HandleSDTo(tsid, &sdt);
353 listener->HandleBAT(bat);
360 listener->HandleBAT(&bat);
384 listener->HandleEIT(&eit);
404 listener->HandleEIT(&cit);
434 listener->HandleSDT(tsid, sdt);
441 bool has_eit = !in_use_pids.empty();
442 return want_eit != has_eit;
453#ifdef __cpp_lib_ranges_contains
464#ifdef __cpp_lib_ranges_contains
475#ifdef __cpp_lib_ranges_contains
491#ifdef __cpp_lib_ranges_contains
492 if (!std::ranges::contains(cur_pids, pid))
495 pid) == cur_pids.end())
497 add_pids.push_back(pid);
501#ifdef __cpp_lib_ranges_contains
502 if (!std::ranges::contains(cur_pids, pid))
505 pid) == cur_pids.end())
507 add_pids.push_back(pid);
513#ifdef __cpp_lib_ranges_contains
524#ifdef __cpp_lib_ranges_contains
535#ifdef __cpp_lib_ranges_contains
546#ifdef __cpp_lib_ranges_contains
559#ifdef __cpp_lib_ranges_contains
570#ifdef __cpp_lib_ranges_contains
581#ifdef __cpp_lib_ranges_contains
597#ifdef __cpp_lib_ranges_contains
598 if (std::ranges::contains(cur_pids, pid))
601 pid) != cur_pids.end())
603 del_pids.push_back(pid);
607#ifdef __cpp_lib_ranges_contains
608 if (std::ranges::contains(cur_pids, pid))
611 pid) != cur_pids.end())
613 del_pids.push_back(pid);
619#ifdef __cpp_lib_ranges_contains
630#ifdef __cpp_lib_ranges_contains
641#ifdef __cpp_lib_ranges_contains
652#ifdef __cpp_lib_ranges_contains
663 return !add_pids.empty() || !del_pids.empty();
696 LOG(VB_GENERAL, LOG_WARNING,
LOC +
697 "Currently we ignore \'current\' param");
707 LOG(VB_GENERAL, LOG_WARNING,
LOC +
708 "Currently we ignore \'current\' param");
717 for (
uint i = 0; i <= last_section; i++)
729 LOG(VB_GENERAL, LOG_WARNING,
LOC +
730 "Currently we ignore \'current\' param");
732 for (
uint i = 0; i <= 255; i++)
744 LOG(VB_GENERAL, LOG_WARNING,
LOC +
745 "Currently we ignore \'current\' param");
747 bat_cache_t::const_iterator it =
m_cachedBats.constFind(batid << 8);
751 uint last_section = (*it)->LastSection();
755 for (
uint i = 1; i <= last_section; i++)
789 LOG(VB_GENERAL, LOG_WARNING,
LOC +
790 "Currently we ignore \'current\' param");
792 sdt_cache_t::const_iterator it =
m_cachedSdts.constFind(tsid << 8);
796 uint last_section = (*it)->LastSection();
800 for (
uint i = 1; i <= last_section; i++)
812 LOG(VB_GENERAL, LOG_WARNING,
LOC +
813 "Currently we ignore \'current\' param");
815 for (
uint i = 0; i <= 255; i++)
831 for (
uint i = 0; i < nit->TransportStreamCount(); i++)
856 if ((
int)nit->TransportStreamCount() >
m_cachedSdts.size())
859 for (
uint i = 0; i < nit->TransportStreamCount(); i++)
873 LOG(VB_GENERAL, LOG_WARNING,
LOC +
874 "Currently we ignore \'current\' param");
878 nit_cache_t::const_iterator it =
m_cachedNit.constFind(section_num);
891 for (
uint i = 0; i < 256; i++)
907 LOG(VB_GENERAL, LOG_WARNING,
LOC +
908 "Currently we ignore \'current\' param");
912 uint key = (batid << 8) | section_num;
913 bat_cache_t::const_iterator it =
m_cachedBats.constFind(key);
925 LOG(VB_GENERAL, LOG_WARNING,
LOC +
926 "Currently we ignore \'current\' param");
945 LOG(VB_GENERAL, LOG_WARNING,
LOC +
946 "Currently we ignore \'current\' param");
950 uint key = (tsid << 8) | section_num;
951 sdt_cache_t::const_iterator it =
m_cachedSdts.constFind(key);
963 LOG(VB_GENERAL, LOG_WARNING,
LOC +
964 "Currently we ignore \'current\' param");
971 uint lastSection = sdt->LastSection();
975 for (
uint section = 1; section <= lastSection; section++)
992 LOG(VB_GENERAL, LOG_WARNING,
LOC +
993 "Currently we ignore \'current\' param");
1000 sdts.push_back(sdt);
1008 for (
auto & sdt : sdts)
1049 psip_refcnt_map_t::iterator it;
1098#ifdef __cpp_lib_ranges_contains
1102 [val](
auto & listener){
return val == listener; } ))
1122#ifdef __cpp_lib_ranges_contains
1126 [val](
auto & listener){
return val == listener; } ))
1146#ifdef __cpp_lib_ranges_contains
1150 [val](
auto & listener){
return val == listener; } ))
Tells what channels can be found on each transponder for one bouquet (a bunch of channels from one pr...
uint m_desiredNetId
DVB table monitoring.
void AddDVBOtherListener(DVBOtherStreamListener *val)
bool GetEITPIDChanges(const uint_vec_t &cur_pids, uint_vec_t &add_pids, uint_vec_t &del_pids) const override
void Reset(void) override
bool HasAllSDToSections(uint tsid) const
void RemoveDVBMainListener(DVBMainStreamListener *val)
TableStatusMap m_eitStatus
bool HasAllSDTSections(uint tsid) const
TableStatusMap m_sdtStatus
bool IsRedundant(uint pid, const PSIPTable &psip) const override
Returns true if table already seen.
sdt_vec_t GetCachedSDTSections(uint tsid, bool current=true) const
bool HasAnyEIT(void) const
bool HasCachedAnySDTs(bool current=true) const
bool HasAllBATSections(uint bid) const
void CacheNIT(NetworkInformationTable *nit)
bool DeleteCachedTable(const PSIPTable *psip) const override
void AddDVBEITListener(DVBEITStreamListener *val)
sdt_vec_t GetCachedSDTs(bool current=true) const
bool HasCachedAnyBATs(bool current=true) const
bool m_dvbEitDishnetLong
Decode DishNet's long-term DVB EIT.
dvb_other_listener_vec_t m_dvbOtherListeners
dvb_has_eit_t m_dvbHasEit
Tell us if the DVB service has EIT.
bool HasAllNIToSections(void) const
TableStatusMap m_sdtoStatus
void RemoveDVBOtherListener(DVBOtherStreamListener *val)
bool HasCachedAllBATs(bool current=true) const
bool HasCachedAnySDT(uint tsid, bool current=true) const
void SetDesiredService(uint netid, uint tsid, int serviceid)
bool HasCachedAnyNIT(bool current=true) const
bool HandleTables(uint pid, const PSIPTable &psip) override
Process PSIP packets.
bool HasCachedAllBAT(uint batid, bool current=true) const
bool HasAllNITSections(void) const
void AddDVBMainListener(DVBMainStreamListener *val)
bat_vec_t GetCachedBATs(bool current=true) const
sdt_const_ptr_t GetCachedSDT(uint tsid, uint section_num, bool current=true) const
bool HasCachedAllSDT(uint tsid, bool current=true) const
bool HasCachedAllSDTs(bool current=true) const
bool HasCachedAnyBAT(uint batid, bool current=true) const
void CacheBAT(BouquetAssociationTable *bat)
bat_const_ptr_t GetCachedBAT(uint batid, uint section_num, bool current=true) const
void RemoveDVBEITListener(DVBEITStreamListener *val)
TableStatusMap m_citStatus
bool HasCachedSDT(bool current=true) const
TableStatusMap m_batStatus
DVBStreamData(uint desired_netid, uint desired_tsid, int desired_program, int cardnum, bool cacheTables=false)
void ReturnCachedSDTTables(sdt_vec_t &sdts) const
dvb_eit_listener_vec_t m_dvbEitListeners
nit_const_ptr_t GetCachedNIT(uint section_num, bool current=true) const
~DVBStreamData() override
bool HasEITPIDChanges(const uint_vec_t &in_use_pids) const override
dvb_main_listener_vec_t m_dvbMainListeners
void CacheSDT(ServiceDescriptionTable *sdt)
bool HasCachedAllNIT(bool current=true) const
void ProcessSDT(uint tsid, const ServiceDescriptionTable *sdt)
void AddEIT(uint, uint, const EventInformationTable *)
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
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
@ PREMIERE_EIT_DIREKT_PID
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
static bool IsEIT(uint table_id)
uint ContentID(void) const
This table tells the decoder on which PIDs to find A/V data.
uint TSID() const
transport_stream_id 16 3.0 0x0000
bool HasEITPresentFollowing(uint i) const
bool HasEITSchedule(uint i) const
uint ServiceID(uint i) const
service_id 16 0.0+p
uint ServiceCount() const
Number of services.
uint OriginalNetworkID() const
original_network_id 16 8.0
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
bool HasAllSections(uint32_t key) const
void SetVersion(int32_t version, uint32_t last_section)
void SetSectionSeen(int32_t version, uint32_t section, uint32_t last_section, uint32_t segment_last_section=0xffff)
bool IsSectionSeen(int32_t version, uint32_t section) const
bool HasAllSections() const
This table gives the current DVB stream time.
time_t UTCUnix(void) const
static constexpr uint8_t MCA_EIT_TSID
ServiceDescriptionTable const * sdt_const_ptr_t
std::vector< const ServiceDescriptionTable * > sdt_vec_t
std::vector< const NetworkInformationTable * > nit_vec_t
std::vector< const BouquetAssociationTable * > bat_vec_t
NetworkInformationTable const * nit_const_ptr_t
BouquetAssociationTable const * bat_const_ptr_t
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.