MythTV  master
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ProgramMapTable Class Reference

A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe the multimedia contents of the program. More...

#include <libmythtv/mpeg/mpegtables.h>

Inheritance diagram for ProgramMapTable:
[legend]
Collaboration diagram for ProgramMapTable:
[legend]

Public Member Functions

 ProgramMapTable (const ProgramMapTable &table)
 
 ProgramMapTable (const PSIPTable &table)
 
uint PCRPID (void) const
 stream that contains program clock reference. More...
 
uint ProgramNumber (void) const
 
uint ProgramInfoLength (void) const
 
const unsigned char * ProgramInfo (void) const
 
uint StreamType (uint i) const
 
uint StreamPID (uint i) const
 
uint StreamInfoLength (uint i) const
 
const unsigned char * StreamInfo (uint i) const
 
uint StreamCount (void) const
 
void SetPCRPID (uint pid)
 
void SetProgramNumber (uint num)
 
void SetStreamPID (uint i, uint pid)
 
void SetStreamType (uint i, uint type)
 
bool IsVideo (uint i, const QString &sistandard) const
 Returns true iff the stream at index i is a video stream. More...
 
bool IsAudio (uint i, const QString &sistandard) const
 Returns true iff the stream at index i is an audio stream. More...
 
bool IsEncrypted (const QString &sistandard) const
 Returns true iff PMT contains CA descriptor for a vid/aud stream. More...
 
bool IsProgramEncrypted (void) const
 Returns true iff PMT's ProgramInfo contains CA descriptor. More...
 
bool IsStreamEncrypted (uint pid) const
 Returns true iff PMT contains CA descriptor. More...
 
bool IsStillPicture (const QString &sistandard) const
 Returns true iff PMT contains a still-picture video stream. More...
 
QString StreamTypeString (uint i) const
 Returns a string representation of type at stream index i. More...
 
QString StreamDescription (uint i, const QString &sistandard) const
 Returns a better (and more expensive) string representation of type at stream index i than StreamTypeString(uint) More...
 
QString GetLanguage (uint i) const
 Returns the canonical language if we find the iso639 descriptor. More...
 
uint GetAudioType (uint i) const
 Returns the audio type from the iso 639 descriptor. More...
 
uint FindPIDs (uint type, std::vector< uint > &pids, const QString &sistandard) const
 Finds all pids matching type. More...
 
uint FindPIDs (uint type, std::vector< uint > &pids, std::vector< uint > &types, const QString &sistandard, bool normalize) const
 Finds all pids w/types, matching type (useful for AnyVideo/AnyAudio). More...
 
int FindPID (uint pid) const
 Locates stream index of pid. More...
 
uint FindUnusedPID (uint desired_pid=0x20) const
 
void RemoveAllStreams (void)
 
void AppendStream (uint pid, uint type, unsigned char *streamInfo=nullptr, uint infoLength=0)
 
void Parse (void) const
 
QString toString (void) const override
 
QString toStringXML (uint indent_level) const override
 
- Public Member Functions inherited from PSIPTable
 PSIPTable (const TSPacket &tspacket, const unsigned char *pesdata, uint pes_size)
 
 PSIPTable (const unsigned char *pesdata)
 Constructor for viewing a section, does not create it's own data. More...
 
 PSIPTable (const std::vector< uint8_t > &pesdata)
 
 PSIPTable (const PSIPTable &)=default
 
 PSIPTable (const PESPacket &table)
 
 PSIPTable (const TSPacket &table)
 
uint TableID (void) const
 
bool SectionSyntaxIndicator (void) const
 
bool PrivateIndicator (void) const
 
uint SectionLength (void) const
 
uint SectionLengthRaw (void) const
 
uint TableIDExtension (void) const
 
uint Version (void) const
 
bool IsCurrent (void) const
 
uint Section (void) const
 
uint LastSection (void) const
 
uint ATSCProtocolVersion (void) const
 
const unsigned char * psipdata (void) const
 
unsigned char * psipdata (void)
 
void SetTableID (uint id)
 
void SetSectionLength (uint length)
 
void SetTableIDExtension (uint len)
 
void SetVersionNumber (uint ver)
 
void SetCurrent (bool cur)
 
void SetSection (uint num)
 
void SetLastSection (uint num)
 
void SetATSCProtocolVersion (int ver)
 
bool HasCRC (void) const override
 1 bit Cyclic Redundancy Check present More...
 
bool HasSectionNumber (void) const
 
bool VerifyPSIP (bool verify_crc) const
 
- Public Member Functions inherited from PESPacket
 PESPacket (const unsigned char *pesdata)
 
 PESPacket (const std::vector< uint8_t > &pesdata)
 
PESPacketoperator= (const PESPacket &pkt)=delete
 
 PESPacket (const PESPacket &pkt)
 
virtual ~PESPacket ()
 
bool IsClone () const
 
bool AddTSPacket (const TSPacket *tspacket, int cardid, bool &broken)
 
bool IsGood () const
 
const TSHeadertsheader () const
 
TSHeadertsheader ()
 
void GetAsTSPackets (std::vector< TSPacket > &output, uint cc) const
 Returns payload only PESPacket as series of TSPackets. More...
 
uint StreamID () const
 
uint Length () const
 
uint ScramblingControl () const
 
bool HighPriority () const
 1 bit Indicates if this is a high priority packet More...
 
bool DataAligned () const
 1 bit Data alignment indicator (must be 0 for video) More...
 
bool CopyRight () const
 1 bit If true packet may contain copy righted material and is known to have once contained materiale with copy rights. More...
 
bool OriginalRecording () const
 1 bit Original Recording More...
 
bool HasPTS () const
 1 bit Presentation Time Stamp field is present More...
 
bool HasDTS () const
 1 bit Decoding Time Stamp field is present More...
 
bool HasESCR () const
 1 bit Elementary Stream Clock Reference field is present More...
 
bool HasESR () const
 1 bit Elementary Stream Rate field is present More...
 
bool HasDSM () const
 1 bit DSM field present (should always be false for broadcasts) More...
 
bool HasACI () const
 1 bit Additional Copy Info field is present More...
 
bool HasExtensionFlags () const
 1 bit Extension flags are present More...
 
uint64_t PTS (void) const
 Presentation Time Stamp, present if HasPTS() is true. More...
 
uint64_t DTS (void) const
 Decode Time Stamp, present if HasDTS() is true. More...
 
uint TSSizeInBuffer () const
 
uint PSIOffset () const
 
const unsigned char * pesdata () const
 
unsigned char * pesdata ()
 
const unsigned char * data () const
 
unsigned char * data ()
 
void SetStreamID (uint id)
 
void SetLength (uint len)
 
void SetTotalLength (uint len)
 
void SetPSIOffset (uint offset)
 
uint CRC (void) const
 
void SetCRC (uint crc)
 
uint CalcCRC (void) const
 
bool VerifyCRC (void) const
 
bool VerifyCRC (int cardid, int pid) const
 

Static Public Member Functions

static ProgramMapTable ViewData (const unsigned char *pesdata)
 
static ProgramMapTableCreate (uint programNumber, uint basepid, uint pcrpid, uint version, std::vector< uint > pids, std::vector< uint > types)
 
static ProgramMapTableCreate (uint programNumber, uint basepid, uint pcrpid, uint version, const desc_list_t &global_desc, const std::vector< uint > &pids, const std::vector< uint > &types, const std::vector< desc_list_t > &prog_desc)
 
- Static Public Member Functions inherited from PSIPTable
static PSIPTable View (const TSPacket &tspacket)
 
static PSIPTable ViewData (const unsigned char *pesdata)
 

Private Member Functions

void SetStreamInfoLength (uint i, uint length)
 
void SetStreamProgramInfo (uint i, unsigned char *streamInfo, uint infoLength)
 
void SetProgramInfoLength (uint length)
 
void SetProgramInfo (unsigned char *streamInfo, uint infoLength)
 

Static Private Member Functions

static ProgramMapTableCreateBlank (bool smallPacket=true)
 

Private Attributes

std::vector< unsigned char * > m_ptrs
 

Static Private Attributes

static const uint kPmtHeaderMinOffset = 4
 

Additional Inherited Members

- Static Public Attributes inherited from PSIPTable
static const uint kPsipOffset = 8
 
- Static Public Attributes inherited from PESPacket
static constexpr uint kMpegCRCSize { 4 }
 
- Protected Member Functions inherited from PSIPTable
 PSIPTable (const TSPacket &tspacket, bool)
 
QString XMLValues (uint indent_level) const
 
- Protected Member Functions inherited from PESPacket
 PESPacket ()=default
 noop constructor, only for use by derived classes More...
 
void Finalize ()
 
- Protected Attributes inherited from PESPacket
unsigned char * m_pesData { nullptr }
 Pointer to PES data in full buffer. More...
 
unsigned char * m_fullBuffer { nullptr }
 Pointer to allocated data. More...
 
uint m_psiOffset { 0 }
 AFCOffset + StartOfFieldPointer. More...
 
uint m_ccLast { 255 }
 Continuity counter of last inserted TS Packet. More...
 
uint m_pesDataSize { 0 }
 Number of data bytes (TS header + PES data) More...
 
uint m_allocSize { 0 }
 Total number of bytes we allocated. More...
 
bool m_badPacket { false }
 true if a CRC is not good yet More...
 
- Static Protected Attributes inherited from PESPacket
static const uint kTheMagicNoCRCCRC = 0xFFFFFFFF
 

Detailed Description

A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe the multimedia contents of the program.

Definition at line 694 of file mpegtables.h.

Constructor & Destructor Documentation

◆ ProgramMapTable() [1/2]

ProgramMapTable::ProgramMapTable ( const ProgramMapTable table)
inline

Definition at line 698 of file mpegtables.h.

Referenced by CreateBlank().

◆ ProgramMapTable() [2/2]

ProgramMapTable::ProgramMapTable ( const PSIPTable table)
inlineexplicit

Definition at line 704 of file mpegtables.h.

Member Function Documentation

◆ ViewData()

static ProgramMapTable ProgramMapTable::ViewData ( const unsigned char *  pesdata)
inlinestatic

Definition at line 710 of file mpegtables.h.

◆ Create() [1/2]

ProgramMapTable * ProgramMapTable::Create ( uint  programNumber,
uint  basepid,
uint  pcrpid,
uint  version,
std::vector< uint pids,
std::vector< uint types 
)
static

◆ Create() [2/2]

ProgramMapTable * ProgramMapTable::Create ( uint  programNumber,
uint  basepid,
uint  pcrpid,
uint  version,
const desc_list_t global_desc,
const std::vector< uint > &  pids,
const std::vector< uint > &  types,
const std::vector< desc_list_t > &  prog_desc 
)
static

Definition at line 426 of file mpegtables.cpp.

◆ PCRPID()

uint ProgramMapTable::PCRPID ( void  ) const
inline

stream that contains program clock reference.

Definition at line 728 of file mpegtables.h.

Referenced by MPEGStreamData::CreatePMTSingleProgram(), DTVRecorder::HandleSingleProgramPMT(), MPEGStreamData::ProcessTSPacket(), toString(), and toStringXML().

◆ ProgramNumber()

uint ProgramMapTable::ProgramNumber ( void  ) const
inline

◆ ProgramInfoLength()

uint ProgramMapTable::ProgramInfoLength ( void  ) const
inline

◆ ProgramInfo()

const unsigned char* ProgramMapTable::ProgramInfo ( void  ) const
inline

◆ StreamType()

uint ProgramMapTable::StreamType ( uint  i) const
inline

◆ StreamPID()

uint ProgramMapTable::StreamPID ( uint  i) const
inline

◆ StreamInfoLength()

uint ProgramMapTable::StreamInfoLength ( uint  i) const
inline

◆ StreamInfo()

const unsigned char* ProgramMapTable::StreamInfo ( uint  i) const
inline

◆ StreamCount()

uint ProgramMapTable::StreamCount ( void  ) const
inline

◆ SetPCRPID()

void ProgramMapTable::SetPCRPID ( uint  pid)
inline

Definition at line 756 of file mpegtables.h.

Referenced by Create().

◆ SetProgramNumber()

void ProgramMapTable::SetProgramNumber ( uint  num)
inline

Definition at line 762 of file mpegtables.h.

Referenced by Create().

◆ SetStreamPID()

void ProgramMapTable::SetStreamPID ( uint  i,
uint  pid 
)
inline

Definition at line 764 of file mpegtables.h.

Referenced by AppendStream().

◆ SetStreamType()

void ProgramMapTable::SetStreamType ( uint  i,
uint  type 
)
inline

Definition at line 770 of file mpegtables.h.

Referenced by AppendStream().

◆ IsVideo()

bool ProgramMapTable::IsVideo ( uint  i,
const QString &  sistandard 
) const

Returns true iff the stream at index i is a video stream.

This of course returns true if StreamID::IsVideo() is true. And, it also returns true if IsVideo returns true after StreamID::Normalize() is used on the stream type.

Parameters
iindex of stream
sistandardstandard to use in determining if this is a A/V stream

Definition at line 513 of file mpegtables.cpp.

Referenced by FindPIDs(), DTVRecorder::HandlePMT(), DTVSignalMonitor::HandlePMT(), AvFormatDecoder::HasVideo(), IsEncrypted(), IsStillPicture(), and AvFormatDecoder::ScanATSCCaptionStreams().

◆ IsAudio()

bool ProgramMapTable::IsAudio ( uint  i,
const QString &  sistandard 
) const

Returns true iff the stream at index i is an audio stream.

This of course returns true if StreamID::IsAudio() is true. And, it also returns true if IsAudio returns true after StreamID::Normalize() is used on the stream type.

Parameters
iindex of stream
sistandardstandard to use in determining if this is a A/V stream

Definition at line 535 of file mpegtables.cpp.

Referenced by FindPIDs(), DTVRecorder::HandlePMT(), DTVSignalMonitor::HandlePMT(), and IsEncrypted().

◆ IsEncrypted()

bool ProgramMapTable::IsEncrypted ( const QString &  sistandard) const

Returns true iff PMT contains CA descriptor for a vid/aud stream.

Parameters
sistandardstandard to use in determining if this is a A/V stream

Definition at line 551 of file mpegtables.cpp.

Referenced by DTVSignalMonitor::HandlePMT(), ChannelScanSM::HandlePMT(), and DVBRecorder::SetCAMPMT().

◆ IsProgramEncrypted()

bool ProgramMapTable::IsProgramEncrypted ( void  ) const

Returns true iff PMT's ProgramInfo contains CA descriptor.

Definition at line 567 of file mpegtables.cpp.

Referenced by IsEncrypted(), and MPEGStreamData::TestDecryption().

◆ IsStreamEncrypted()

bool ProgramMapTable::IsStreamEncrypted ( uint  i) const

Returns true iff PMT contains CA descriptor.

Parameters
iindex of stream

Definition at line 595 of file mpegtables.cpp.

Referenced by IsEncrypted(), and MPEGStreamData::TestDecryption().

◆ IsStillPicture()

bool ProgramMapTable::IsStillPicture ( const QString &  sistandard) const

Returns true iff PMT contains a still-picture video stream.

Definition at line 617 of file mpegtables.cpp.

◆ StreamTypeString()

QString ProgramMapTable::StreamTypeString ( uint  i) const
inline

Returns a string representation of type at stream index i.

Definition at line 782 of file mpegtables.h.

Referenced by toString(), and toStringXML().

◆ StreamDescription()

QString ProgramMapTable::StreamDescription ( uint  i,
const QString &  sistandard 
) const

Returns a better (and more expensive) string representation of type at stream index i than StreamTypeString(uint)

Definition at line 1161 of file mpegtables.cpp.

Referenced by CreateCAPMT().

◆ GetLanguage()

QString ProgramMapTable::GetLanguage ( uint  i) const

Returns the canonical language if we find the iso639 descriptor.

Definition at line 1122 of file mpegtables.cpp.

Referenced by StreamDescription().

◆ GetAudioType()

uint ProgramMapTable::GetAudioType ( uint  i) const

Returns the audio type from the iso 639 descriptor.

Definition at line 1138 of file mpegtables.cpp.

◆ FindPIDs() [1/2]

uint ProgramMapTable::FindPIDs ( uint  type,
std::vector< uint > &  pids,
const QString &  sistandard 
) const

Finds all pids matching type.

Parameters
typeStreamType to match
pidsvector pids will be added to
sistandardstandard to use in determining if this is a A/V stream
Returns
number of pids in list

Definition at line 642 of file mpegtables.cpp.

◆ FindPIDs() [2/2]

uint ProgramMapTable::FindPIDs ( uint  type,
std::vector< uint > &  pids,
std::vector< uint > &  types,
const QString &  sistandard,
bool  normalize 
) const

Finds all pids w/types, matching type (useful for AnyVideo/AnyAudio).

Parameters
typeStreamType to match
pidsvector pids will be added to
typesvector types will be added to
sistandardstandard to use in determining if this is a A/V stream
normalizeif set types will be normalized
Returns
number of items in pids and types lists.

Definition at line 678 of file mpegtables.cpp.

◆ FindPID()

int ProgramMapTable::FindPID ( uint  pid) const
inline

Locates stream index of pid.

Returns
stream index if successful, -1 otherwise

Definition at line 799 of file mpegtables.h.

Referenced by MPEGStreamData::CreatePMTSingleProgram(), FindPIDs(), FindUnusedPID(), and DTVRecorder::HandleSingleProgramPMT().

◆ FindUnusedPID()

uint ProgramMapTable::FindUnusedPID ( uint  desired_pid = 0x20) const

Definition at line 737 of file mpegtables.cpp.

◆ RemoveAllStreams()

void ProgramMapTable::RemoveAllStreams ( void  )
inline

Definition at line 808 of file mpegtables.h.

Referenced by Create().

◆ AppendStream()

void ProgramMapTable::AppendStream ( uint  pid,
uint  type,
unsigned char *  streamInfo = nullptr,
uint  infoLength = 0 
)

Definition at line 489 of file mpegtables.cpp.

Referenced by Create().

◆ Parse()

void ProgramMapTable::Parse ( void  ) const

Definition at line 468 of file mpegtables.cpp.

Referenced by MPEGStreamData::CreatePMTSingleProgram().

◆ toString()

QString ProgramMapTable::toString ( void  ) const
overridevirtual

Reimplemented from PSIPTable.

Definition at line 880 of file mpegtables.cpp.

Referenced by Create(), MPEGStreamData::CreatePMTSingleProgram(), ChannelScanSM::HandlePMT(), and Parse().

◆ toStringXML()

QString ProgramMapTable::toStringXML ( uint  indent_level) const
overridevirtual

Reimplemented from PSIPTable.

Definition at line 915 of file mpegtables.cpp.

◆ SetStreamInfoLength()

void ProgramMapTable::SetStreamInfoLength ( uint  i,
uint  length 
)
inlineprivate

Definition at line 821 of file mpegtables.h.

◆ SetStreamProgramInfo()

void ProgramMapTable::SetStreamProgramInfo ( uint  i,
unsigned char *  streamInfo,
uint  infoLength 
)
inlineprivate

Definition at line 827 of file mpegtables.h.

Referenced by AppendStream().

◆ SetProgramInfoLength()

void ProgramMapTable::SetProgramInfoLength ( uint  length)
inlineprivate

Definition at line 835 of file mpegtables.h.

◆ SetProgramInfo()

void ProgramMapTable::SetProgramInfo ( unsigned char *  streamInfo,
uint  infoLength 
)
inlineprivate

Definition at line 841 of file mpegtables.h.

Referenced by Create().

◆ CreateBlank()

ProgramMapTable * ProgramMapTable::CreateBlank ( bool  smallPacket = true)
staticprivate

Definition at line 381 of file mpegtables.cpp.

Referenced by Create().

Member Data Documentation

◆ kPmtHeaderMinOffset

const uint ProgramMapTable::kPmtHeaderMinOffset = 4
staticprivate

Definition at line 849 of file mpegtables.h.

Referenced by AppendStream(), and Parse().

◆ m_ptrs

std::vector<unsigned char*> ProgramMapTable::m_ptrs
mutableprivate

Definition at line 850 of file mpegtables.h.

Referenced by AppendStream(), and Parse().


The documentation for this class was generated from the following files: