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_no_default_pid(no_default_pid)
12 {
13  if (m_no_default_pid)
14  _pids_listening.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_no_default_pid)
45  {
46  _pids_listening.clear();
47  return;
48  }
49 
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(&_cache_lock);
67 
68  pmt_cache_t::const_iterator it = _cached_pmts.begin();
69  for (; it != _cached_pmts.end(); ++it)
70  {
71  ProgramMapTable *pmt = *it;
72 
73  for (uint i = 0; (guess != "dvb") && (i < pmt->StreamCount()); i++)
74  {
75  if (StreamID::OpenCableVideo == pmt->StreamType(i))
76  return "opencable";
77  }
78 
80  pmt->ProgramInfo(), pmt->ProgramInfoLength(),
82 
83  for (size_t i = 0; i < descs.size(); i++)
84  {
85  RegistrationDescriptor reg(descs[i]);
86  if (!reg.IsValid())
87  continue;
88  if (reg.FormatIdentifierString() == "SCTE")
89  return "opencable";
90  }
91  }
92 
93  return "mpeg";
94 }
95 
96 
98 {
99  if (!psip)
100  return false;
101 
103  return true;
105 }
bool HasCachedAnyNIT(bool current=true) const
virtual void Reset(void)
bool IsRedundant(uint, const PSIPTable &) const override
Returns true if table already seen.
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
bool m_dvb_uk_freesat_si
listen for additional Freesat service information
ScanStreamData(bool no_default_pid=false)
bool HandleTables(uint pid, const PSIPTable &psip) override
Processes PSIP tables.
bool HasCachedMGT(bool current=true) const
unsigned int uint
Definition: compat.h:140
pmt_cache_t _cached_pmts
vector< const unsigned char * > desc_list_t
Overall structure.
uint StreamType(uint i) const
Definition: mpegtables.h:702
bool HandleTables(uint pid, const PSIPTable &) override
Process PSIP packets.
bool IsRedundant(uint pid, const PSIPTable &) const override
Returns true if table already seen.
A PSIP table is a variant of a PES packet containing an MPEG, ATSC or DVB table.
Definition: mpegtables.h:371
void Reset(void) override
bool DeleteCachedTable(PSIPTable *psip) const override
pid_map_t _pids_listening
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
uint ProgramInfoLength(void) const
Definition: mpegtables.h:696
bool IsValid(void) const
bool DeleteCachedTable(PSIPTable *psip) const override
bool HandleTables(uint pid, const PSIPTable &psip) override
Process PSIP packets.
Encapsulates data about ATSC stream and emits events for most tables.
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
Definition: mpegtables.h:656
const unsigned char * ProgramInfo(void) const
Definition: mpegtables.h:699
static desc_list_t ParseOnlyInclude(const unsigned char *data, uint len, int excluded_descid)
bool IsRedundant(uint pid, const PSIPTable &) const override
Returns true if table already seen.
Encapsulates data about MPEG stream and emits events for each table.
bool DeleteCachedTable(PSIPTable *psip) const override
virtual ~ScanStreamData()
void Reset(void) override
Always MPEG-2??
Definition: mpegtables.h:117