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")
42  str.append(QString(" adaptationFieldControl: %1\n")
44  str.append(QString(" continuityCounter: %1\n")
46  return str;
47 }
TSHeader::PayloadStart
bool PayloadStart(void) const
Definition: tspacket.h:70
TSHeader::Priority
bool Priority(void) const
Definition: tspacket.h:72
TSHeader::ScramblingControl
unsigned int ScramblingControl(void) const
Definition: tspacket.h:78
TSHeader::PID
unsigned int PID(void) const
Definition: tspacket.h:74
arg
arg(title).arg(filename).arg(doDelete))
TSHeader::kPayloadOnlyHeader
static const TSHeaderArray kPayloadOnlyHeader
Definition: tspacket.h:159
SYNC_BYTE
#define SYNC_BYTE
Definition: tspacket.h:16
TSHeader::ContinuityCounter
unsigned int ContinuityCounter(void) const
Definition: tspacket.h:90
TSPacket
Used to access the data of a Transport Stream packet.
Definition: tspacket.h:170
tspacket.h
TSPacket::toString
QString toString(void) const
Definition: tspacket.cpp:28
TSHeader::AdaptationFieldControl
unsigned int AdaptationFieldControl(void) const
Definition: tspacket.h:84
TSPacket::kNullPacket
static const TSPacket * kNullPacket
Definition: tspacket.h:228
TSHeaderArray
std::array< uint8_t, 4 > TSHeaderArray
Definition: tspacket.h:18
NULL_PACKET_BYTES
const std::array< unsigned char, 188 > NULL_PACKET_BYTES
Definition: tspacket.cpp:15
TSHeader::HasSync
bool HasSync(void) const
Definition: tspacket.h:64
TSHeader::data
const unsigned char * data(void) const
Definition: tspacket.h:155
TSHeader::TransportError
bool TransportError(void) const
Definition: tspacket.h:67