Program Stream and System Stream

This module contains elements for handling ISO/IEC 13818-1 Program Streams and ISO/IEC 11172-1 System Streams.

Loadable Module Properties

Module Name Streamer Program Stream Elements
File Name libtselements.so
Class Count7

Element Quick Index

PS System Clock Reference Element, SS System Clock Reference Element, PS PES Filter Element, PS Stream Info Decoder Element, PS Demuxer Element, PS Audio Selector Element, PS Video Selector Element.

Typical Program Stream pipeline.

General Framing Requirents

The audio elementary stream must be aligned to segment boundaries as described in the Framing Element section.

PS System Clock Reference Element

The PS System Clock Reference element.

Class Properties

Name PS System Clock Reference Descriptor
Version1
Interface Name IElementDescriptor
BindingC++

Element Descriptor

Name PS System Clock Reference
TypeIntermediate
Priority500
Input Formats MPEG-2/Program Stream
Output Formats MPEG-2/Program Stream
Trait ClockReference

Metadata

The element immediately recommits all metadata to its output pad.

Theory of Operation

The element looks for ISO/IEC 13818-1 pack_header structures in the stream. It expects pack headers to be aligned to segment boundaries, i.e. pack headers must, if present, be located first in a segment. For every header it finds, it extracts the system_clock_reference field and reports that clock reference to the Streamer using the IStreamClock interface.

SS System Clock Reference Element

The SS System Clock Reference element.

Class Properties

Name SS System Clock Reference Descriptor
Version 1
Interface Name IElementDescriptor
BindingC++

Element Descriptor

Name SS System Clock Reference
Type Intermediate
Priority500
Input Formats MPEG-1/System Stream
Output Formats MPEG-1/System Stream
Trait ClockReference

Metadata

The element immediately recommits all metadata to its output pad.

Theory of Operation

The element looks for ISO/IEC 11172-1 Pack headers in the stream. It expects Pack headers to be aligned to segment boundaries, i.e. Pack headers must, if present, be located first in a segment. For every header it finds, it extracts the system_clock_reference field and reports that clock reference to the Streamer using the IStreamClock interface.

PS PES Filter Element

The PS PES Filter element.

Class Properties

Name PS PES Filter Descriptor
Version 1
Interface Name IElementDescriptor
BindingC++

Element Descriptor

Name PS PES Filter
TypeIntermediate
Priority500
Input Formats MPEG-[2/Program|1/System] Stream
Output Formats MPEG-[2/Program|1/System] Stream/PES

Metadata

Key Input Output
PES_STARTProducedCommitted

Theory of Operation

The element splits each segment so that there is one segment for each PES packet. It also inserts a PES_START metadata (with empty value) before each segment. The syntactic elements MPEG_program_end_code (0x000001b9), pack_header (0x000001ba), system_header (0x000001bb), program_stream_map (0x000001bc) and padding_stream (0x000001be) are released from the stream. Special measures are taken to handle both system streams and program streams in the same way.

PS Stream Info Decoder Element

The PS Stream Info Decoder element.

Class Properties

Name PS Stream Info Decoder Descriptor
Version1
Interface Name IElementDescriptor
BindingC++

Element Descriptor

Name PS Stream Info Decoder
TypeIntermediate
Priority500
Input Formats MPEG-[2/Program|1/System] Stream/PES
Output Formats Output same as input

Metadata

Key Input Output
_VideoStreamList ProducedCommitted
_AudioStreamList ProducedCommitted
_VideoStreamInfo ProducedCommitted
_AudioStreamInfo ProducedCommitted

Theory of Operation

The element examines the stream_id field of each PES packet and keeps record on which video and audio tracks are embedded in the stream. Both ISO/IEC 11172-1 and ISO/IEC 13818-1 mandates that PES packets with stream ids in the range 0xc0–0xdf inclusive must carry audio and PES packets with stream ids in the range 0xe0–0xef inclusive must carry video. In addition to the regular stream ids for audio and video, the element examines PES packets carrying private data to see if they contain DVD audio.

For each new video PES stream it finds, the element commits both _VideoStreamList and _VideoStreamInfo<stream_id> metadata with values updated to reflect the current situation. For each new audio PES stream it finds, the element commits updated versions of the _AudioStreamList metadata in the same way, but writes the _AudioStreamInfo<stream_id> parameter directly on the blackboard.

The _VideoStreamList, _AudioStreamList, _VideoStreamInfo.* and _AudioStreamInfo.* parameters are described in greater detail in the Complex Metadata section.

PS Demuxer Element

The PS Demuxer element.

Class Properties

Name PS Demuxer Descriptor
Version1
Interface Name IElementDescriptor
BindingC++

Element Descriptor

NamePS Demuxer
TypeIntermediate
Priority500
Input Formats MPEG-[2/Program|1/System] Stream/PES
Output Formats MPEG-[2/Program|1/System] Stream/[Multi Video|Multi Audio]

Metadata

The element immediately recommits all metadata to each output pad.

Theory of Operation

The element opens two output pads, one for video and one for audio. It then sends all PES packets with stream_id in the range 0xc0–0xdf inclusive to the audio output pad and PES packets in the range 0xe0–0xef inclusive to the video output pad. Some PES packets with stream_id equal to 0xbd are also sent to the audio output pad as they are assumed to carry DVD audio.

PS Audio Selector Element

The PS Audio Selector element.

Class Properties

Name PS Audio Selector Descriptor
Version1
Interface Name IElementDescriptor
BindingC++

Element Descriptor

Name PS Audio Selector
TypeIntermediate
Priority500
Input Formats MPEG-[2/Program|1/System] Stream/Multi Audio
Output Formats MPEG-[2/Program|1/System] Stream/Single Audio

Metadata

Key Input Output
_AudioStreamList RequiredCommitted
_ActiveAudioStreamProducedCommitted

Theory of Operation

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.

PS Video Selector Element

The PS Video Selector element.

Class Properties

Name PS Video Selector Descriptor
Version1
Interface Name IElementDescriptor
BindingC++

Element Descriptor

NamePS Video Selector
TypeIntermediate
Priority500
Input Formats MPEG-[2/Program|1/System] Stream/Multi Video
Output Formats MPEG-[2/Program|1/System] Stream/Single Video

Metadata

Key Input Output
_VideoStreamList RequiredCommitted
_ActiveVideoStreamProducedCommitted

Theory of Operation

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.