MythTV  master
scanstreamdata.cpp
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 // Copyright (c) 2003-2004, Daniel Thor Kristjansson
3 #include "scanstreamdata.h"
4 #include "atsctables.h"
5 #include "dvbtables.h"
6 
7 ScanStreamData::ScanStreamData(bool no_default_pid) :
8  MPEGStreamData(-1, -1, true),
9  ATSCStreamData(-1, -1, -1, true),
10  DVBStreamData(0, 0, -1, -1, true),
11  m_noDefaultPid(no_default_pid)
12 {
13  if (m_noDefaultPid)
14  m_pidsListening.clear();
15 }
16 
18 
22 bool ScanStreamData::IsRedundant(uint pid, const PSIPTable &psip) const
23 {
24  return (ATSCStreamData::IsRedundant(pid,psip) ||
25  DVBStreamData::IsRedundant(pid,psip));
26 }
27 
32 {
33  bool h0 = ATSCStreamData::HandleTables(pid, psip);
34  bool h1 = DVBStreamData::HandleTables(pid, psip);
35  return h0 || h1;
36 }
37 
39 {
40  // MPEG
43 
44  // ATSC
47 
48  // DVB
52 
53  // Extra
54  if (m_dvbUkFreesatSi)
56 }
57 
59 {
61  ATSCStreamData::Reset(-1,-1);
62  DVBStreamData::Reset(0,0,-1);
63 
64  if (m_noDefaultPid)
65  {
66  m_pidsListening.clear();
67  return;
68  }
69 
71 }
72 
73 void ScanStreamData::Reset(uint desired_netid, uint desired_tsid, int desired_serviceid)
74 {
75  DVBStreamData::Reset(desired_netid, desired_tsid, desired_serviceid);
76 
77  if (m_noDefaultPid)
78  {
79  m_pidsListening.clear();
80  return;
81  }
82 
84 }
85 
86 QString ScanStreamData::GetSIStandard(const QString& guess) const
87 {
88  if (HasCachedMGT())
89  return "atsc";
90 
91  if (HasCachedAnyNIT())
92  return "dvb";
93 
94  QMutexLocker locker(&m_cacheLock);
95 
96  for (const auto *pmt : m_cachedPmts)
97  {
98  for (uint i = 0; (guess != "dvb") && (i < pmt->StreamCount()); i++)
99  {
100  if (StreamID::OpenCableVideo == pmt->StreamType(i))
101  return "opencable";
102  }
103 
105  pmt->ProgramInfo(), pmt->ProgramInfoLength(),
107 
108  for (auto & desc : descs)
109  {
110  RegistrationDescriptor reg(desc);
111  if (!reg.IsValid())
112  continue;
113  if (reg.FormatIdentifierString() == "SCTE")
114  return "opencable";
115  }
116  }
117 
118  return "mpeg";
119 }
120 
121 
123 {
124  if (!psip)
125  return false;
126 
128  return true;
130 }
bool HasCachedAnyNIT(bool current=true) const
bool DeleteCachedTable(const PSIPTable *psip) const override
virtual void Reset(void)
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
~ScanStreamData() override
ScanStreamData(bool no_default_pid=false)
bool HandleTables(uint pid, const PSIPTable &psip) override
Processes PSIP tables.
bool HasCachedMGT(bool current=true) const
bool IsRedundant(uint pid, const PSIPTable &psip) const override
Returns true if table already seen.
pmt_cache_t m_cachedPmts
bool HandleTables(uint pid, const PSIPTable &psip) override
Process PSIP packets.
vector< const unsigned char * > desc_list_t
Overall structure.
A PSIP table is a variant of a PES packet containing an MPEG, ATSC or DVB table.
Definition: mpegtables.h:386
void Reset(void) override
Always MPEG-2??
Definition: mpegtables.h:120
unsigned int uint
Definition: compat.h:140
bool IsRedundant(uint pid, const PSIPTable &psip) const override
Returns true if table already seen.
void AddAllListeningPIDs(void)
pid_map_t m_pidsListening
bool m_dvbUkFreesatSi
listen for additional Freesat service information
bool DeleteCachedTable(const PSIPTable *psip) const override
virtual void AddListeningPID(uint pid, PIDPriority priority=kPIDPriorityNormal)
QString FormatIdentifierString(void) const
void Reset(void) override
Definition: dvbstreamdata.h:40
QString GetSIStandard(const QString &guess="mpeg") const
bool DeleteCachedTable(const PSIPTable *psip) const override
bool IsRedundant(uint pid, const PSIPTable &psip) const override
Returns true if table already seen.
bool IsValid(void) const
bool HandleTables(uint pid, const PSIPTable &psip) override
Process PSIP packets.
Encapsulates data about ATSC stream and emits events for most tables.
static desc_list_t ParseOnlyInclude(const unsigned char *data, uint len, int excluded_descid)
Encapsulates data about MPEG stream and emits events for each table.
void Reset(void) override