Ticket #2579: 0001-mpegts-demux-synchronous-SMPTE-336M-Key-Length-Value.patch

File 0001-mpegts-demux-synchronous-SMPTE-336M-Key-Length-Value.patch, 2.1 KB (added by pross, 13 years ago)
  • libavformat/mpegts.c

    From 3291e18c9be0d1b83fdcfe69bc42c5c2c61c7b7f Mon Sep 17 00:00:00 2001
    From: Peter Ross <pross@xvid.org>
    Date: Tue, 5 Feb 2013 22:01:11 +1100
    Subject: [PATCH] mpegts: demux synchronous SMPTE 336M Key-Length-Value (KLV)
     metadata
    
    Fixes ticket #2579.
    ---
     libavformat/mpegts.c | 20 ++++++++++++++++++++
     1 file changed, 20 insertions(+)
    
    diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
    index 5f2dfe9..c91018e 100644
    a b static const StreamType REGD_types[] = {  
    640640    { 0 },
    641641};
    642642
     643static const StreamType METADATA_types[] = {
     644    { MKTAG('K','L','V','A'), AVMEDIA_TYPE_DATA, AV_CODEC_ID_SMPTE_KLV },
     645    { 0 },
     646};
     647
    643648/* descriptor present */
    644649static const StreamType DESC_types[] = {
    645650    { 0x6a, AVMEDIA_TYPE_AUDIO,             AV_CODEC_ID_AC3 }, /* AC-3 descriptor */
    static int mpegts_push_data(MpegTSFilter *filter,  
    10021007                    p += sl_header_bytes;
    10031008                    buf_size -= sl_header_bytes;
    10041009                }
     1010                if (pes->stream_type == 0x15 && buf_size >= 5) {
     1011                    /* skip metadata access unit header */
     1012                    pes->pes_header_size += 5;
     1013                    p += 5;
     1014                    buf_size -= 5;
     1015                }
    10051016                if (pes->ts->fix_teletext_pts && pes->st->codec->codec_id == AV_CODEC_ID_DVB_TELETEXT) {
    10061017                    AVProgram *p = NULL;
    10071018                    while ((p = av_find_program_from_stream(pes->stream, p, pes->st->index))) {
    int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type  
    14891500    case 0x52: /* stream identifier descriptor */
    14901501        st->stream_identifier = 1 + get8(pp, desc_end);
    14911502        break;
     1503    case 0x26: /* metadata descriptor */
     1504        if (get16(pp, desc_end) == 0xFFFF)
     1505            *pp += 4;
     1506        if (get8(pp, desc_end) == 0xFF) {
     1507            st->codec->codec_tag = bytestream_get_le32(pp);
     1508            if (st->codec->codec_id == AV_CODEC_ID_NONE)
     1509                mpegts_find_stream_type(st, st->codec->codec_tag, METADATA_types);
     1510        }
     1511        break;
    14921512    default:
    14931513        break;
    14941514    }