This module contains elements for handling ISO/IEC 13818-1 Transport Streams.
Module Name | Streamer Transport Stream Elements |
---|---|
File Name | libtselements.so |
Class Count | 14 |
TS Socket Relay Element, TS Catalog Element, TS Continuity Counter Element, TS Program Selector Element, TS Program Clock Reference Element, TS Video Stream Info Decoder Element, TS Audio Stream Info Decoder Element, TS Subtitle Stream Info Decoder Element, TS Demuxer Element, TS Video Selector Element, TS Audio Selector Element, TS Subtitle Selector Element, TS PES Filter Element, TS DSM-CC Element.
Typical Transport Stream pipeline.
The audio elementary stream must be aligned to segment boundaries as described in the Framing Element section.
The TS Socket Relay Element does not perform any processing of the stream. Its sole purpose is to support the Socket Relay feature of the TOI Media Player Status interface available at the application layer. Using this feature an application may request individual elementary streams to be sent to a UNIX domain socket of its choice. One possible use for this mechanism is a Teletext decoder application that needs to read the teletext information embedded in the Transport Stream.
Name | TS Socket Relay Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Socket Relay |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream |
Output Formats | MPEG-2/Transport Stream |
Trait | SocketRelay |
This element immediately recommits all metadata to its output pad.
All stream data and all metadata is passed straight through this element. In case any socket relays are set up, it sends the complete Transport Stream packets in those elementary streams to the respective UNIX domain socket.
The TS Catalog Element decodes the Program Association Table (PAT) and the Program Map Table (PMT) of each program listed in the PAT. This information is committed as metadata for easy access by other elements later in the pipeline.
Name | TS Catalog Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Catalog |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream |
Output Formats | MPEG-2/Transport Stream |
Key | Input | Output |
---|---|---|
PAT | Produced | Committed |
PMT.* | Produced | Committed |
_CatalogInfo | Produced | Published |
The element collects the PAT in the stream and all PTMs listed in the PAT. It considers sections with a correct CRC_32 checksum only.
When the element finds a valid PAT it commits the complete section in binary form as metadata with the key PAT and then begins searching for a PMT for each of the programs listed in the PAT. For each valid PMT it finds, it commits the complete section in binary form as metadata with the key PMT.<id> where <id> is the pid in which the PMT was found.
The element does not recommit metadata when the same PAT and PMTs are repeated in the stream. If the element finds a new version of the PAT, it starts over and commits that PAT and also commits the PMT for each program listed in the new PAT, when those PMTs are found in the stream. If the element finds a new version of a PMT, it just commits that single PMT as metadata.
The TS Continuity Counter Element analyzes the continuity counter field and prints messages on the log if discontinuities are detected.
Name | TS Continuity Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Continuity Counter |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream |
Output Formats | MPEG-2/Transport Stream |
This element immediately recommits all metadata to its output pad.
The element uses the continuity counter and payload unit start indicator field together with the discontinuity indicator in the adaptation field to detect stream discontinuities. The element only remembers the previous counter value so more than two duplicated counter values are not detected.
The TS Program Selector Element filters out one of the programs listed in the Program Association Table (PAT). Elementary streams that are not listed in the Program Map Table (PMT) of that program are released from the pipeline.
Name | TS Program Selector Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Program Selector |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream |
Output Formats | MPEG-2/Transport Stream |
Key | Input | Output |
---|---|---|
PAT | Required | Released |
PMT.* | Required | Released |
PMT | Produced | Committed |
_ActiveProgram | Produced | Committed |
The element listens to the _RequestProgram parameter on the blackboard which identifies the program number of the selected program. All elementary streams not listed in the PMT of that program is released from the pipeline, so that only the elementary streams of the selected program is committed to the next element in the pipeline.
As default, the element will select the first program listed in the PAT.
In case the PAT changes, the element will try to locate the previously selected program in the new PAT. If there is a program which has the same program number and the same PTM pid in the new PAT as was selected in the old PAT, the element will assume it is the same program. Otherwise it will select the default program.
The TS Program Clock Reference Element decodes the Program Clock Reference (PCR) carried in adaptation fields embedded into the ISO/IEC 13818-1 Transport Stream.
Name | TS Program Clock Reference Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Program Clock Reference |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream |
Output Formats | MPEG-2/Transport Stream |
Trait | ClockReference |
Key | Input | Output |
---|---|---|
PMT | Required | Committed |
PCR | Produced | Committed |
The element decodes the adaptation fields embedded in the elementary stream identified by the PCR_PID field in the PMT of the selected program. When it finds an adaptation field containing a PCR it calls the SetClockReference method in the IStreamClock interface to inform the pump framework about the timing properties of the stream.
The PCR is committed as metadata periodically with a frequency of about 2 Hz.
The TS Video Stream Info Decoder Element decodes relevant metadata for all video elementary streams in the ISO/IEC 13818-1 Transport Stream.
Name | TS Video Stream Info Decoder Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Video Stream Info Decoder |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream| MPEG-2/Transport Stream/* |
Output Formats | Output same as input |
Key | Input | Output |
---|---|---|
PMT | Required | Committed |
_VideoComponentFlag | Produced | Committed |
_VideoStreamInfo.* | Produced | Committed |
_VideoStreamList | Produced | Committed |
The element examines the PMT for elementary streams with a stream type signalling it is a video stream. It looks for the following stream types in the stream_type field of the PMT.
Value | Description |
---|---|
0x01 | ISO/IEC 11172 Video |
0x02 | ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream |
0x10 | ISO/IEC 14496-2 Visual |
0x80 | User Private. Special rules apply, see below. |
Some encoders are known to label ISO/IEC 13818-2 Video as stream type 0x80. To support this use, the element accepts stream type 0x80 as ISO/IEC 13818-2 Video if the PCR_PID field in the PMT points to the same elementary stream. Please note that this makes assumptions about the stream beyond the ISO/IEC 138181-1 system specification.
The element commits decoded stream information for each video stream pid as metadata with the _VideoStreamInfo key. It also commits the _VideoComponentFlag metadata with the string value "true" if at lease one video stream exists and "false" otherwise. A list of video stream pids is committed in _VideoStreamList. The _VideoStreamInfo and _VideoStreamList parameters are described in greater detail in the Complex Metadata section.
The TS Audio Stream Info Decoder Element decodes relevant metadata for all audio elementary streams in the ISO/IEC 13818-1 Transport Stream.
Name | TS Audio Stream Info Decoder Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Audio Stream Info Decoder |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream| MPEG-2/Transport Stream/* |
Output Formats | Output same as input |
Key | Input | Output |
---|---|---|
PMT | Required | Committed |
_AudioComponentFlag | Produced | Committed |
_AudioStreamInfo.* | Produced | Committed |
_AudioStreamList | Produced | Committed |
The element examines the PMT for elementary streams with a stream type signalling it is a audio stream. It looks for the following stream types in the stream_type field of the PMT.
Value | Description |
---|---|
0x03 | ISO/IEC 11172 Audio |
0x04 | ISO/IEC 13818-3 Audio |
0x81 | User Private. Used for ATSC AC3. |
Other | DVB AC3 if DVB AC-3 descriptor (tag 0x6a) is present. |
DVB AC3 is usually carried as stream type 0x06 but the element just looks at the presence of the DVB AC-3 descriptor.
The element looks for the ISO 639 language descriptor (tag 0x0a) to determine the language used in the audio track. For ISO/IEC 11172 audio in dual mono mode, the first language in the descriptor is used for the left channel and the second language is used for the right channel. If there is no language descriptor present, the element will label the audio track language as unknown.
The element commits decoded stream information for each audio stream pid as metadata with the _AudioStreamInfo key. It also commits the _AudioComponentFlag metadata with the string value "true" if at lease one audio stream exists and "false" otherwise. A list of audio stream pids is committed in _AudioStreamList. The _AudioStreamInfo and _AudioStreamList parameters are described in greater detail in the Complex Metadata section.
The TS Subtitle Stream Info Decoder Element decodes relevant metadata for all subtitle elementary streams in the ISO/IEC 13818-1 Transport Stream.
Name | TS Subtitle Stream Info Decoder Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Subtitle Stream Info Decoder |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream| MPEG-2/Transport Stream/* |
Output Formats | Output same as input |
Key | Input | Output |
---|---|---|
PMT | Required | Committed |
_SubtitleStreamInfo.* | Produced | Committed |
_SubtitleStreamList | Produced | Committed |
_TeletextStreamInfo.* | Produced | Committed |
_TeletextStreamList | Produced | Committed |
The element looks in the PMT for elementary streams with stream type 0x06 (ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data) that carry either a DVB teletext descriptor (tag 0x56) or a DVB subtitles descriptor (tag 0x59).
The element commits decoded stream information for each subtitle stream pid as metadata with the _SubtitleStreamInfo key. It also commits a list of subtitles stream pids in _SubtitleStreamList. The _SubtitleStreamInfo and _SubtitleStreamList parameters are described in greater detail in the Complex Metadata section.
The TS Demuxer Element branches the pipeline and splits the program into groups for video, audio, subtitles, and DSM-CC streams.
Name | TS Demuxer Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Demuxer Decoder |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream |
Output Formats | MPEG-2/Transport Stream/[Multi Video|Multi Audio|Multi Subtitle|DSM-CC] |
Key | Input | Output |
---|---|---|
PMT | Required | Committed |
The element branches the pipeline and splits the program into groups for video, audio, subtitles, and DSM-CC streams which are committed to different output pads. It looks at each individual stream listed in the PMT and decides which output pad to send it to.
Elementary streams with stream type 0x01, 0x02 and 0x10 are committed to the output pad with the MPEG-2/Transport Stream/Multi Video format. This is also the case if a stream has stream type 0x80 provided it also is the PCR stream.
Elementary streams with stream type 0x03, 0x04, and 0x81 are committed to the MPEG-2/Transport Stream/Multi Audio format pad. This is also true for any stream carrying the DVB AC-3 descriptor.
Elementary streams carrying the DVB teletext descriptor or the DVB subtitles descriptor are committed to the MPEG-2/Transport Stream/Multi Subtitle format pad.
The output pad with the MPEG-2/Transport Stream/DSM-CC format receives elementary streams with stream type 0x0c.
The TS Video Selector Element selects one of the video streams and commits that stream to the output pad and releases any other data.
Name | TS Video Selector Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Video Selector Decoder |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream/Multi Video |
Output Formats | MPEG-2/Transport Stream/Single Video |
Key | Input | Output |
---|---|---|
_VideoStreamList | Required | Committed |
_ActiveVideoStream | Produced | Committed |
The element filters the stream based on the value of the _RequestVideoStream blackboard parameter, which holds the pid of the video stream selected by the user. If this parameter does not exist, the element chooses the first pid in the _VideoStreamList as default. The _VideoStreamList parameter is described in greater detail in the Complex Metadata section.
The TS Audio Selector Element selects one of the audio streams and commits that stream to the output pad and releases any other data.
Name | TS Audio Selector Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Audio Selector Decoder |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream/Multi Audio |
Output Formats | MPEG-2/Transport Stream/Single Audio |
Key | Input | Output |
---|---|---|
_AudioStreamList | Required | Committed |
_ActiveAudioStream | Produced | Committed |
The element filters the stream based on the value of the _RequestAudioStream blackboard parameter, which holds the pid of the audio stream selected by the user. If this parameter does not exist, the element chooses the first pid in the _AudioStreamList as default. The _AudioStreamList parameter is described in greater detail in the Complex Metadata section.
The TS Subtitle Selector Element selects one of the subtitles streams and commits that stream to the output pad and releases any other data.
Name | TS Subtitles Selector Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS Subtitles Selector Decoder |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream/Multi Subtitles |
Output Formats | MPEG-2/Transport Stream/[DVB Subtitle|Teletext Subtitle] |
Key | Input | Output |
---|---|---|
_PlaybackMode | Required | Committed |
_ActiveSubtitleStream | Produced | Committed |
The element filters the stream based on the value of the _RequestSubtitleStream blackboard parameter, which holds the pid of the subtitles stream selected by the user. If this parameter does not exist, the element releases all subtitles streams.
The TS PES Filter Element emits a PES_START metadata at the beginning for each PES packet in the Transport Stream.
Name | TS PES Filter Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS PES Filter |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream/* |
Output Formats | Output same as input |
Key | Input | Output |
---|---|---|
PES_START | Produced | Committed |
The element looks at the payload_unit_start_indicator field of the Transport Stream packet header. When this bit is set the element emits a metadata with key PES_START and empty value.
The TS DSM-CC Element decodes DSM-CC information embedded in the stream in accordance to ISO/IEC 13818-6. The element looks for DSM-CC stream descriptors both in the PMT and in DSM-CC sections in the data stream.
Name | TS DSM-CC Descriptor |
---|---|
Version | 1 |
Interface Name | IElementDescriptor |
Binding | C++ |
Name | TS DSM-CC |
---|---|
Type | Intermediate |
Priority | 500 |
Input Formats | MPEG-2/Transport Stream/DSM-CC |
Output Formats | MPEG-2/Transport Stream/DSM-CC |
Trait | NptPosition |
Key | Input | Output |
---|---|---|
PMT | Required | Committed |
PCR | Required | Committed |
_NptPosition | Produced | Committed |
_NptPace | Produced | Committed |
The element looks for DSM-CC stream descriptors in the stream. These descriptors may be emedded in the stream in several different ways. The element looks in the PMT's list of descriptors that are not associated to any specific elementary stream. It also decodes the data stream for DSM-CC sections with table_id 0x3d DSM-CC Sections containing Stream Descriptors.
If the element finds a NPT Reference descriptor (tag 23) it uses the clock reference and scale to reconstruct valid position and pace values which are committed as metadata.
If the element finds a Stream Mode descriptor (tag 25) with a streamMode field set to End of Stream (value 7), it will assume that end of stream has been reached if the stream was playing forward, and that beginning of stream has been reached if the stream was playing backwards. These conditions are signalled by setting the _EndOfStream parameter on the blackboard.