MythTV  master
tspacket.cpp
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 // Copyright (c) 2003-2004, Daniel Thor Kristjansson
3 #include <cstdint> // for intptr_t
4 #include "tspacket.h"
5 
6 const unsigned int TSHeader::kHeaderSize = 4;
7 
8 const unsigned int TSPacket::kSize = 188;
9 const unsigned int TSPacket::kPayloadSize = 188-4;
10 
11 const unsigned int TSPacket::kDVBEmissionSize = 204;
12 const unsigned int TSPacket::kISDBEmissionSize = 204;
13 const unsigned int TSPacket::k8VSBEmissionSize = 208;
14 
15 const unsigned char TSHeader::kPayloadOnlyHeader[4] =
16 {
17  SYNC_BYTE,
18  0x40, // payload start
19  0x0,
20  0x10, // adaptation field control == payload only
21 };
22 
23 const unsigned char NULL_PACKET_BYTES[188] =
24 {
25  SYNC_BYTE, 0x1F, 0xFF, 0x00,
26  0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 36
27  0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 68
28  0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 100
29  0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 132
30  0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 164
31  0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 188
32 };
33 
35  reinterpret_cast<const TSPacket*>(NULL_PACKET_BYTES);
36 
37 QString TSPacket::toString() const
38 {
39  QString str;
40  str.append(QString("TSPacket @0x%1 ").arg((intptr_t)(&data()[0]),0,16));
41  str.append(QString("raw: 0x%1 0x%2 0x%3 0x%4\n")
42  .arg(int(data()[0]),0,16).arg(int(data()[1]),0,16)
43  .arg(int(data()[2]),0,16).arg(int(data()[3]),0,16));
44  str.append(QString(" inSync: %1\n").arg(static_cast<int>(HasSync())));
45  str.append(QString(" transportError: %1\n").arg(static_cast<int>(TransportError())));
46  str.append(QString(" payloadStart: %1\n").arg(static_cast<int>(PayloadStart())));
47  str.append(QString(" priority: %1\n").arg(static_cast<int>(Priority())));
48  str.append(QString(" pid: %1\n").arg(PID()));
49  str.append(QString(" scrambled (if>1): %1\n")
50  .arg(ScramblingControl()));
51  str.append(QString(" adaptationFieldControl: %1\n")
52  .arg(AdaptationFieldControl()));
53  str.append(QString(" continuityCounter: %1\n")
54  .arg(ContinuityCounter()));
55  return str;
56 }
Used to access the data of a Transport Stream packet.
Definition: tspacket.h:166
static const unsigned int kHeaderSize
Definition: tspacket.h:155
bool Priority(void) const
Definition: tspacket.h:69
#define SYNC_BYTE
Definition: tspacket.h:15
unsigned int ContinuityCounter(void) const
Definition: tspacket.h:87
static const unsigned int kPayloadSize
Definition: tspacket.h:221
bool PayloadStart(void) const
Definition: tspacket.h:67
bool HasSync(void) const
Definition: tspacket.h:61
unsigned int AdaptationFieldControl(void) const
Definition: tspacket.h:81
const unsigned char * data(void) const
Definition: tspacket.h:152
unsigned int ScramblingControl(void) const
Definition: tspacket.h:75
bool TransportError(void) const
Definition: tspacket.h:64
static const TSPacket * kNullPacket
Definition: tspacket.h:225
static const unsigned int kSize
Definition: tspacket.h:220
const unsigned char NULL_PACKET_BYTES[188]
Definition: tspacket.cpp:23
unsigned int PID(void) const
Definition: tspacket.h:71
QString toString(void) const
Definition: tspacket.cpp:37
static const unsigned int k8VSBEmissionSize
Definition: tspacket.h:224
static const unsigned int kDVBEmissionSize
Definition: tspacket.h:222
static const unsigned int kISDBEmissionSize
Definition: tspacket.h:223
static const unsigned char kPayloadOnlyHeader[4]
Definition: tspacket.h:156