MythTV master
mpegtables.h
Go to the documentation of this file.
1// -*- Mode: c++ -*-
2// Copyright (c) 2003-2004, Daniel Thor Kristjansson
3#ifndef MPEG_TABLES_H
4#define MPEG_TABLES_H
5
6#include <cassert>
7#include <utility>
8
9// MythTV headers
10#include "libmythbase/stringutil.h" // for xml_indent
13#include "libmythtv/mythtvexp.h"
14
31static constexpr qint64 GPS_EPOCH { 315964800 };
32
34static constexpr uint8_t GPS_LEAP_SECONDS { 18 };
35// Note: You can obtain this number by adding one
36// for every leap second added to UTC since Jan 6th, 1980
37// and subtracting one for every leap second removed.
38// See http://en.wikipedia.org/wiki/Leap_second
39
40
45{
46 public:
47 enum : std::uint8_t
48 {
49 PictureStartCode = 0x00,
50 SliceStartCodeBegin = 0x01,
51 SliceStartCodeEnd = 0xaf,
52 DVBECMData = 0xb0,
53 DVBEMMData = 0xb1,
54 UserData = 0xb2,
56 SequenceStartCode = 0xb3,
57 SequenceError = 0xb4,
59 MPEG2ExtensionStartCode = 0xb5,
60 MPEGReservedB6 = 0xb6,
61 SEQEndCode = 0xb7,
65 GOPStartCode = 0xb8,
66 ProgramEndCode = 0xb9,
67 PackHeader = 0xba,
68 SystemHeader = 0xbb,
69 ProgramStreamMap = 0xbc,
71 NonMPEGAudioVideo = 0xbd,
72 PaddingStream = 0xbe,
74 DVDNavigation = 0xbf,
76 MPEGAudioStreamBegin = 0xc0,
78 MPEGAudioStreamEnd = 0xdf,
80 MPEGVideoStreamBegin = 0xe0,
82 MPEGVideoStreamEnd = 0xef,
83 ECMData = 0xf0,
84 EMMData = 0xf1,
85 DSMCCData = 0xf2,
87 Data13522 = 0xf3,
89 DataH2221Begin = 0xf4,
91 DataH2221End = 0xf8,
92 AncillaryData = 0xf9,
93 MPEGReservedFA = 0xfa,
94 FlexMux = 0xfb, // MPEG-2 13818-1
95 MPEGReservedFC = 0xfc,
96 MPEGReservedFD = 0xfd,
97 MPEGReservedFE = 0xfe,
98 ProgramStreamDirectory = 0xff, // MPEG-2 13818-1
99 };
100};
101
102
110{
111 public:
112 enum
113 {
114 // video
115 MPEG1Video = 0x01,
116 MPEG2Video = 0x02,
117 MPEG4Video = 0x10,
118 H264Video = 0x1b,
119 H265Video = 0x24,
120 OpenCableVideo = 0x80,
121 VC1Video = 0xea,
122
123 // audio
124 MPEG1Audio = 0x03,
125 MPEG2Audio = 0x04,
126 MPEG2AACAudio = 0x0f,
127 MPEG2AudioAmd1 = 0x11,
128 AC3Audio = 0x81,
129 EAC3Audio = 0x87,
130 DTSAudio = 0x8a,
131
132 // DSM-CC Object Carousel
133 DSMCC = 0x08,
134 DSMCC_A = 0x0a,
135 DSMCC_B = 0x0b,
136 DSMCC_C = 0x0c,
137 DSMCC_D = 0x0d,
138 DSMCC_DL = 0x14,
139 MetaDataPES = 0x15,
140 MetaDataSec = 0x16,
141 MetaDataDC = 0x17,
142 MetaDataOC = 0x18,
143 MetaDataDL = 0x19,
144
145 // other
146 PrivSec = 0x05,
147 PrivData = 0x06,
148
149 MHEG = 0x07,
150 H222_1 = 0x09,
151
152 MPEG2Aux = 0x0e,
153
154 FlexMuxPES = 0x12,
155 FlexMuxSec = 0x13,
156
157 MPEG2IPMP = 0x1a,
158 MPEG2IPMP2 = 0x7f,
159
160 Splice = 0x86,
161
162 // special id's, not actually ID's but can be used in FindPIDs
163 AnyMask = 0xFFFF0000,
164 AnyVideo = 0xFFFF0001,
165 AnyAudio = 0xFFFF0002,
166 };
168 static bool IsVideo(uint type)
169 {
170 return ((StreamID::MPEG1Video == type) ||
177 }
179 static bool IsAudio(uint type)
180 {
181 return ((StreamID::MPEG1Audio == type) ||
188 }
191 {
192 return ((StreamID::DSMCC_A == type) ||
193 (StreamID::DSMCC_B == type) ||
194 (StreamID::DSMCC_C == type) ||
196 }
197 static uint Normalize(uint stream_id, const desc_list_t &desc,
198 const QString &sistandard);
199 static const char* toString(uint streamID);
200 static QString GetDescription(uint stream_id);
201};
202
206class PID
207{
208 public:
209 enum : std::uint16_t
210 {
211 MPEG_PAT_PID = 0x0000,
212 MPEG_CAT_PID = 0x0001,
214
215 DVB_NIT_PID = 0x0010,
216 DVB_SDT_PID = 0x0011,
217 DVB_EIT_PID = 0x0012,
218 DVB_RST_PID = 0x0013,
219 DVB_TDT_PID = 0x0014,
220
221 // Dishnet longterm EIT is on pid 0x300
223
224 // Bell longterm EIT is on pid 0x441
226
227 // MCA
228 MCA_EIT_PID = 0x03fa, // 1018
229
230 // Premiere EIT for Direkt/Sport PPV
233
234
236
238
239 // UK Freesat PIDs: SDTo/BAT, longterm EIT, shortterm EIT
241 FREESAT_EIT_PID = 0x0f02, // 3842
243
247
248 // OpenTV EIT PIDs
253 };
254};
255
260{
261 public:
262 enum : std::uint8_t
263 {
264 PAT = 0x00, // always on pid 0x00
265 CAT = 0x01, // always on pid 0x01
266 PMT = 0x02,
267 TSDT = 0x03, // always on pid 0x02
268
269 // DVB mandatory
270 NIT = 0x40, // always on pid 0x10
271 SDT = 0x42, // always on pid 0x11
272 PF_EIT = 0x4e, // always on pid 0x12
273 TDT = 0x70, // always on pid 0x14
274
275 // DVB optional
276 NITo = 0x41, // always on pid 0x10
277 SDTo = 0x46, // always on pid 0x11
278 BAT = 0x4a, // always on pid 0x11
279 PF_EITo = 0x4f, // always on pid 0x12
280 SC_EITbeg = 0x50, // always on pid 0x12
281 SC_EITend = 0x5f, // always on pid 0x12
282 SC_EITbego = 0x60, // always on pid 0x12
283 SC_EITendo = 0x6f, // always on pid 0x12
284 RST = 0x71, // always on pid 0x13
285 ST = 0x72, // any pid 0x10-0x14
286 TOT = 0x73, // always on pid 0x14
287 RNT = 0x74, // always on pid 0x16
288 CT = 0x75,
289 RCT = 0x76,
290 CIT = 0x77, // always on pid 0x12
291 MPEFEC = 0x78,
292 DIT = 0x7e, // always on pid 0x1e
293 SIT = 0x7f, // always on pid 0x1f
294
295 // DVB Conditional Access
296 DVBCAbeg = 0x80,
297 DVBCA_81 = 0x81,
298 DVBCA_82 = 0x82,
299 DVBCA_83 = 0x83,
300 DVBCA_84 = 0x84,
301 DVBCA_85 = 0x85,
302 DVBCA_86 = 0x86,
303 DVBCA_87 = 0x87,
304 DVBCA_88 = 0x88,
305 DVBCA_89 = 0x89,
306 DVBCA_8a = 0x8a,
307 DVBCA_8b = 0x8b,
308 DVBCA_8c = 0x8c,
309 DVBCA_8d = 0x8d,
310 DVBCA_8e = 0x8e,
311 DVBCAend = 0x8f,
312
313 // Dishnet Longterm EIT data
314 DN_EITbego = 0x80, // always on pid 0x300
315 DN_EITendo = 0xfe, // always on pid 0x300
316
317 // ARIB
318 ARIBbeg = 0x80,
319 ARIBend = 0x8f,
320
321 // SCTE 57 -- old depreciated standard
322 PIM = 0xC0, // Program Information Message (57 2003) PMT PID
323 PNM = 0xC1, // Program Name Message (57 2003) PMT PID
324 // The PIM and PNM do not have SCTE 65 equivalents.
325
326 // Under SCTE 57 -- NIM, NTM, VCM, and STM were carried on the
327 // network PID (Table ID 0x0) as defined in the PAT, but under
328 // SCTE 65 the equivalent tables are carried on 0x1FFC
329
330 NIM = 0xC2, // Network Information Message (57 2003)
331 NTM = 0xC3, // Network Text Message (57 2003)
332 // The NTM is like the SCTE 65 NTT table, except that it
333 // carries more subtable types and the id for the source name
334 // subtable they both share is type 5 rather than 6 which can
335 // cause calimity if not dealt with properly.
336 VCM = 0xC4, // Virtual Channel Message (57 2003)
337 STM = 0xC5, // System Time Message (57 2003)
338
339 // SCTE 65 -- Current US Cable TV standard
340 NITscte = 0xC2, // Network Information Table (NIT) (65 2002) on 0x1FFC
341 NTT = 0xC3, // Network Text Table (NTT) (65 2002) on 0x1FFC
342 SVCTscte = 0xC4, // Short Virtual Channel Table (65 2002) on 0x1FFC
343 STTscte = 0xC5, // System Time Table (STT) (65 2002) on 0x1FFC
344
345 // Other SCTE
346 SM = 0xC6, // subtitle_message (27 2003)
347 CEA = 0xD8, // Cable Emergency Alert (18 2002)
348 ADET = 0xD9, // Aggregate Data Event Table (80 2002)
349
350 // SCTE 35
351 SITscte = 0xFC, // SCTE 35 Splice Info Table (Cueing messages)
352
353 // ATSC Conditional Access (A/70)
354 // DVB Conditional Access (TS 100 289)
355 ECM0 = 0x80,
356 ECM1 = 0x81,
357 ECMbeg = 0x82, // ECM begin private data
358 ECMend = 0x8f, // ECM end private data
359
360 // ATSC main
361 MGT = 0xC7, // Master Guide Table A/65 on 0x1ffb
362 TVCT = 0xC8, // Terrestrial Virtual Channel Table A/65 on 0x1ffb
363 CVCT = 0xC9, // Cable Virtual Channel Table A/65 on 0x1ffb
364 RRT = 0xCA, // Region Rating Table A/65 on 0x1ffb
365 EIT = 0xCB, // Event Information Table A/65 (per MGT)
366 ETT = 0xCC, // Extended Text Table A/65 (per MGT)
367 STT = 0xCD, // System Time Table A/65
368 DET = 0xCE, // Data Event Table A/90 (per MGT)
369 DST = 0xCF, // Data Service Table A/90
370
371 PIT = 0xD0, // Program ID Table ???
372 NRT = 0xD1, // Network Resources Table A/90
373 LTST = 0xD2, // Long Term Service Table A/90
374 DCCT = 0xD3, // Directed Channel Change Table A/57 on 0x1ffb
375 DCCSCT = 0xD4, // DCC Selection Code Table A/57 on 0x1ffb
376 SITatsc = 0xD5, // Selection Information Table (EIA-775.2 2000)
377 AEIT = 0xD6, // Aggregate Event Information Table A/81, SCTE 65
378 AETT = 0xD7, // Aggregate Extended Text Table A/81, SCTE 65
379 SVCT = 0xDA, // Satellite VCT A/81
380
381 SRM = 0xE0, // System Renewability Message (ATSC TSG-717r0)
382
383 // Unknown
384 STUFFING = 0x80,
385 CAPTION = 0x86,
386 CENSOR = 0x87,
387
388 // Private premiere.de
389 PREMIERE_CIT = 0xA0,
390 PREMIERE_CPT = 0xA1,
391
392 ECN = 0xA0,
393 SRVLOC = 0xA1,
394 TSS = 0xA2,
395 CMPNAME = 0xA3,
396
397 // OpenTV
398 OTV_EIT_TITbeg = 0xA0, // always on pids config (0x30-0x37)
399 OTV_EIT_TITend = 0xA3, // always on pids config (0x30-0x37)
400 OTV_EIT_SUMbeg = 0xA8, // always on pids config (0x40-0x47)
401 OTV_EIT_SUMend = 0xAB, // always on pids config (0x40-0x47)
402 };
403};
404
410{
412 void InitPESPacket(TSPacket& tspacket);
413
414 protected:
415 // does not create it's own data
416 PSIPTable(const TSPacket& tspacket, bool /*unused*/)
417 {
418 m_pesData = nullptr;
419 m_fullBuffer = nullptr;
420 m_ccLast = tspacket.ContinuityCounter();
421 m_allocSize = 0;
422 InitPESPacket(const_cast<TSPacket&>(tspacket));
423 m_fullBuffer = const_cast<unsigned char*>(tspacket.data());
424 m_pesDataSize = TSPacket::kSize - (m_pesData - m_fullBuffer);
425 }
426
427 public:
428 // may be modified
429 PSIPTable(const TSPacket &tspacket,
430 const unsigned char *pesdata, uint pes_size)
431 { // clone
432 m_ccLast = tspacket.ContinuityCounter();
433 m_pesDataSize = pes_size;
434 InitPESPacket(const_cast<TSPacket&>(tspacket)); // sets m_psiOffset
435 int len = pes_size+4;
436 /* make alloc size multiple of 188 */
437 m_allocSize = ((len+m_psiOffset+187)/188)*188;
438 m_fullBuffer = pes_alloc(m_allocSize);
439 m_pesData = m_fullBuffer + m_psiOffset + 1;
440 memcpy(m_fullBuffer, tspacket.data(), 188);
441 memcpy(m_pesData, pesdata, pes_size-1);
442 }
443
444 public:
446 explicit PSIPTable(const unsigned char *pesdata)
447 : PESPacket(pesdata)
448 {
449 // fixup wrong assumption about length for sections without CRC
450 m_pesDataSize = SectionLength();
451 }
452 explicit PSIPTable(const std::vector<uint8_t> &pesdata)
453 : PESPacket(pesdata)
454 {
455 // fixup wrong assumption about length for sections without CRC
456 m_pesDataSize = SectionLength();
457 }
458 public:
459 PSIPTable(const PSIPTable&) = default;
460 // section_syntax_ind 1 1.0 8 should always be 1
461 // private_indicator 1 1.1 9 should always be 1
462 explicit PSIPTable(const PESPacket& table) : PESPacket(table)
463 {
464 // section_syntax_ind 1 1.0 8 should always be 1
465 // private_indicator 1 1.1 9 should always be 1
466 }
467 // may be modified
468 explicit PSIPTable(const TSPacket& table)
469 {
470 // section_syntax_ind 1 1.0 8 should always be 1
471 // private_indicator 1 1.1 9 should always be 1
472
473 m_ccLast = table.ContinuityCounter();
474 m_pesDataSize = 188;
475
476 // clone
477 InitPESPacket(const_cast<TSPacket&>(table)); // sets m_psiOffset
478
479 int len = (4*1024) - 256; /* ~4KB */
480 m_allocSize = len + m_psiOffset;
481 m_fullBuffer = pes_alloc(m_allocSize);
482 m_pesData = m_fullBuffer + m_psiOffset + 1;
483 memcpy(m_fullBuffer, table.data(), TSPacket::kSize);
484 }
485
486
487 static PSIPTable View(const TSPacket& tspacket)
488 { return {tspacket, false}; }
489
490 static PSIPTable ViewData(const unsigned char* pesdata)
491 { return PSIPTable(pesdata); }
492
493 // Section Bits Start Byte sbit
494 // -----------------------------------------
495 // table_id 8 0.0 0
496 uint TableID(void) const { return StreamID(); }
497
498 // section_syntax_ind 1 1.0 8 ATSC -- should always be 1
499 bool SectionSyntaxIndicator(void) const { return ( pesdata()[1] & 0x80 ) != 0; }
500 // private_indicator 1 1.1 9
501 bool PrivateIndicator(void) const { return ( pesdata()[1] & 0x40 ) != 0; }
502 // reserved 2 1.2 10
503
504 // section_length 12 1.4 12 always less than 0x3fd
505 // adds 3 to the total section length to account for 3 bytes
506 // before the end of the section length field.
507 uint SectionLength(void) const { return Length() + 3; }
509 { return ((pesdata()[1]<<8) | pesdata()[2]) & 0x0fff; }
510
512 // Things below this line may not apply to SCTE/DVB tables.
513
514 // table_id_extension 16 3.0 24 table dependent
516 { return (pesdata()[3]<<8) | pesdata()[4]; }
517
518 // reserved 2 5.0 40
519
520 // version_number 5 5.2 42
521 // incremented modulo 32 when table info changes
522 uint Version(void) const { return (pesdata()[5]>>1) & 0x1f; }
523
524 // current_next_ind 1 5.7 47
525 // if 0 this table is not yet valid, but will be the next psip
526 // table with the same sectionNumber(), tableIDExtension() and
527 // tableID() to become valid.
528 bool IsCurrent(void) const { return bool(pesdata()[5]&1); }
529
530 // section_number 8 6.0 48
531 uint Section(void) const { return pesdata()[6]; }
532
533 // last_section_number 8 7.0 56
534 uint LastSection(void) const { return pesdata()[7]; }
535
536 // Protocol Version for ATSC PSIP tables
537 // protocol_version 8 8.0 64 should always be 0 for now
538 uint ATSCProtocolVersion(void) const { return pesdata()[8]; }
539
540 // PSIP_table_data x 8.0 72 (incl. protocolVersion)
541 const unsigned char* psipdata(void) const
542 { return pesdata() + kPsipOffset; }
543 unsigned char* psipdata(void)
544 { return pesdata() + kPsipOffset; }
545
546 // sets
547 void SetTableID(uint id) { SetStreamID(id); }
548 // subtracts 3 from total section length to account for 3 bytes
549 // before the end of the section length field.
550 void SetSectionLength(uint length) { SetLength(length-3); }
552 {
553 pesdata()[3] = (len>>8) & 0xff;
554 pesdata()[4] = len & 0xff;
555 }
557 { pesdata()[5] = (pesdata()[5] & 0xc1) | ((ver & 0x1f)<<1); }
558 void SetCurrent(bool cur)
559 { pesdata()[5] = (pesdata()[5] & 0xfe) | (cur ? 1 : 0); }
560 void SetSection(uint num) { pesdata()[6] = num; }
561 void SetLastSection(uint num) { pesdata()[7] = num; }
562
563 // Only for real ATSC PSIP tables.
564 void SetATSCProtocolVersion(int ver) { pesdata()[8] = ver; }
565
566 bool HasCRC(void) const override; // PESPacket
567 bool HasSectionNumber(void) const;
568
569 bool VerifyPSIP(bool verify_crc) const;
570
571 virtual QString toString(void) const;
572 virtual QString toStringXML(uint indent_level) const;
573
574 static const uint kPsipOffset = 8; // general PSIP header offset
575
576 protected:
577 QString XMLValues(uint indent_level) const;
578};
579
599{
600 public:
602 : PSIPTable(table)
603 {
605 }
606
607 explicit ProgramAssociationTable(const PSIPTable &table) : PSIPTable(table)
608 {
610 }
611
612 // transport stream ID, program ID, count
613 static ProgramAssociationTable* Create(uint tsid, uint version,
614 const std::vector<uint>& pnum,
615 const std::vector<uint>& pid);
616
617 uint TransportStreamID(void) const { return TableIDExtension(); }
618
619 uint ProgramCount(void) const
620 {
621 if (SectionLength() > (kPsipOffset+2))
622 return (SectionLength()-kPsipOffset-2)>>2;
623 return 0;
624 }
625
627 { return (psipdata()[(i<<2)] << 8) | psipdata()[(i<<2) + 1]; }
628
630 {
631 return (((psipdata()[(i<<2) + 2] & 0x1f) << 8) |
632 psipdata()[(i<<2) + 3]);
633 }
634
635 void SetTranportStreamID(uint gtsid) { SetTableIDExtension(gtsid); }
636
637 // helper function
638 uint FindPID(uint progNum) const
639 {
640 for (uint i = 0; i < ProgramCount(); i++)
641 if (progNum==ProgramNumber(i))
642 return ProgramPID(i);
643 return 0;
644 }
645 uint FindAnyPID(void) const
646 {
647 for (uint i = 0; i < ProgramCount(); i++)
648 if (0!=ProgramNumber(i))
649 return ProgramPID(i);
650 return 0;
651 }
653 {
654 for (uint i = 0; i < ProgramCount(); i++)
655 if (pid==ProgramPID(i))
656 return ProgramNumber(i);
657 return 0;
658 }
659
660 QString toString(void) const override; // PSIPTable
661 QString toStringXML(uint indent_level) const override; // PSIPTable
662
663 private:
664 static ProgramAssociationTable* CreateBlank(bool smallPacket = true);
665
666 // for testing if CreateBlank create a table with invalid CRC
667 friend class TestMPEGTables;
668};
669
676{
677 public:
678
680 {
682 Parse();
683 }
684
685 explicit ProgramMapTable(const PSIPTable& table) : PSIPTable(table)
686 {
688 Parse();
689 }
690
691 static ProgramMapTable ViewData(const unsigned char* pesdata)
692 {
693 /* needed to call Parse() */
694 return ProgramMapTable(PSIPTable::ViewData(pesdata));
695 }
696
697 static ProgramMapTable* Create(uint programNumber, uint basepid,
698 uint pcrpid, uint version,
699 std::vector<uint> pids, std::vector<uint> types);
700
701 static ProgramMapTable* Create(uint programNumber, uint basepid,
702 uint pcrpid, uint version,
703 const desc_list_t &global_desc,
704 const std::vector<uint> &pids,
705 const std::vector<uint> &types,
706 const std::vector<desc_list_t> &prog_desc);
707
709 uint PCRPID(void) const
710 { return ((psipdata()[0] << 8) | psipdata()[1]) & 0x1fff; }
711
712 uint ProgramNumber(void) const
713 { return TableIDExtension(); }
714
716 { return ((psipdata()[2]<<8) | psipdata()[3]) & 0x0fff; }
717
718 const unsigned char* ProgramInfo(void) const
719 { return psipdata() + 4; }
720
722 { return m_ptrs[i][0]; }
723
725 { return ((m_ptrs[i][1] << 8) | m_ptrs[i][2]) & 0x1fff; }
726
728 { return ((m_ptrs[i][3] << 8) | m_ptrs[i][4]) & 0x0fff; }
729
730 const unsigned char* StreamInfo(uint i) const
731 { return m_ptrs[i] + 5; }
732
733 uint StreamCount(void) const
734 { return (!m_ptrs.empty()) ? m_ptrs.size()-1 : 0; }
735
736 // sets
737 void SetPCRPID(uint pid)
738 {
739 psipdata()[0] = ((pid >> 8) & 0x1F) | (psipdata()[0] & 0xE0);
740 psipdata()[1] = (pid & 0xFF);
741 }
742
743 void SetProgramNumber(uint num) { SetTableIDExtension(num); }
744
745 void SetStreamPID(uint i, uint pid)
746 {
747 m_ptrs[i][1] = ((pid>>8) & 0x1f) | (m_ptrs[i][1] & 0xe0);
748 m_ptrs[i][2] = pid & 0xff;
749 }
750
752 { m_ptrs[i][0] = type; }
753
754 // helper methods
755 bool IsVideo(uint i, const QString& sistandard) const;
756 bool IsAudio(uint i, const QString& sistandard) const;
757 bool IsEncrypted(const QString& sistandard) const;
758 bool IsProgramEncrypted(void) const;
759 bool IsStreamEncrypted(uint pid) const;
761 bool IsStillPicture(const QString& sistandard) const;
763 QString StreamTypeString(uint i) const
764 { return StreamID::toString(StreamType(i)); }
767 QString StreamDescription(uint i, const QString& sistandard) const;
769 QString GetLanguage(uint i) const;
771 uint GetAudioType(uint i) const;
772
773 uint FindPIDs(uint type, std::vector<uint> &pids,
774 const QString &sistandard) const;
775 uint FindPIDs(uint type, std::vector<uint> &pids, std::vector<uint> &types,
776 const QString &sistandard, bool normalize) const;
777
780 int FindPID(uint pid) const
781 {
782 for (uint i = 0; i < StreamCount(); i++)
783 if (pid == StreamPID(i))
784 return i;
785 return -1;
786 }
787 uint FindUnusedPID(uint desired_pid = 0x20) const;
788
790 {
791 memset(psipdata(), 0xff, kPmtHeaderMinOffset);
792 SetProgramInfoLength(0);
793 m_ptrs.clear();
794 }
795 void AppendStream(uint pid, uint type, unsigned char* streamInfo = nullptr, uint infoLength = 0);
796
797 void Parse(void) const;
798 QString toString(void) const override; // PSIPTable
799 QString toStringXML(uint indent_level) const override; // PSIPTable
800 // unsafe sets
801 private:
803 {
804 m_ptrs[i][3] = ((length>>8) & 0x0f) | (m_ptrs[i][3] & 0xf0);
805 m_ptrs[i][4] = length & 0xff;
806 }
807
808 void SetStreamProgramInfo(uint i, unsigned char* streamInfo,
809 uint infoLength)
810 {
811 SetStreamInfoLength(i, infoLength);
812 if ((streamInfo != nullptr) && (infoLength > 0))
813 memcpy(m_ptrs[i] + 5, streamInfo, infoLength);
814 }
815
817 {
818 psipdata()[2] = ((length>>8) & 0x0f) | (psipdata()[2] & 0xf0);
819 psipdata()[3] = length & 0xff;
820 }
821
822 void SetProgramInfo(unsigned char *streamInfo, uint infoLength)
823 {
824 SetProgramInfoLength(infoLength);
825 memcpy(psipdata() + 4, streamInfo, infoLength);
826 }
827
828 static ProgramMapTable* CreateBlank(bool smallPacket = true);
829
830 static const uint kPmtHeaderMinOffset = 4; // minimum PMT header offset
831 mutable std::vector<unsigned char*> m_ptrs; // used to parse
832};
833
839{
840 public:
841 explicit ConditionalAccessTable(const PSIPTable &table) : PSIPTable(table)
842 {
843 // Section Bits Start Byte sbit
844 // -----------------------------------------
845 // table_id 8 0.0 0
847 // section_syntax_ind 1 1.0 8 should always be 1
848 // private_indicator 1 1.1 9 should always be 0
849 // reserved 2 1.2 10
850 // section_length 12 1.4 12 always less than 0x3fd
851 // table_id_extension 16 3.0 24 unused
852 // reserved 2 5.0 40
853 // version_number 5 5.2 42
854 // current_next_ind 1 5.3 47
855 // section_numben 8 6.0 48
856 // last_section_number 8 7.0 56
857 }
858
859 // for (i = 0; i < N; i++) 8.0 64
860 // { descriptor() }
862 { return SectionLength() - kPsipOffset; }
863 const unsigned char *Descriptors(void) const { return psipdata(); }
864
865 QString toString(void) const override; // PSIPTable
866 QString toStringXML(uint indent_level) const override; // PSIPTable
867
868 // CRC_32 32 rpchof
869};
870
872{
873 public:
874 explicit SpliceTimeView(const unsigned char *data) : m_data(data) { }
875 // time_specified_flag 1 0.0
876 bool IsTimeSpecified(void) const { return ( m_data[0] & 0x80 ) != 0; }
877 // if (time_specified_flag == 1)
878 // reserved 6 0.1
879 // pts_time 33 0.6
880 uint64_t PTSTime(void) const
881 {
882 return ((uint64_t(m_data[0] & 0x1) << 32) |
883 (uint64_t(m_data[1]) << 24) |
884 (uint64_t(m_data[2]) << 16) |
885 (uint64_t(m_data[3]) << 8) |
886 (uint64_t(m_data[4])));
887 }
888 // else
889 // reserved 7 0.1
890 // }
891 virtual QString toString(int64_t first, int64_t last) const;
892 virtual QString toStringXML(
893 uint indent_level, int64_t first, int64_t last) const;
894
895 uint size(void) const { return IsTimeSpecified() ? 1 : 5; }
896 private:
897 const unsigned char *m_data;
898};
899
901{
902 public:
903 SpliceScheduleView(std::vector<const unsigned char*> ptrs0,
904 std::vector<const unsigned char*> ptrs1) :
905 m_ptrs0(std::move(ptrs0)), m_ptrs1(std::move(ptrs1))
906 {
907 }
908 // splice_count 8 14.0
909 uint SpliceCount(void) const { return std::min(m_ptrs0.size(), m_ptrs1.size()); }
910
911 // splice_event_id 32 0.0 + m_ptrs0[i]
913 {
914 return ((m_ptrs0[i][0] << 24) | (m_ptrs0[i][1] << 16) |
915 (m_ptrs0[i][2] << 8) | (m_ptrs0[i][3]));
916 }
917 // splice_event_cancel_indicator 1 4.0 + m_ptrs0[i]
918 // reserved 7 4.1 + m_ptrs0[i]
919 // if (splice_event_cancel_indicator == ‘0’) {
920 // out_of_network_indicator 1 5.0 + m_ptrs0[i]
921 // program_splice_flag 1 5.1 + m_ptrs0[i]
922 // duration_flag 1 5.2 + m_ptrs0[i]
923 // reserved 5 5.3 + m_ptrs0[i]
924 // if (program_splice_flag == ‘1’)
925 // utc_splice_time 32 6.0 + m_ptrs0[i]
926 // else {
927 // component_count 8 6.0 + m_ptrs0[i]
928 // for(j = 0; j < component_count; j++) {
929 // component_tag 8 7.0 + m_ptrs0[i]+j*5
930 // utc_splice_time 32 8.0 + m_ptrs0[i]+j*5
931 // }
932 // }
933 // if (duration_flag) {
934 // auto_return 1 0.0 + m_ptrs1[i]
935 // reserved 6 0.1 + m_ptrs1[i]
936 // duration 33 0.7 + m_ptrs1[i]
937 // }
938 // unique_program_id 16 0.0 + m_ptrs1[i] + (duration_flag)?5:0
939 // avail_num 8 2.0 + m_ptrs1[i] + (duration_flag)?5:0
940 // avails_expected 8 3.0 + m_ptrs1[i] + (duration_flag)?5:0
941 // }
942
943 private:
944 std::vector<const unsigned char*> m_ptrs0;
945 std::vector<const unsigned char*> m_ptrs1;
946};
947
949{
950 public:
951 SpliceInsertView(std::vector<const unsigned char*> ptrs0,
952 std::vector<const unsigned char*> ptrs1) :
953 m_ptrs0(std::move(ptrs0)), m_ptrs1(std::move(ptrs1))
954 {
955 }
956
957 // splice_event_id 32 0.0 + m_ptrs1[0]
958 uint SpliceEventID(void) const
959 {
960 return ((m_ptrs1[0][0] << 24) | (m_ptrs1[0][1] << 16) |
961 (m_ptrs1[0][2] << 8) | (m_ptrs1[0][3]));
962 }
963 // splice_event_cancel 1 4.0 + m_ptrs1[0]
964 bool IsSpliceEventCancel(void) const { return ( m_ptrs1[0][4] & 0x80 ) != 0; }
965 // reserved 7 4.1 + m_ptrs1[0]
966 // if (splice_event_cancel_indicator == 0) {
967 // out_of_network_flag 1 5.0 + m_ptrs1[0]
968 bool IsOutOfNetwork(void) const { return ( m_ptrs1[0][5] & 0x80 ) != 0; }
969 // program_splice_flag 1 5.1 + m_ptrs1[0]
970 bool IsProgramSplice(void) const { return ( m_ptrs1[0][5] & 0x40 ) != 0; }
971 // duration_flag 1 5.2 + m_ptrs1[0]
972 bool IsDuration(void) const { return ( m_ptrs1[0][5] & 0x20 ) != 0; }
973 // splice_immediate_flag 1 5.3 + m_ptrs1[0]
974 bool IsSpliceImmediate(void) const { return ( m_ptrs1[0][5] & 0x20 ) != 0; }
975 // reserved 4 5.4 + m_ptrs1[0]
976 // if ((program_splice_flag == 1) && (splice_immediate_flag == ‘0’))
977 // splice_time() 8-38 6.0 + m_ptrs1[0]
979 { return SpliceTimeView(m_ptrs1[0]+6); }
980 // if (program_splice_flag == 0) {
981 // component_count 8 6.0 + m_ptrs1[0]
982 // for (i = 0; i < component_count; i++) {
983 // component_tag 8 0.0 + m_ptrs0[i]
984 // if (splice_immediate_flag == ‘0’)
985 // splice_time() 8-38 1.0 + m_ptrs0[i]
986 // }
987 // }
988 // if (duration_flag == ‘1’)
989 // auto_return 1 0.0 + m_ptrs1[1]
990 // reserved 6 0.1 + m_ptrs1[1]
991 // duration 33 0.7 + m_ptrs1[1]
992 // unique_program_id 16 0.0 + m_ptrs1[2]
994 { return (m_ptrs1[2][0]<<8) | m_ptrs1[2][1]; }
995 // avail_num 8 2.0 + m_ptrs1[2]
996 uint AvailNum(void) const { return m_ptrs1[2][2]; }
997 // avails_expected 8 3.0 + m_ptrs1[2]
998 uint AvailsExpected(void) const { return m_ptrs1[2][3]; }
999 // }
1000
1001 virtual QString toString(int64_t first, int64_t last) const;
1002 virtual QString toStringXML(
1003 uint indent_level, int64_t first, int64_t last) const;
1004
1005 private:
1006 std::vector<const unsigned char*> m_ptrs0;
1007 std::vector<const unsigned char*> m_ptrs1;
1008};
1009
1011{
1012 public:
1014 PSIPTable(table)
1015 {
1017 Parse();
1018 }
1019 explicit SpliceInformationTable(const PSIPTable &table) :
1020 PSIPTable(table)
1021 {
1023 Parse();
1024 }
1026
1027 void setSCTEPID(int ts_pid){m_sctePid = ts_pid;}
1028 int getSCTEPID(void) const {return m_sctePid;}
1029
1030 // ANCE/SCTE 35 2007
1031 // Name bits loc expected value
1032 // table_id 8 0.0 0xFC
1033 // section_syntax_indicator 1 1.0 1
1034 // private_indicator 1 1.1 0
1035 // reserved 2 1.2 3
1036 // section_length 12 1.4
1037 // ^^^ All above this line provided by PSIPTable
1038 // protocol_version 8 3.0 0
1039 uint SpliceProtocolVersion(void) const { return pesdata()[3]; }
1040 void SetSpliceProtocolVersion(uint ver) { pesdata()[3] = ver; }
1041 // encrypted_packet 1 4.0
1042 bool IsEncryptedPacket(void) const { return ( pesdata()[4] & 0x80 ) != 0; }
1043 void SetEncryptedPacket(bool val)
1044 {
1045 pesdata()[4] = (pesdata()[4] & ~0x80) | ((val) ? 0x80 : 0);
1046 }
1047 // encryption_algorithm 6 4.1
1048 enum : std::uint8_t
1049 {
1050 kNoEncryption = 0,
1051 kECB = 1, // DES - ECB mode, FIPS PUB 81 (8 byte blocks)
1052 kCBC = 2, // DES - CBC mode, FIPS PUB 81 (8 byte blocks)
1053 k3DES = 3, // 3 DES - TDEA, FIPS PUB 46-3 (8 byte blocks)
1054 // values 4-31 are reserved for future extension
1055 // values 32-63 are user private
1056 };
1057 uint EncryptionAlgorithm(void) const { return (pesdata()[4] >> 1) & 0x3f; }
1058 QString EncryptionAlgorithmString(void) const;
1060 {
1061 pesdata()[4] &= 0x81;
1062 pesdata()[4] |= ((val&0x3f) << 1);
1063 }
1064 // pts_adjustment 33 4.7
1065 uint64_t PTSAdjustment(void) const
1066 {
1067 return ((uint64_t(pesdata()[4] & 0x1) << 32) |
1068 (uint64_t(pesdata()[5]) << 24) |
1069 (uint64_t(pesdata()[6]) << 16) |
1070 (uint64_t(pesdata()[7]) << 8) |
1071 (uint64_t(pesdata()[8])));
1072 }
1073 void SetPTSAdjustment(uint64_t val)
1074 {
1075 pesdata()[4] &= ~0x1;
1076 pesdata()[4] |= (val>>32) & 0x1;
1077 pesdata()[5] = ((val>>24) & 0xff);
1078 pesdata()[6] = ((val>>16) & 0xff);
1079 pesdata()[7] = ((val>>8 ) & 0xff);
1080 pesdata()[8] = ((val ) & 0xff);
1081 }
1082 // cw_index (enc key) 8 9.0
1083 uint CodeWordIndex(void) const { return pesdata()[9]; }
1084 void SetCodeWordIndex(uint val) { pesdata()[9] = val; }
1085 // reserved 12 10.0
1086 // splice_command_length 12 11.4
1088 {
1089 return ((pesdata()[11] & 0xf) << 8) | pesdata()[12];
1090 }
1092 {
1093 pesdata()[11] &= ~0xf;
1094 pesdata()[11] |= (len >> 8) & 0xf;
1095 pesdata()[12] = len & 0xff;
1096 }
1097 // splice_command_type 8 13.0
1098 enum : std::uint8_t {
1099 kSCTNull = 0x00,
1100 kSCTReserved0 = 0x01,
1101 kSCTReserved1 = 0x02,
1102 kSCTReserved2 = 0x03,
1103 kSCTSpliceSchedule = 0x04,
1104 kSCTSpliceInsert = 0x05,
1105 kSCTTimeSignal = 0x06,
1106 kSCTBandwidthReservation = 0x07,
1107 // 0x08-0xfe reserved
1108 kSCTPrivateCommand = 0xff,
1109 };
1110 uint SpliceCommandType(void) const { return pesdata()[13]; }
1111 QString SpliceCommandTypeString(void) const;
1112 void SetSpliceCommandType(uint type) { pesdata()[13] = type & 0xff; }
1113
1114 // ALL BELOW THIS LINE OTHER THAN CRC_32 ARE ENCRYPTED IF FLAG SET
1115
1117
1118 // nothing here, info in descriptors
1119
1121
1122 // if (splice_command_type == 0x04) splice_schedule()
1124 { return {m_ptrs0, m_ptrs1}; }
1125
1127
1128 // if (splice_command_type == 0x05) splice_insert()
1130 { return {m_ptrs0, m_ptrs1}; }
1131
1133
1134 // if (splice_command_type == 0x06) splice_time()
1136 { return SpliceTimeView(pesdata()+14); }
1137
1139
1140 // nothing here, info in descriptors
1141
1143
1144 // if (splice_command_type == 0xff) private_command()
1145 // identifier 32 14.0
1146 // for (i = 0; i < N; i++)
1147 // private_byte 8 ??.0
1148 //
1149
1151 // NOTE: Aside from CRC's we can not interpret things below
1152 // this comment with private or reserved commands.
1153
1154 // descriptor_loop_length 16 0.0 + m_epilog
1156 {
1157 return (m_epilog[0] << 8) | m_epilog[1];
1158 }
1159
1160 // for (i = 0; i < ? ; i++)
1161 // splice_descriptor() ?? ??.?
1162 const unsigned char *SpliceDescriptors(void) const
1163 {
1164 return (m_epilog) ? m_epilog + 2 : nullptr;
1165 }
1166 // for (i = 0; i < ?; i++)
1167 // alignment_stuffing 8 ??.0
1168 // if (encrypted_packet())
1169 // E_CRC_32 32 ??.0
1170 // CRC_32 32 ??.0
1171
1172 static SpliceInformationTable *GetDecrypted(const QString &codeWord);
1173 bool Parse(void);
1174
1175 QString toString(void) const override // PSIPTable
1176 { return toString(-1LL, -1LL); }
1177 QString toStringXML(uint indent_level) const override // PSIPTable
1178 { return toStringXML(indent_level, -1LL, -1LL); }
1179
1180 QString toString(int64_t first, int64_t last) const;
1181 QString toStringXML(uint indent_level, int64_t first, int64_t last) const;
1182
1183 private:
1184 std::vector<const unsigned char*> m_ptrs0;
1185 std::vector<const unsigned char*> m_ptrs1;
1186 const unsigned char *m_epilog {nullptr};
1187 int m_sctePid {0};
1188};
1189
1200{
1201 public:
1202 explicit AdaptationFieldControl(const unsigned char* packet) : m_data(packet) { ; }
1203
1207 uint Length(void) const { return m_data[0]; }
1208
1212 bool Discontinuity(void) const { return ( m_data[1] & 0x80 ) != 0; }
1213 // random_access_indicator (?) 1 1.1
1214 bool RandomAccess(void) const { return ( m_data[1] & 0x40 ) != 0; }
1215 // elementary_stream_priority_indicator 1 1.2
1216 bool Priority(void) const { return ( m_data[1] & 0x20 ) != 0; }
1217
1218// Each of the following extends the adaptation header. In order:
1219
1223 bool PCR(void) const { return ( m_data[1] & 0x10 ) != 0; }
1227 bool OPCR(void) const { return ( m_data[1] & 0x08 ) != 0; }
1235 bool SplicingPoint(void) const { return ( m_data[1] & 0x04 ) != 0; }
1236 // transport_private_data_flag 1 1.6
1237 // (adds 1 byte)
1238 bool PrivateTransportData(void) const { return ( m_data[1] & 0x02 ) != 0; }
1239 // adaptation_field_extension_flag 1 1.7
1240 bool FieldExtension(void) const { return ( m_data[1] & 0x01 ) != 0; }
1241 // extension length 8 2.0
1242 uint ExtensionLength(void) const { return m_data[2]; }
1243 // ltw flag 1 3.0
1244 // (adds 2 bytes)
1245 bool LTW(void) const { return ( m_data[3] & 0x80 ) != 0; }
1246 // piecewise_rate_flag (adds 3 bytes) 1 3.1
1247 bool PiecewiseRate(void) const { return ( m_data[3] & 0x40 ) != 0; }
1248 // seamless_splice_flag (adds 5 bytes) 1 3.2
1249 bool SeamlessSplice(void) const { return ( m_data[3] & 0x20 ) != 0; }
1250 // unused flags 5 3.3
1251
1252 private:
1253 const unsigned char* m_data;
1254};
1255
1256#endif // MPEG_TABLES_H
#define assert(x)
@ RST
AdaptationFieldControl is used to transmit various important stream attributes.
Definition: mpegtables.h:1200
bool PCR(void) const
PCR flag (we have PCR data) 1 1.3 (adds 6 bytes after adaptation header)
Definition: mpegtables.h:1223
bool Priority(void) const
Definition: mpegtables.h:1216
bool LTW(void) const
Definition: mpegtables.h:1245
bool RandomAccess(void) const
Definition: mpegtables.h:1214
bool PiecewiseRate(void) const
Definition: mpegtables.h:1247
bool PrivateTransportData(void) const
Definition: mpegtables.h:1238
uint ExtensionLength(void) const
Definition: mpegtables.h:1242
bool FieldExtension(void) const
Definition: mpegtables.h:1240
uint Length(void) const
adaptation header length (after which is payload data) 8 0.0
Definition: mpegtables.h:1207
bool OPCR(void) const
OPCR flag (we have OPCR data) 1 1.4 (adds 6 bytes) ((Original) Program Clock Reference; used to time ...
Definition: mpegtables.h:1227
bool Discontinuity(void) const
discontinuity_indicator (time base may change) 1 1.0
Definition: mpegtables.h:1212
AdaptationFieldControl(const unsigned char *packet)
Definition: mpegtables.h:1202
const unsigned char * m_data
Definition: mpegtables.h:1253
bool SeamlessSplice(void) const
Definition: mpegtables.h:1249
bool SplicingPoint(void) const
splicing_point_flag 1 1.5 (adds 1 byte) (we have splice point data) Splice data is packets until a go...
Definition: mpegtables.h:1235
The CAT is used to transmit additional ConditionalAccessDescriptor instances, in addition to the ones...
Definition: mpegtables.h:839
uint DescriptorsLength(void) const
Definition: mpegtables.h:861
const unsigned char * Descriptors(void) const
Definition: mpegtables.h:863
ConditionalAccessTable(const PSIPTable &table)
Definition: mpegtables.h:841
Definition: freemheg.h:61
Allows us to transform TS packets to PES packets, which are used to hold multimedia streams and very ...
Definition: pespacket.h:26
Contains a listing of PES Stream ID's for various PES Packet types.
Definition: mpegtables.h:45
Contains Packet Identifier numeric values.
Definition: mpegtables.h:207
@ OTV_EIT_SUP_PID_END
Definition: mpegtables.h:252
@ DVB_DNLONG_EIT_PID
Definition: mpegtables.h:222
@ OTV_EIT_SUP_PID_START
Definition: mpegtables.h:251
@ DVB_EIT_PID
Definition: mpegtables.h:217
@ SCTE_PSIP_PID
Definition: mpegtables.h:237
@ MPEG_TSDT_PID
Definition: mpegtables.h:213
@ PREMIERE_EIT_DIREKT_PID
Definition: mpegtables.h:231
@ MPEG_NULL_PID
The all-ones PID value 0x1FFF indicates a Null TS Packet introduced to maintain a constant bit rate o...
Definition: mpegtables.h:246
@ MCA_EIT_PID
Definition: mpegtables.h:228
@ DVB_TDT_PID
Definition: mpegtables.h:219
@ OTV_EIT_TIT_PID_END
Definition: mpegtables.h:250
@ DVB_BVLONG_EIT_PID
Definition: mpegtables.h:225
@ OTV_EIT_TIT_PID_START
Definition: mpegtables.h:249
@ MPEG_PAT_PID
Definition: mpegtables.h:211
@ MPEG_CAT_PID
Definition: mpegtables.h:212
@ DVB_SDT_PID
Definition: mpegtables.h:216
@ ATSC_PSIP_PID
Definition: mpegtables.h:235
@ PREMIERE_EIT_SPORT_PID
Definition: mpegtables.h:232
@ DVB_NIT_PID
Definition: mpegtables.h:215
@ FREESAT_EIT_PID
Definition: mpegtables.h:241
@ DVB_RST_PID
Definition: mpegtables.h:218
@ FREESAT_ST_EIT_PID
Definition: mpegtables.h:242
@ FREESAT_SI_PID
Definition: mpegtables.h:240
A PSIP table is a variant of a PES packet containing an MPEG, ATSC or DVB table.
Definition: mpegtables.h:410
uint LastSection(void) const
Definition: mpegtables.h:534
uint Version(void) const
Definition: mpegtables.h:522
void SetATSCProtocolVersion(int ver)
Definition: mpegtables.h:564
static PSIPTable View(const TSPacket &tspacket)
Definition: mpegtables.h:487
uint ATSCProtocolVersion(void) const
Definition: mpegtables.h:538
void SetTableIDExtension(uint len)
Definition: mpegtables.h:551
void SetSectionLength(uint length)
Definition: mpegtables.h:550
void SetCurrent(bool cur)
Definition: mpegtables.h:558
bool SectionSyntaxIndicator(void) const
Definition: mpegtables.h:499
void SetTableID(uint id)
Definition: mpegtables.h:547
void SetSection(uint num)
Definition: mpegtables.h:560
void SetLastSection(uint num)
Definition: mpegtables.h:561
const unsigned char * psipdata(void) const
Definition: mpegtables.h:541
unsigned char * psipdata(void)
Definition: mpegtables.h:543
bool IsCurrent(void) const
Definition: mpegtables.h:528
PSIPTable(const std::vector< uint8_t > &pesdata)
Definition: mpegtables.h:452
static PSIPTable ViewData(const unsigned char *pesdata)
Definition: mpegtables.h:490
PSIPTable(const unsigned char *pesdata)
Constructor for viewing a section, does not create it's own data.
Definition: mpegtables.h:446
uint TableID(void) const
Definition: mpegtables.h:496
PSIPTable(const TSPacket &tspacket, bool)
Definition: mpegtables.h:416
uint Section(void) const
Definition: mpegtables.h:531
bool PrivateIndicator(void) const
Definition: mpegtables.h:501
PSIPTable(const PSIPTable &)=default
uint TableIDExtension(void) const
Definition: mpegtables.h:515
uint SectionLengthRaw(void) const
Definition: mpegtables.h:508
uint SectionLength(void) const
Definition: mpegtables.h:507
PSIPTable(const TSPacket &tspacket, const unsigned char *pesdata, uint pes_size)
Definition: mpegtables.h:429
PSIPTable(const TSPacket &table)
Definition: mpegtables.h:468
void SetVersionNumber(uint ver)
Definition: mpegtables.h:556
PSIPTable(const PESPacket &table)
Definition: mpegtables.h:462
The Program Association Table lists all the programs in a stream, and is always found on PID 0.
Definition: mpegtables.h:599
void SetTranportStreamID(uint gtsid)
Definition: mpegtables.h:635
uint FindAnyPID(void) const
Definition: mpegtables.h:645
uint FindProgram(uint pid) const
Definition: mpegtables.h:652
ProgramAssociationTable(const PSIPTable &table)
Definition: mpegtables.h:607
uint ProgramCount(void) const
Definition: mpegtables.h:619
uint TransportStreamID(void) const
Definition: mpegtables.h:617
uint FindPID(uint progNum) const
Definition: mpegtables.h:638
ProgramAssociationTable(const ProgramAssociationTable &table)
Definition: mpegtables.h:601
uint ProgramNumber(uint i) const
Definition: mpegtables.h:626
uint ProgramPID(uint i) const
Definition: mpegtables.h:629
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
Definition: mpegtables.h:676
void SetPCRPID(uint pid)
Definition: mpegtables.h:737
void RemoveAllStreams(void)
Definition: mpegtables.h:789
void SetStreamPID(uint i, uint pid)
Definition: mpegtables.h:745
uint StreamCount(void) const
Definition: mpegtables.h:733
void SetStreamType(uint i, uint type)
Definition: mpegtables.h:751
uint PCRPID(void) const
stream that contains program clock reference.
Definition: mpegtables.h:709
uint StreamPID(uint i) const
Definition: mpegtables.h:724
void SetStreamProgramInfo(uint i, unsigned char *streamInfo, uint infoLength)
Definition: mpegtables.h:808
std::vector< unsigned char * > m_ptrs
Definition: mpegtables.h:831
void SetProgramNumber(uint num)
Definition: mpegtables.h:743
uint StreamType(uint i) const
Definition: mpegtables.h:721
int FindPID(uint pid) const
Locates stream index of pid.
Definition: mpegtables.h:780
void SetProgramInfoLength(uint length)
Definition: mpegtables.h:816
const unsigned char * ProgramInfo(void) const
Definition: mpegtables.h:718
const unsigned char * StreamInfo(uint i) const
Definition: mpegtables.h:730
ProgramMapTable(const PSIPTable &table)
Definition: mpegtables.h:685
uint ProgramNumber(void) const
Definition: mpegtables.h:712
QString StreamTypeString(uint i) const
Returns a string representation of type at stream index i.
Definition: mpegtables.h:763
uint ProgramInfoLength(void) const
Definition: mpegtables.h:715
uint StreamInfoLength(uint i) const
Definition: mpegtables.h:727
void SetStreamInfoLength(uint i, uint length)
Definition: mpegtables.h:802
static ProgramMapTable ViewData(const unsigned char *pesdata)
Definition: mpegtables.h:691
ProgramMapTable(const ProgramMapTable &table)
Definition: mpegtables.h:679
void SetProgramInfo(unsigned char *streamInfo, uint infoLength)
Definition: mpegtables.h:822
uint SpliceCommandType(void) const
Definition: mpegtables.h:1110
std::vector< const unsigned char * > m_ptrs1
Definition: mpegtables.h:1185
SpliceInformationTable(const SpliceInformationTable &table)
Definition: mpegtables.h:1013
SpliceInformationTable(const PSIPTable &table)
Definition: mpegtables.h:1019
uint64_t PTSAdjustment(void) const
Definition: mpegtables.h:1065
void SetSpliceProtocolVersion(uint ver)
Definition: mpegtables.h:1040
uint SpliceCommandLength(void) const
Definition: mpegtables.h:1087
SpliceScheduleView SpliceSchedule(void) const
Definition: mpegtables.h:1123
void SetSpliceCommandLength(uint len)
Definition: mpegtables.h:1091
std::vector< const unsigned char * > m_ptrs0
Definition: mpegtables.h:1184
uint SpliceDescriptorsLength(uint) const
Definition: mpegtables.h:1155
void SetPTSAdjustment(uint64_t val)
Definition: mpegtables.h:1073
uint EncryptionAlgorithm(void) const
Definition: mpegtables.h:1057
uint SpliceProtocolVersion(void) const
Definition: mpegtables.h:1039
void SetSpliceCommandType(uint type)
Definition: mpegtables.h:1112
void SetEncryptedPacket(bool val)
Definition: mpegtables.h:1043
SpliceTimeView TimeSignal(void) const
Definition: mpegtables.h:1135
QString toString(void) const override
Definition: mpegtables.h:1175
int getSCTEPID(void) const
Definition: mpegtables.h:1028
void SetEncryptionAlgorithm(uint val)
Definition: mpegtables.h:1059
~SpliceInformationTable() override
Definition: mpegtables.h:1025
QString toStringXML(uint indent_level) const override
Definition: mpegtables.h:1177
uint CodeWordIndex(void) const
Definition: mpegtables.h:1083
void SetCodeWordIndex(uint val)
Definition: mpegtables.h:1084
void setSCTEPID(int ts_pid)
Definition: mpegtables.h:1027
bool IsEncryptedPacket(void) const
Definition: mpegtables.h:1042
SpliceInsertView SpliceInsert(void) const
Definition: mpegtables.h:1129
const unsigned char * SpliceDescriptors(void) const
Definition: mpegtables.h:1162
SpliceTimeView SpliceTime(void) const
Definition: mpegtables.h:978
bool IsSpliceImmediate(void) const
Definition: mpegtables.h:974
bool IsSpliceEventCancel(void) const
Definition: mpegtables.h:964
std::vector< const unsigned char * > m_ptrs1
Definition: mpegtables.h:1007
SpliceInsertView(std::vector< const unsigned char * > ptrs0, std::vector< const unsigned char * > ptrs1)
Definition: mpegtables.h:951
bool IsProgramSplice(void) const
Definition: mpegtables.h:970
uint AvailsExpected(void) const
Definition: mpegtables.h:998
std::vector< const unsigned char * > m_ptrs0
Definition: mpegtables.h:1006
uint SpliceEventID(void) const
Definition: mpegtables.h:958
bool IsOutOfNetwork(void) const
Definition: mpegtables.h:968
bool IsDuration(void) const
Definition: mpegtables.h:972
uint UniqueProgramID(void) const
Definition: mpegtables.h:993
uint AvailNum(void) const
Definition: mpegtables.h:996
SpliceScheduleView(std::vector< const unsigned char * > ptrs0, std::vector< const unsigned char * > ptrs1)
Definition: mpegtables.h:903
std::vector< const unsigned char * > m_ptrs1
Definition: mpegtables.h:945
std::vector< const unsigned char * > m_ptrs0
Definition: mpegtables.h:944
uint SpliceCount(void) const
Definition: mpegtables.h:909
uint SpliceEventID(uint i) const
Definition: mpegtables.h:912
const unsigned char * m_data
Definition: mpegtables.h:897
bool IsTimeSpecified(void) const
Definition: mpegtables.h:876
uint64_t PTSTime(void) const
Definition: mpegtables.h:880
SpliceTimeView(const unsigned char *data)
Definition: mpegtables.h:874
uint size(void) const
Definition: mpegtables.h:895
Contains listing of PMT Stream ID's for various A/V Stream types.
Definition: mpegtables.h:110
@ MPEG2Video
ISO 13818-2 & ITU H.262 (aka MPEG-2)
Definition: mpegtables.h:116
@ EAC3Audio
A/53 Part 3:2009 6.7.3.
Definition: mpegtables.h:129
@ DSMCC_D
ISO 13818-6 type D Any DSMCC Data.
Definition: mpegtables.h:137
@ DSMCC_A
ISO 13818-6 type A Multi-protocol Encap.
Definition: mpegtables.h:134
@ DSMCC_B
ISO 13818-6 type B Std DSMCC Data.
Definition: mpegtables.h:135
@ MPEG2AACAudio
ISO 13818-7 Audio w/ADTS syntax.
Definition: mpegtables.h:126
@ AC3Audio
A/53 Part 3:2009 6.7.1.
Definition: mpegtables.h:128
@ DSMCC_C
ISO 13818-6 type C NPT DSMCC Data.
Definition: mpegtables.h:136
@ H265Video
ISO 23008-2 & ITU H.265 (aka HEVC, Ultra HD)
Definition: mpegtables.h:119
@ MPEG2Audio
ISO 13818-3.
Definition: mpegtables.h:125
@ VC1Video
SMPTE 421M video codec (aka VC1) in Blu-Ray.
Definition: mpegtables.h:121
@ MPEG4Video
ISO 14492-2 (aka MPEG-4)
Definition: mpegtables.h:117
@ MPEG2AudioAmd1
ISO 13818-3/AMD-1 Audio using LATM syntax.
Definition: mpegtables.h:127
@ MPEG1Audio
ISO 11172-3.
Definition: mpegtables.h:124
@ MPEG1Video
ISO 11172-2 (aka MPEG-1)
Definition: mpegtables.h:115
@ OpenCableVideo
Always MPEG-2??
Definition: mpegtables.h:120
@ H264Video
ISO 14492-10 & ITU H.264 (aka MPEG-4-AVC)
Definition: mpegtables.h:118
static const char * toString(uint streamID)
Definition: mpegtables.cpp:989
static bool IsObjectCarousel(uint type)
Returns true iff stream contains DSMCC Object Carousel.
Definition: mpegtables.h:190
static bool IsAudio(uint type)
Returns true iff audio is MPEG1/2, AAC, AC3 or DTS audio stream.
Definition: mpegtables.h:179
static bool IsVideo(uint type)
Returns true iff video is an MPEG1/2/3, H264 or open cable video stream.
Definition: mpegtables.h:168
unsigned int ContinuityCounter(void) const
Definition: tspacket.h:109
const unsigned char * data(void) const
Definition: tspacket.h:174
Used to access the data of a Transport Stream packet.
Definition: tspacket.h:208
static constexpr unsigned int kSize
Definition: tspacket.h:261
Contains listing of Table ID's for various tables (PAT=0,PMT=2,etc).
Definition: mpegtables.h:260
static uint8_t * SetLength(uint8_t *Data, int Length)
Definition: dvbci.cpp:117
unsigned int uint
Definition: freesurround.h:24
static const struct wl_interface * types[]
unsigned short uint16_t
Definition: iso6937tables.h:3
std::vector< const unsigned char * > desc_list_t
static constexpr uint8_t GPS_LEAP_SECONDS
Leap seconds as of June 30th, 2022.
Definition: mpegtables.h:34
static constexpr qint64 GPS_EPOCH
Seconds between start of GPS time and the start of UNIX time.
Definition: mpegtables.h:31
#define MTV_PUBLIC
Definition: mythtvexp.h:15
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:93
string version
Definition: giantbomb.py:185
STL namespace.
unsigned char * pes_alloc(uint size)
Definition: pespacket.cpp:368
bool
Definition: pxsup2dast.c:31