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[] = {
|
| 640 | 640 | { 0 }, |
| 641 | 641 | }; |
| 642 | 642 | |
| | 643 | static const StreamType METADATA_types[] = { |
| | 644 | { MKTAG('K','L','V','A'), AVMEDIA_TYPE_DATA, AV_CODEC_ID_SMPTE_KLV }, |
| | 645 | { 0 }, |
| | 646 | }; |
| | 647 | |
| 643 | 648 | /* descriptor present */ |
| 644 | 649 | static const StreamType DESC_types[] = { |
| 645 | 650 | { 0x6a, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 }, /* AC-3 descriptor */ |
| … |
… |
static int mpegts_push_data(MpegTSFilter *filter,
|
| 1002 | 1007 | p += sl_header_bytes; |
| 1003 | 1008 | buf_size -= sl_header_bytes; |
| 1004 | 1009 | } |
| | 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 | } |
| 1005 | 1016 | if (pes->ts->fix_teletext_pts && pes->st->codec->codec_id == AV_CODEC_ID_DVB_TELETEXT) { |
| 1006 | 1017 | AVProgram *p = NULL; |
| 1007 | 1018 | 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
|
| 1489 | 1500 | case 0x52: /* stream identifier descriptor */ |
| 1490 | 1501 | st->stream_identifier = 1 + get8(pp, desc_end); |
| 1491 | 1502 | 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; |
| 1492 | 1512 | default: |
| 1493 | 1513 | break; |
| 1494 | 1514 | } |