]> git.sesse.net Git - ffmpeg/commit
avformat/mpegtsenc: Fix mpegts_write_pes() for private_stream_2 and other types
authorzheng qian <xqq@xqq.im>
Sun, 25 Apr 2021 02:52:20 +0000 (11:52 +0900)
committerMarton Balint <cus@passwd.hu>
Wed, 28 Apr 2021 19:32:22 +0000 (21:32 +0200)
commit6ad61e30a16d338eab23b649365813fb150066ef
treec91e92401fa8b574dbd1fe8ba86532bbcd9ec0a4
parentf01286957ee2a2a6cafcdaa909f7c355427d32db
avformat/mpegtsenc: Fix mpegts_write_pes() for private_stream_2 and other types

According to the PES packet definition defined in Table 2-17 of ISO_IEC_13818-1
specification, some fields like PTS/DTS or pes_extension could only appears if
the stream_id meets the condition:

if (stream_id != 0xBC &&  // program_stream_map
    stream_id != 0xBE &&  // padding_stream
    stream_id != 0xBF &&  // private_stream_2
    stream_id != 0xF0 &&  // ECM
    stream_id != 0xF1 &&  // EMM
    stream_id != 0xFF &&  // program_stream_directory
    stream_id != 0xF2 &&  // DSMCC_stream
    stream_id != 0xF8)    // ITU-T Rec. H.222.1 type E stream

And the following stream_id types don't have fields like PTS/DTS:

else if ( stream_id == program_stream_map
|| 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 ) {
    for (i = 0; i < PES_packet_length; i++) {
        PES_packet_data_byte
    }
}

Current implementation skipped the check of stream_id causing some kind of
streams like private_stream_2 to be incorrectly written with actually a
private_stream_1-like PES header with PTS/DTS field. For example, Japan DTV
transmits news and alerts through ARIB superimpose that utilizes
private_stream_2 still could not be remuxed correctly for now.

This patch set fixes the remuxing for private_stream_2 and
other stream_id types.

Signed-off-by: zheng qian <xqq@xqq.im>
Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/mpegtsenc.c