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{
9 0x40, // payload start
10 0x0,
11 0x10, // adaptation field control == payload only
12};
13
14const 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
28QString 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")
44 str.append(QString(" continuityCounter: %1\n")
45 .arg(ContinuityCounter()));
46 return str;
47}
unsigned int ContinuityCounter(void) const
Definition: tspacket.h:109
unsigned int ScramblingControl(void) const
Definition: tspacket.h:97
unsigned int PID(void) const
Definition: tspacket.h:93
bool PayloadStart(void) const
Definition: tspacket.h:89
unsigned int AdaptationFieldControl(void) const
Definition: tspacket.h:103
bool TransportError(void) const
Definition: tspacket.h:86
bool HasSync(void) const
Definition: tspacket.h:83
static const TSHeaderArray kPayloadOnlyHeader
Definition: tspacket.h:178
bool Priority(void) const
Definition: tspacket.h:91
const unsigned char * data(void) const
Definition: tspacket.h:174
Used to access the data of a Transport Stream packet.
Definition: tspacket.h:208
QString toString(void) const
Definition: tspacket.cpp:28
static const TSPacket * kNullPacket
Definition: tspacket.h:266
const std::array< unsigned char, 188 > NULL_PACKET_BYTES
Definition: tspacket.cpp:15
std::array< uint8_t, 4 > TSHeaderArray
Definition: tspacket.h:23
static constexpr uint8_t SYNC_BYTE
Definition: tspacket.h:21