Mercurial > libavformat.hg
changeset 6258:2d397bb856a4 libavformat
Pass the composition and ancillary ID for DVB subtitles via extradata instead
of sub_id, this allows detecting when that information is not available and
just decode everything.
In addition extradata is required for many codecs and thus in contrast to
sub_id generally already passed on by any programs using libav*.
Also ask for a sample if we encounter a stream with multiple/changing IDs.
author | reimar |
---|---|
date | Wed, 14 Jul 2010 17:28:40 +0000 |
parents | 0689434db2c6 |
children | 7b2f50760dfb |
files | mpegts.c |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mpegts.c Wed Jul 14 12:32:00 2010 +0000 +++ b/mpegts.c Wed Jul 14 17:28:40 2010 +0000 @@ -860,7 +860,6 @@ const uint8_t *p, *p_end, *desc_list_end, *desc_end; int program_info_length, pcr_pid, pid, stream_type; int desc_list_len, desc_len, desc_tag; - int comp_page, anc_page; char language[4]; uint32_t prog_reg_desc = 0; /* registration descriptor */ @@ -981,9 +980,17 @@ language[2] = get8(&p, desc_end); language[3] = 0; get8(&p, desc_end); - comp_page = get16(&p, desc_end); - anc_page = get16(&p, desc_end); - st->codec->sub_id = (anc_page << 16) | comp_page; + if (st->codec->extradata) { + if (st->codec->extradata_size == 4 && memcmp(st->codec->extradata, p, 4)) + av_log_ask_for_sample(ts->stream, "DVB sub with multiple IDs\n"); + } else { + st->codec->extradata = av_malloc(4 + FF_INPUT_BUFFER_PADDING_SIZE); + if (st->codec->extradata) { + st->codec->extradata_size = 4; + memcpy(st->codec->extradata, p, 4); + } + } + p += 4; av_metadata_set2(&st->metadata, "language", language, 0); break; case 0x0a: /* ISO 639 language descriptor */