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 
7 {
8  SYNC_BYTE,
9  0x40, // payload start
10  0x0,
11  0x10, // adaptation field control == payload only
12 };
13 
14 const std::array<unsigned char,188> NULL_PACKET_BYTES
15 {
16  SYNC_BYTE, 0x1F, 0xFF, 0x00,
17  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
18  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
19  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
20  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
21  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
22  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
23 };
24 
26  reinterpret_cast<const TSPacket*>(NULL_PACKET_BYTES.data());
27 
28 QString TSPacket::toString() const
29 {
30  QString str;
31  str.append(QString("TSPacket @0x%1 ").arg((intptr_t)(&data()[0]),0,16));
32  str.append(QString("raw: 0x%1 0x%2 0x%3 0x%4\n")
33  .arg(int(data()[0]),0,16).arg(int(data()[1]),0,16)
34  .arg(int(data()[2]),0,16).arg(int(data()[3]),0,16));
35  str.append(QString(" inSync: %1\n").arg(static_cast<int>(HasSync())));
36  str.append(QString(" transportError: %1\n").arg(static_cast<int>(TransportError())));
37  str.append(QString(" payloadStart: %1\n").arg(static_cast<int>(PayloadStart())));
38  str.append(QString(" priority: %1\n").arg(static_cast<int>(Priority())));
39  str.append(QString(" pid: %1\n").arg(PID()));
40  str.append(QString(" scrambled (if>1): %1\n")
41  .arg(ScramblingControl()));
42  str.append(QString(" adaptationFieldControl: %1\n")
43  .arg(AdaptationFieldControl()));
44  str.append(QString(" continuityCounter: %1\n")
45  .arg(ContinuityCounter()));
46  return str;
47 }
TSHeader::PayloadStart
bool PayloadStart(void) const
Definition: tspacket.h:87
TSHeader::Priority
bool Priority(void) const
Definition: tspacket.h:89
TSHeader::ScramblingControl
unsigned int ScramblingControl(void) const
Definition: tspacket.h:95
TSHeader::PID
unsigned int PID(void) const
Definition: tspacket.h:91
TSHeader::kPayloadOnlyHeader
static const TSHeaderArray kPayloadOnlyHeader
Definition: tspacket.h:176
TSHeader::ContinuityCounter
unsigned int ContinuityCounter(void) const
Definition: tspacket.h:107
TSPacket
Used to access the data of a Transport Stream packet.
Definition: tspacket.h:205
tspacket.h
TSPacket::toString
QString toString(void) const
Definition: tspacket.cpp:28
TSHeader::AdaptationFieldControl
unsigned int AdaptationFieldControl(void) const
Definition: tspacket.h:101
TSPacket::kNullPacket
static const TSPacket * kNullPacket
Definition: tspacket.h:264
TSHeaderArray
std::array< uint8_t, 4 > TSHeaderArray
Definition: tspacket.h:21
NULL_PACKET_BYTES
const std::array< unsigned char, 188 > NULL_PACKET_BYTES
Definition: tspacket.cpp:15
SYNC_BYTE
static constexpr uint8_t SYNC_BYTE
Definition: tspacket.h:19
TSHeader::HasSync
bool HasSync(void) const
Definition: tspacket.h:81
TSHeader::data
const unsigned char * data(void) const
Definition: tspacket.h:172
TSHeader::TransportError
bool TransportError(void) const
Definition: tspacket.h:84