[MPlayer-dev-eng] Can MPLAYER demux conveying a SL stream in PES over mpeg2-ts stream?
Deckard
hwrhee at erfsystem.com
Sat Feb 19 06:00:53 CET 2005
Hi, Nico.
Thank you for your help.
I answered your 2 ques and describe mpeg2-ts, PAT,PMT,PES.
I have not DMB stream.
Now, I generate DMB mpeg2-ts stream from station.
I will send sample stream to you nextday.
And I will describe 14496-1 SL layer summury in next post.
> it seems it can work, but I have 2 question:
>- in these streams, are timestamps conveyed in PES headers (as I hope,
>it seems
>to be the only reasonable option) or in SL headers?
I describe PES Section.
>- the PMT stream_types involved is 0x12, right? (discarding flexmux)
I describe PMT section.
This is packet and header structure for DMB stream.
Mpeg2-ts packet for SL-PES
transport_packet(){
sync_byte #8bits bslbf
transport_error_indicator #1bit bslbf
payload_unit_start_indicator #1bit bslbf
transport_priority #1bit bslbf
PID #13bits uimsbf
transport_scrambling_control #2bits bslbf //must be 00
adaptation_field_control #2bits bslbf
continuity_counter #4bits uimsbf
if(adaptation_field_control == '10' ||
adaptation_field_control=='11'){
adaptation_field()
}
if(adaptation_field_control == '01' ||
adaptation_field_control == '11'){
for (i = 0; i < N; i++){
data_byte #8bits bslbf
}
}
}
This is Adaptation field in TS packet
adaptation_field() {
adaptation_field_length //#8bits uimsbf
if (adaptation_field_length > 0) {
discontinuity_indicator //#1 bslbf
random_access_indicator //#1 bslbf
elementary_stream_priority_indicator //#1 bslbf
PCR_flag //#1 bslbf
OPCR_flag //#1 bslbf <--must be 0
splicing_point_flag //#1 bslbf
transport_private_data_flag //#1 bslbf
adaptation_field_extension_flag //#1 bslbf <--must be 0
if (PCR_flag = = '1') {
program_clock_reference_base //#33 uimsbf
reserved //#6 bslbf
program_clock_reference_extension //#9 uimsbf
}
if (OPCR_flag = = '1') { //not used
...
}
if (splicing_point_flag = = '1') {
splice_countdown //#8 tcimsbf
}
if (transport_private_data_flag = = '1') {
transport_private_data_length //#8 uimsbf
for (i = 0; i < transport_private_data_length; i++) {
private_data_byte //#8 bslbf
}
}
if (adaptation_field_extension_flag = = '1') { //not used
...
}
for (i = 0; i < N; i++) {
stuffing_byte //#8 bslbf
}
}
}
this is PES Packet.
PES_packet() {
packet_start_code_prefix //#24 bslbf must be 0x000001 that //identifies beginning of packet
stream_id //#8 uimsbf must be 0xfa for SL
PES_packet_length //#16 uimsbf
if (stream_id != program_stream_map
&& stream_id != padding_stream
&& stream_id != private_stream_2
&& stream_id != ECM
&& stream_id != EMM
&& stream_id != program_stream_directory
&& stream_id != DSMCC_stream
&& stream_id != ITU-T Rec. H.222.1 type E stream) {
'10' 2 bslbf
PES_scrambling_control //#2 bslbf
PES_priority //#1 bslbf must be 0 for DMB stream
data_alignment_indicator //#1 bslbf
copyright //#1 bslbf
original_or_copy //#1 bslbf
PTS_DTS_flags //#2 bslbf must be 10 or 01 for DMB stream
ESCR_flag //#1 bslbf must be 0 for DMB stream
ES_rate_flag //#1 bslbf must be 0 for DMB stream
DSM_trick_mode_flag //#1 bslbf must be 0 for DMB stream
additional_copy_info_flag //#1 bslbf must be 0 for DMB stream
PES_CRC_flag //#1 bslbf must be 0 for DMB stream
PES_extension_flag //#1 bslbf must be 0 for DMB stream
PES_header_data_length //#8 uimsbf
if (PTS_DTS_flags = = '10') {
'0010' //#4 bslbf
PTS [32..30] //#3 bslbf
marker_bit //#1 bslbf
PTS [29..15] //#15 bslbf
marker_bit //#1 bslbf
PTS [14..0] //#15 bslbf
marker_bit //#1 bslbf
}
if (PTS_DTS_flags = = '10') { //for DMB
'0010' //#4 bslbf for DMB
PTS [32..30] //#3 bslbf
marker_bit //#1 bslbf
PTS [29..15] //#15 bslbf
marker_bit //#1 bslbf
PTS [14..0] //#15 bslbf
marker_bit //#1 bslbf
}
if ( PES_extension_flag = = '1') { // NOT USED
}
for (i = 0; i < N1; i++) {
stuffing_byte //#8 bslbf
}
for (i = 0; i < N2; i++) {
PES_packet_data_byte //#8 bslbf
}
}
}
Stream_id Assignment in PES Packet Header.
stream_id Stream coding
1011 1100 program_stream_map
1011 1101 private_stream_1
1011 1110 padding_stream
1011 1111 private_stream_2
110x xxxx ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC
14496-3 audio stream number x xxxx
1110 xxxx ITU-T Rec. H.262 | ISO/IEC 13818-2 or ISO/IEC 11172-2 or ISO/IEC
14496-2 video stream number xxxx
1111 0000 ECM_stream
1111 0001 EMM_stream
1111 0010 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A or ISO/IEC 13818-
6_DSMCC_stream
1111 0011 ISO/IEC_13522_stream
1111 0100 ITU-T Rec. H.222.1 type A
1111 0101 ITU-T Rec. H.222.1 type B
1111 0110 ITU-T Rec. H.222.1 type C
1111 0111 ITU-T Rec. H.222.1 type D
1111 1000 ITU-T Rec. H.222.1 type E
1111 1001 ancillary_stream
1111 1010 ISO/IEC14496-1_SL-packetized_stream
1111 1011 ISO/IEC14496-1_FlexMux_stream
1111 1100 1111 1110 reserved data stream
1111 1111 program_stream_directory
Description.
PTS_DTS_flags – This is a 2-bit field. When the PTS_DTS_flags field is set to '10', the PTS fields shall be present in the PES packet header. When the PTS_DTS_flags field is set to '11', both the PTS fields and DTS fields shall be present in the PES packet header. When the PTS_DTS_flags field is set to '00' no PTS or DTS fields shall be present in the PES packet header. The value '01' is forbidden.
PTS (presentation time stamp) – Presentation times shall be related to decoding times as follows: The PTS is a 33-bit number coded in three separate fields. It indicates the time of presentation, tpn(k), in the system target decoder of a presentation unit k of elementary stream n. The value of PTS is specified in units of the period of the system clock
frequency divided by 300 (yielding 90 kHz). The presentation time is derived from the PTS according to equation 2-11 below. Refer to 2.7.4 for constraints on the frequency of coding presentation timestamps.
**If SL Header includes OCR, PES Header includes PTS
**If SL Header don’t includes OCR, PTS is not used.
marker_bit – A marker_bit is a 1-bit field that has the value '1'.
Program specific information in mpeg2-ts
PAT and PMT
Program Association Table
PID : 0x00
Desc: Associates Program Number and Program Map Table PID
Program Map Table
PID : Assignment indicated in the PAT
Desc :Specifies PID values for components of one or more programs
The Program Association Table provides the correspondence between a program_number and the PID value of the Transport Stream packets which carry the program definition. The program_number is the numeric label associated with a program.
The overall table is contained in one or more sections with the following syntax. It may be segmented to occupy multiple
sections (see Table).
Note : nico, PAT describes only one program for DMB stream.
This is PAT structure.
program_association_section() {
table_id //#8 uimsbf
section_syntax_indicator //#1 bslbf
'0' //#1 bslbf
reserved //#2 bslbf
section_length //#12 uimsbf
transport_stream_id //#16 uimsbf
reserved //#2 bslbf
version_number //#5 uimsbf
current_next_indicator //#1 bslbf
section_number //#8 uimsbf
last_section_number //#8 uimsbf
for (i = 0; i < N; i++) {
program_number //#16 uimsbf
reserved //#3 bslbf
if (program_number = = '0') {
network_PID //#13 uimsbf
}
else {
program_map_PID //#13 uimsbf
}
}
CRC_32 //#32 rpchof
}
Description.
table_id assignment values
Value description
0x00 program_association_section
0x01 conditional_access_section (CA_section)
0x02 TS_program_map_section
0x03 TS_description_section
0x04 ISO_IEC_14496_scene_description_section //this is associated SL packet
0x05 ISO_IEC_14496_object_descriptor_section // this is associated SL packet
0x06-0x37 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 reserved
0x38-0x3F Defined in ISO/IEC 13818-6
0x40-0xFE User private
0xFF forbidden
this is PMT structure.
TS_program_map_section() {
table_id //#8 uimsbf
section_syntax_indicator //#1 bslbf
'0' //#1 bslbf
reserved //#2 bslbf
section_length //#12 uimsbf
program_number //#16 uimsbf
reserved //#2 bslbf
version_number //#5 uimsbf
current_next_indicator //#1 bslbf
section_number //#8 uimsbf
last_section_number //#8 uimsbf
reserved //#3 bslbf
PCR_PID //#13 uimsbf
reserved //#4 bslbf
program_info_length //#12 uimsbf
for (i = 0; i < N; i++) {
descriptor() //###Note 1
}
for (i = 0; i < N1; i++) {
stream_type //#8 uimsbf must be 0x12 or 0x13
reserved //#3 bslbf
elementary_PID //#13 uimsbf
reserved //#4 bslbf
ES_info_length //#12 uimsbf
for (i = 0; i < N2; i++) {
descriptor() //###Note 2
}
}
CRC_32 //#32 rpchof
}
Note 1: this descriptor must includes IOD_descriptor.
Note 2: this descriptor must includes SL_descriptor for ES_ID.
Description.
Stream type assignments
Value Description
0x00 ITU-T | ISO/IEC Reserved
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
0x03 ISO/IEC 11172 Audio
0x04 ISO/IEC 13818-3 Audio
0x05 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections
0x06 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data
0x07 ISO/IEC 13522 MHEG
0x08 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A DSM-CC
0x09 ITU-T Rec. H.222.1
0x0A ISO/IEC 13818-6 type A
0x0B ISO/IEC 13818-6 type B
0x0C ISO/IEC 13818-6 type C
0x0D ISO/IEC 13818-6 type D
0x0E ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary
0x0F ISO/IEC 13818-7 Audio with ADTS transport syntax
0x10 ISO/IEC 14496-2 Visual
0x11 ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1
**0x12 ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets
**0x13 ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections.
0x14 ISO/IEC 13818-6 Synchronized Download Protocol
0x15-0x7F ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved
0x80-0xFF User Private
so, stream_type must be 0x12 or 0x13 for SL-packetized stream.
IOD_descriptor
The IOD descriptor encapsulates the InitialObjectDescriptor structure. An initial object descriptor allows access to a set of ISO/IEC 14496 streams by identifying the ES_ID values of the ISO/IEC 14496-1 scene description and object descriptor streams. Both the scene description stream and the object descriptor stream contain further information about the ISO/IEC 14496 streams that are part of the scene. See Annex R for a description of the content access procedure. The InitialObjectDescriptor is specified in subclause 8.6.3 of ISO/IEC 14496-1.
Within a Transport Stream, the IOD descriptor shall be conveyed in the descriptor loop immediately following the program_info_length field in the Program Map Table. If a Program Stream Map is present in a Program Stream, the IOD descriptor shall be conveyed in the descriptor loop immediately following the program_stream_info_length field in the Program Stream Map. More than one IOD descriptor may be associated to a program.
This is IOD_descriptor structure.
IOD_descriptor () {
descriptor_tag //#8 uimsbf
descriptor_length //#8 uimsbf
Scope_of_IOD_label //#8 uimsbf
IOD_label //#8 uimsbf
InitialObjectDescriptor () //#8 uimsbf
}
SL_descriptor
The SL descriptor shall be used when a single ISO/IEC 14496-1 SL-packetized stream is encapsulated in PES packets.
The SL descriptor associates the ES_ID of this SL-packetized stream to an elementary_PID in case of a Transport Stream or to an elementary_stream_id in case of a Program Stream. Within a Transport Stream, the SL descriptor shall be conveyed for the corresponding elementary stream in the descriptor loop immediately following the ES_info_length field in the Program Map Table. If a Program Stream Map is present in a Program Stream, the SL descriptor shall be conveyed in the descriptor loop immediately following the elementary_stream_info_length field within the Program Stream Map.
This is structure of SL_descriptor.
SL_descriptor () {
descriptor_tag //#8 uimsbf
descriptor_length //#8 uimsbf
ES_ID //#16 uimsbf
}
ES_ID – This 16-bit field shall specify the identifier of an ISO/IEC 14496-1 SL-packetized stream.
14496-1 SL Layer Section for DMB stream.
>class SLConfigDescriptor extends BaseDescriptor : bit(8) tag=SLConfigDescrTag {
> bit(8) predefined;
> if (predefined==0) {
> bit(1) useAccessUnitStartFlag;
> bit(1) useAccessUnitEndFlag; //this bit must be used with useAccessUnitStartFlag.
> bit(1) useRandomAccessPointFlag; // must be 0 for DMB stream.
> bit(1) hasRandomAccessUnitsOnlyFlag; // must be 0
> bit(1) usePaddingFlag; //must be 0
> bit(1) useTimeStampsFlag; //must be 1
> bit(1) useIdleFlag; //must be 1
> bit(1) durationFlag;
> bit(32) timeStampResolution; //must be 90000Hz
> bit(32) OCRResolution;//must be 90000Hz
> bit(8) timeStampLength; // must be 33bit or smaller than 33
> bit(8) OCRLength; // must be 33bit or smaller than 33
> bit(8) AU_Length; // must be 0
> bit(8) instantBitrateLength;
> bit(4) degradationPriorityLength; //must be 0
> bit(5) AU_seqNumLength; // must be 0
> bit(5) packetSeqNumLength; // must be 0
> bit(2) reserved=0b11;
> }
> if (durationFlag) {
> bit(32) timeScale; //must be used when durationFlag is 1
> bit(16) accessUnitDuration; //must be used when durationFlag is 1
> bit(16) compositionUnitDuration; // must be used when durationFlag is 1
> }
> if (!useTimeStampsFlag) {
> bit(timeStampLength) startDecodingTimeStamp;
> bit(timeStampLength) startCompositionTimeStamp;
> }
>}
instantBitrateLength is used when OCR is coding in SL-packet Header.
If OCR is coding in SL-Packet Header, instantBitrate must be used.
Deckard.
More information about the MPlayer-dev-eng
mailing list