Go to the documentation of this file.
3 #ifndef MPEGSTREAMDATA_H_
4 #define MPEGSTREAMDATA_H_
31 using pat_vec_t = std::vector<const ProgramAssociationTable *>;
37 using cat_vec_t = std::vector<const ConditionalAccessTable *>;
43 using pmt_vec_t = std::vector<const ProgramMapTable*>;
70 uint m_encryptedPackets {0};
71 uint m_decryptedPackets {0};
72 uint m_encryptedMin {1000};
91 void SetCaching(
bool cacheTables) { m_cacheTables = cacheTables; }
95 virtual void Reset(
int desiredProgram);
112 virtual bool IsRedundant(
uint pid,
const PSIPTable &psip)
const;
114 virtual void HandleTSTables(
const TSPacket* tspacket);
115 virtual bool ProcessTSPacket(
const TSPacket& tspacket);
116 virtual int ProcessData(
const unsigned char *buffer,
int len);
117 inline void HandleAdaptationFieldControl(
const TSPacket* tspacket);
122 { m_pidsListening[pid] = priority; }
127 { m_pidsWriting[pid] = priority; }
130 { m_pidsAudio[pid] = priority; }
133 { m_pidsConditionalAccess[pid] = priority; }
137 { m_pidsNotListening.remove(pid); }
141 virtual bool IsListeningPID(
uint pid)
const;
142 virtual bool IsNotListeningPID(
uint pid)
const;
143 virtual bool IsWritingPID(
uint pid)
const;
145 {
return m_pidVideoSingleProgram == pid; }
146 virtual bool IsAudioPID(
uint pid)
const;
147 virtual bool IsConditionalAccessPID(
uint pid)
const;
150 {
return m_pidsListening; }
152 {
return m_pidsAudio; }
154 {
return m_pidsWriting; }
164 m_patStatus.SetVersion(tsid,
version, last_section);
168 m_pmtStatus.SetVersion(pnum,
version, last_section);
172 bool HasAllPATSections(
uint tsid)
const;
174 bool HasAllCATSections(
uint tsid)
const;
176 bool HasAllPMTSections(
uint prog_num)
const;
179 bool HasProgram(
uint progNum)
const;
181 bool HasCachedAllPAT(
uint tsid)
const;
182 bool HasCachedAnyPAT(
uint tsid)
const;
183 bool HasCachedAnyPAT(
void)
const;
185 bool HasCachedAllCAT(
uint tsid)
const;
186 bool HasCachedAnyCAT(
uint tsid)
const;
187 bool HasCachedAnyCAT(
void)
const;
189 bool HasCachedAllPMT(
uint pnum)
const;
190 bool HasCachedAnyPMT(
uint pnum)
const;
191 bool HasCachedAllPMTs(
void)
const;
192 bool HasCachedAnyPMTs(
void)
const;
208 virtual void ReturnCachedTable(
const PSIPTable *psip)
const;
209 virtual void ReturnCachedPATTables(
pat_vec_t &pats)
const;
210 virtual void ReturnCachedPATTables(
pat_map_t &pats)
const;
211 virtual void ReturnCachedCATTables(
cat_vec_t &cats)
const;
212 virtual void ReturnCachedCATTables(
cat_map_t &cats)
const;
213 virtual void ReturnCachedPMTTables(
pmt_vec_t &pmts)
const;
214 virtual void ReturnCachedPMTTables(
pmt_map_t &pmts)
const;
217 void AddEncryptionTestPID(
uint pnum,
uint pid,
bool isvideo);
218 void RemoveEncryptionTestPIDs(
uint pnum);
219 bool IsEncryptionTestPID(
uint pid)
const;
222 void ResetDecryptionMonitoringState(
void);
224 bool IsProgramDecrypted(
uint pnum)
const;
225 bool IsProgramEncrypted(
uint pnum)
const;
246 void SetDesiredProgram(
int p);
250 { m_pmtSingleProgramNumVideo = num; }
252 {
return m_pmtSingleProgramNumVideo; }
254 { m_pmtSingleProgramNumAudio = num; }
256 {
return m_pmtSingleProgramNumAudio; }
257 void SetRecordingType(
const QString &recording_type);
265 {
return m_patSingleProgram; }
267 {
return m_pmtSingleProgram; }
270 {
return m_patSingleProgram; }
272 {
return m_pmtSingleProgram; }
275 int VersionPATSingleProgram(
void)
const;
276 int VersionPMTSingleProgram(
void)
const;
287 {
return m_partialPsipPacketCache[pid]; }
289 { m_partialPsipPacketCache.remove(pid); }
290 void DeletePartialPSIP(
uint pid);
294 void ProcessEncryptedPacket(
const TSPacket &tspacket);
296 static int ResyncStream(
const unsigned char *buffer,
int curr_pos,
int len);
298 void UpdateTimeOffset(uint64_t si_utc_time);
301 void IncrementRefCnt(
const PSIPTable *psip)
const;
302 virtual bool DeleteCachedTable(
const PSIPTable *psip)
const;
309 QString m_siStandard {
"mpeg"};
311 bool m_haveCrcBug {
false};
316 std::array<double,16> m_siTimeOffsets {0.0};
320 float m_eitRate {1.0F};
328 bool m_listeningDisabled {
false};
364 QString m_recordingType {
"all"};
365 bool m_stripPmtDescriptors {
false};
366 bool m_normalizeStreamType {
true};
367 uint m_pidVideoSingleProgram {0xffffffff};
368 uint m_pidPmtSingleProgram {0xffffffff};
369 uint m_pmtSingleProgramNumVideo {1};
370 uint m_pmtSingleProgramNumAudio {0};
376 bool m_invalidPatSeen {
false};
377 bool m_invalidPatWarning {
false};
psip_refcnt_map_t m_cachedRefCnt
ProgramMapTable * PMTSingleProgram(void)
std::vector< const ProgramAssociationTable * > pat_vec_t
pid_psip_map_t m_partialPsipPacketCache
std::vector< TSPacketListener * > ts_listener_vec_t
pid_map_t m_pidsListening
QRecursiveMutex m_cacheLock
void SetVideoStreamsRequired(uint num)
void ClearPartialPSIP(uint pid)
MythTimer m_invalidPatTimer
A QElapsedTimer based timer to replace use of QTime as a timer.
void SetCaching(bool cacheTables)
QMap< uint, ProgramMapTable * > pmt_cache_t
uint VideoPIDSingleProgram(void) const
QMap< uint, CryptInfo > m_encryptionPidToInfo
QMap< unsigned int, PSIPTable * > pid_psip_map_t
QMap< uint, pat_vec_t > pat_map_t
virtual void AddNotListeningPID(uint pid)
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
bool IsVideoPID(uint pid) const
std::vector< MPEGSingleProgramStreamListener * > mpeg_sp_listener_vec_t
uint GetVideoStreamsRequired() const
std::vector< uint > uint_vec_t
std::vector< PSStreamListener * > ps_listener_vec_t
virtual void RemoveNotListeningPID(uint pid)
void SetPMTSingleProgram(ProgramMapTable *pmt)
CryptInfo(uint e, uint d)
const ProgramMapTable * PMTSingleProgram(void) const
virtual void SetEITRate(float rate)=0
A PSIP table is a variant of a PES packet containing an MPEG, ATSC or DVB table.
int VersionPATSingleProgram(void) const
void SetIgnoreCRC(bool haveCRCbug)
std::vector< const ProgramMapTable * > pmt_vec_t
QMap< uint, ConditionalAccessTable * > cat_cache_t
const ProgramAssociationTable * PATSingleProgram(void) const
ts_av_listener_vec_t m_tsAvListeners
pid_map_t m_pidsNotListening
QMap< const PSIPTable *, int > psip_refcnt_map_t
std::vector< TSPacketListenerAV * > ts_av_listener_vec_t
void SetVersionPAT(uint tsid, int version, uint last_section)
Used to access the data of a Transport Stream packet.
QRecursiveMutex m_listenerLock
ProgramMapTable const * pmt_const_ptr_t
virtual void SetEITHelper(EITHelper *)=0
Encapsulates data about MPEG stream and emits events for each table.
virtual void AddConditionalAccessPID(uint pid, PIDPriority priority=kPIDPriorityNormal)
std::vector< MPEGStreamListener * > mpeg_listener_vec_t
int VersionPMTSingleProgram(void) const
ProgramMapTable * m_pmtSingleProgram
mpeg_listener_vec_t m_mpegListeners
TableStatusMap m_catStatus
void SetAudioStreamsRequired(uint num)
const pid_map_t & WritingPIDs(void) const
TableStatusMap m_pmtStatus
The Program Association Table lists all the programs in a stream, and is always found on PID 0.
std::vector< const ConditionalAccessTable * > cat_vec_t
QMap< uint, CryptStatus > m_encryptionPnumToStatus
QMap< uint, PIDPriority > pid_map_t
virtual void RemoveAudioPID(uint pid)
uint GetAudioStreamsRequired() const
virtual void AddWritingPID(uint pid, PIDPriority priority=kPIDPriorityHigh)
QMap< uint, cat_vec_t > cat_map_t
int DesiredProgram(void) const
QMap< uint, ProgramAssociationTable * > pat_cache_t
QMap< uint, pmt_vec_t > pmt_map_t
mpeg_sp_listener_vec_t m_mpegSpListeners
void SetPATSingleProgram(ProgramAssociationTable *pat)
The CAT is used to transmit additional ConditionalAccessDescriptor instances, in addition to the ones...
const pid_map_t & ListeningPIDs(void) const
psip_refcnt_map_t m_cachedSlatedForDeletion
virtual void AddAudioPID(uint pid, PIDPriority priority=kPIDPriorityHigh)
void HandleAdaptationFieldControl(const TSPacket *tspacket)
QRecursiveMutex m_encryptionLock
ps_listener_vec_t m_psListeners
virtual bool GetEITPIDChanges(const uint_vec_t &, uint_vec_t &, uint_vec_t &) const
ts_listener_vec_t m_tsWritingListeners
QString GetRecordingType(void) const
virtual void AddListeningPID(uint pid, PIDPriority priority=kPIDPriorityNormal)
const pid_map_t & AudioPIDs(void) const
void SetVersionPMT(uint pnum, int version, uint last_section)
TableStatusMap m_patStatus
virtual void RemoveWritingPID(uint pid)
static const iso6937table * d
virtual bool HasEITPIDChanges(const uint_vec_t &) const
QMap< uint, uint_vec_t > m_encryptionPnumToPids
QMap< uint, uint_vec_t > m_encryptionPidToPnums
ProgramAssociationTable * PATSingleProgram(void)
PSIPTable * GetPartialPSIP(uint pid)
virtual void RemoveListeningPID(uint pid)
void SetListeningDisabled(bool lt)
pid_map_t m_pidsConditionalAccess
std::vector< unsigned char > uchar_vec_t
ProgramAssociationTable * m_patSingleProgram