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 {
41  ATSCStreamData::Reset(-1,-1);
42  DVBStreamData::Reset(0,0,-1);
43 
44  if (m_noDefaultPid)
45  {
46  m_pidsListening.clear();
47  return;
48  }
49 
54  if (m_dvbUkFreesatSi)
56 }
57 
58 QString ScanStreamData::GetSIStandard(const QString& guess) const
59 {
60  if (HasCachedMGT())
61  return "atsc";
62 
63  if (HasCachedAnyNIT())
64  return "dvb";
65 
66  QMutexLocker locker(&m_cacheLock);
67 
68  foreach (auto pmt, m_cachedPmts)
69  {
70  for (uint i = 0; (guess != "dvb") && (i < pmt->StreamCount()); i++)
71  {
72  if (StreamID::OpenCableVideo == pmt->StreamType(i))
73  return "opencable";
74  }
75 
77  pmt->ProgramInfo(), pmt->ProgramInfoLength(),
79 
80  for (auto & desc : descs)
81  {
82  RegistrationDescriptor reg(desc);
83  if (!reg.IsValid())
84  continue;
85  if (reg.FormatIdentifierString() == "SCTE")
86  return "opencable";
87  }
88  }
89 
90  return "mpeg";
91 }
92 
93 
95 {
96  if (!psip)
97  return false;
98 
100  return true;
102 }
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
unsigned int uint
Definition: compat.h:140
bool IsRedundant(uint pid, const PSIPTable &psip) const override
Returns true if table already seen.
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
Always MPEG-2??
Definition: mpegtables.h:120