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 if (
find(cur_pids.begin(), cur_pids.end(),
460 find(cur_pids.begin(), cur_pids.end(),
467 find(cur_pids.begin(), cur_pids.end(),
479 if (
find(cur_pids.begin(), cur_pids.end(),
480 pid) == cur_pids.end())
481 add_pids.push_back(pid);
485 if (
find(cur_pids.begin(), cur_pids.end(),
486 pid) == cur_pids.end())
487 add_pids.push_back(pid);
493 find(cur_pids.begin(), cur_pids.end(),
500 find(cur_pids.begin(), cur_pids.end(),
507 find(cur_pids.begin(), cur_pids.end(),
514 find(cur_pids.begin(), cur_pids.end(),
523 if (
find(cur_pids.begin(), cur_pids.end(),
530 find(cur_pids.begin(), cur_pids.end(),
537 find(cur_pids.begin(), cur_pids.end(),
549 if (
find(cur_pids.begin(), cur_pids.end(),
550 pid) != cur_pids.end())
551 del_pids.push_back(pid);
555 if (
find(cur_pids.begin(), cur_pids.end(),
556 pid) != cur_pids.end())
557 del_pids.push_back(pid);
563 find(cur_pids.begin(), cur_pids.end(),
570 find(cur_pids.begin(), cur_pids.end(),
577 find(cur_pids.begin(), cur_pids.end(),
584 find(cur_pids.begin(), cur_pids.end(),
591 return !add_pids.empty() || !del_pids.empty();
624 LOG(VB_GENERAL, LOG_WARNING,
LOC +
625 "Currently we ignore \'current\' param");
635 LOG(VB_GENERAL, LOG_WARNING,
LOC +
636 "Currently we ignore \'current\' param");
645 for (
uint i = 0; i <= last_section; i++)
657 LOG(VB_GENERAL, LOG_WARNING,
LOC +
658 "Currently we ignore \'current\' param");
660 for (
uint i = 0; i <= 255; i++)
672 LOG(VB_GENERAL, LOG_WARNING,
LOC +
673 "Currently we ignore \'current\' param");
675 bat_cache_t::const_iterator it =
m_cachedBats.constFind(batid << 8);
679 uint last_section = (*it)->LastSection();
683 for (
uint i = 1; i <= last_section; i++)
717 LOG(VB_GENERAL, LOG_WARNING,
LOC +
718 "Currently we ignore \'current\' param");
720 sdt_cache_t::const_iterator it =
m_cachedSdts.constFind(tsid << 8);
724 uint last_section = (*it)->LastSection();
728 for (
uint i = 1; i <= last_section; i++)
740 LOG(VB_GENERAL, LOG_WARNING,
LOC +
741 "Currently we ignore \'current\' param");
743 for (
uint i = 0; i <= 255; i++)
759 for (
uint i = 0; i < nit->TransportStreamCount(); i++)
784 if ((
int)nit->TransportStreamCount() >
m_cachedSdts.size())
787 for (
uint i = 0; i < nit->TransportStreamCount(); i++)
801 LOG(VB_GENERAL, LOG_WARNING,
LOC +
802 "Currently we ignore \'current\' param");
806 nit_cache_t::const_iterator it =
m_cachedNit.constFind(section_num);
819 for (
uint i = 0; i < 256; i++)
835 LOG(VB_GENERAL, LOG_WARNING,
LOC +
836 "Currently we ignore \'current\' param");
840 uint key = (batid << 8) | section_num;
841 bat_cache_t::const_iterator it =
m_cachedBats.constFind(key);
853 LOG(VB_GENERAL, LOG_WARNING,
LOC +
854 "Currently we ignore \'current\' param");
873 LOG(VB_GENERAL, LOG_WARNING,
LOC +
874 "Currently we ignore \'current\' param");
878 uint key = (tsid << 8) | section_num;
879 sdt_cache_t::const_iterator it =
m_cachedSdts.constFind(key);
891 LOG(VB_GENERAL, LOG_WARNING,
LOC +
892 "Currently we ignore \'current\' param");
899 uint lastSection = sdt->LastSection();
903 for (
uint section = 1; section <= lastSection; section++)
920 LOG(VB_GENERAL, LOG_WARNING,
LOC +
921 "Currently we ignore \'current\' param");
936 for (
auto & sdt : sdts)
977 psip_refcnt_map_t::iterator it;
1027 [val](
auto & listener){ return val == listener; } ))
1039 if (((
void*)val) == ((
void*)*it))
1052 [val](
auto & listener){ return val == listener; } ))
1064 if (((
void*)val) == ((
void*)*it))
1077 [val](
auto & listener){ return val == listener; } ))
1089 if (((
void*)val) == ((
void*)*it))
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.