PSI table 如何在TS 中传输的

来源:互联网 发布:数学符号输入软件 编辑:程序博客网 时间:2024/05/28 11:30

Transport Stream packets shall be 188 bytes long.(日本的ISDB 规范使用204 bytes)

MPEG_transport_stream() {

    do 

    { 

        transport_packet()
    } while (nextbits() == sync_byte)
}


transport_packet(){
    sync_byte  (8 bslbf)
    transport_error_indicator (1 bslbf)
    payload_unit_start_indicator  (1 bslbf)
    transport_priority (1 bslbf )

     PID (13 uimsbf)
    transport_scrambling_control (2 bslbf)
    adaptation_field_control (2 bslbf )

    continuity_counter ( 4 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 (8 bslbf )

             } 

     }

}

sync_byte -- The sync_byte is a fixed 8 bit field whose value is '0100 0111' (0x47).


PSI(Program specific information)  用于解复用TS 中的节目(一个节目有一个或多个ES 流组成)。

In order to successfully demultiplex a program, the decoder must be notified of both the transport_stream_id(to find the right multiplex) and the program_number of the service(to find the right program within the multiplex).


PSI 不会被加密:

Programs, elementary streams or parts thereof may be scrambled for conditional access. However, Program Specific Information shall not be scrambled.


在TS中,PSI 信息分为4个表,PAT(Program Assocation Table),  PMT(Program Map Table), CAT(Conditional Access Table), NIT(Network Information Talbe)


PSI 表被分成一个或多个section在TS 中传输:

PSI tables shall be segmented into one or more sections that are carried within transports packets.


和PSI table 一起,在TS中还可能传输私有数据表(private data tables):

Along with ITU-T Rec. H.222.0 | ISO/IEC 13818-1-defined PSI tables, it is possible to carry private data tables.


If the private data is carried in Transport Stream packets with the same PID value as Transport Stream packets carrying Program Map Tables, (as identified in the Program Association Table), then the private_section syntax and semantics shall be used. The data carried in the private_data_bytes may be scrambled. However, no other fields of the private_section shall be scrambled. This private_section allows data to be transmitted with a minimum of structure.

The Network Information Table is optional and its contents are private. The NIT is a private table.


Section 可能是变长的,一个section的开始由TS 有效负载中的pointer_field 指示.

Sections may be variable in length. The beginning of a section is indicated by a pointer_field in the Transport Stream packet payload.


pointer_field -- This is an  8-bit field whose value shall be the number of bytes, immediately following the of the pointer_field until the first byte of the first section that is present in the payload of the Transport Stream packet (so a value of  0x00 in the pointer_field indicates that the section starts immediately after the pointer_field). When at least one section begins in a given Transport Stream Packet,  then the payload_unit_start_indicator shall be set to 1 and the first byte of the payload of that transport Stream packet shall contain the pointer. When no section begins in a given Transport Stream packet , then the payload_unit_start_indicator shall be set to 0 and no pointer shall be sent in the payload of that packet.


PSI table 最大的section 不会超过1024 bytes. 私有section 不超过4096 bytes.

对于超过1024 bytes 的超大section 在13818 附录C Allocation of program_number 中有做说明, 这种情况,一个节目会有多个program_number(也即service_id)

(In general, though, a broadcaster may prefer to logically split up the Transport Stream into several programs, where the PCR_PID (location of the clock reference) is always the same)

section_number (8 uimsbf), last_section_number(8 uimsbf) 用于判断是否已经接收到一个完整的section.

总结:PSI 的各个table 使用相应的section 格式,然后封装在TS 的payload 中传输;一个section的开始,由pointer_field 指示。

section 中的 current_next_indicator 标记当前收的section是否可用.(current_next_indicator -- A 1 bit indicator, which when set to '1' indicates that the Program Association Table sent is currently applicable. When the bit is set to '0', it indicates that the table sent is not yet applicable and shall be the next table to become valid.)




0 0