Framing

Framing is the process of analyzing the structure of a raw data stream to determine its basic format and then retransmit the data stream together with meta information about the format. The data will also be divided into frames of suitable size for each format, e.g. one packet in each frame.

Loadable Module Properties

Module Name Streamer Framing Element
File Name libframingelement.so
Class Count1

Element Quick Index

Framing.

Framing element after source element in pipeline.

Framing Element

The Framing Element recognizes ISO/IEC 13818-1 Transport Streams and Program Streams, and ISO/IEC 11172-1 System Streams and Packet Layer streams (like MP3), and Microsoft Advanced Systems Format (ASF) Streams. Except for identifying and verifying the stream format, the Framing Element divides the stream into frames.

For reference, the ISO/IEC 13818-1 standard is also known as MPEG2 and the ISO/IEC 11172-1 standard is also known as MPEG1.

Class Properties

NameFraming Descriptor
Version1
Interface Name IElementDescriptor
BindingC++

Element Descriptor

NameFraming
TypeIntermediary
Priority500
Input FormatsRaw
Output Formats MPEG-[2/Transport Stream|2/Program Stream|
1/System Stream|1/Audio Elementary Stream]|Advanced Systems Format Stream

Metadata

Key Input Output
_StreamFormatProducedCommitted

Theory of Operation

When the stream format is not yet known, the Framing Element searches for evidence of format attributes in the following order:

  1. ISO/IEC 13818-1 Transport Stream

  2. ISO/IEC 13818-1 Program Stream

  3. ISO/IEC 11172-1 System Stream

  4. ISO/IEC 11172-3 Audio Elementary Stream

  5. Microsoft Advanced Systems Format Stream

When the format of a data stream has been identified, the Framing Element opens an output pad with the corresponding format. It then continues to examine the data stream to verify that it maintains the same format.

If the data stream for some reason does not follow the syntax mandated by the format, the Framing Element stops all output and tries to resynchronize using the same format as before. If this fails, it starts searching the data stream again for formats from the top of the list and down. During this process, the output pad which was used before is still open but no data is sent to it. Instead, data that does not match any known format is released from the pipeline.

When the Framing Element is able to identify the stream format again, it uses the same output pad as before provided the data format has not changed. Otherwise, the previous output pad is closed and a new one is opened for the new format.

Framing properties

The output from the element will be framed, i.e. divided into segments and frames, in different ways for particular output formats.

Transport Stream

Transport streams are aligned to segment and frame boundaries in such a way that individual transport stream packets correspond to a single frame in a segment. Each segment may contain several frames with transport stream packets.

Program Stream and System Stream

Program streams are aligned to segment boundaries in such a way that individual pack headers and PES packets (ISO/IEC 13818-1, Table 2-32) are never split over several segments. When a pack header is present in the stream, it is located first in a segment, possibly followed by multiple PES packets in the same segment.

Audio Elementary Stream

Audio elementary streams are aligned to segment boundaries in such a way that an individual ISO/IEC 11172-3 audio frame is never split over several segments.

Advanced Systems Format Stream

Advanced Systems Format streams are aligned so the header object are in a segment of its own and the following data packets are aligned to segment boundaries. The data object header and the data following the data packets are discarded.