Mercurial > libavcodec.hg
changeset 12164:59ba77fe9922 libavcodec
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 | 9cfc564bc3e6 |
children | 4f06422196ee |
files | dvbsubdec.c |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/dvbsubdec.c Wed Jul 14 13:12:24 2010 +0000 +++ b/dvbsubdec.c Wed Jul 14 17:28:40 2010 +0000 @@ -358,8 +358,14 @@ int i, r, g, b, a = 0; DVBSubContext *ctx = avctx->priv_data; - ctx->composition_id = avctx->sub_id & 0xffff; - ctx->ancillary_id = avctx->sub_id >> 16; + if (!avctx->extradata || avctx->extradata_size != 4) { + av_log(avctx, AV_LOG_WARNING, "Invalid extradata, subtitle streams may be combined!\n"); + ctx->composition_id = -1; + ctx->ancillary_id = -1; + } else { + ctx->composition_id = AV_RB16(avctx->extradata); + ctx->ancillary_id = AV_RB16(avctx->extradata + 2); + } default_clut.id = -1; default_clut.next = NULL; @@ -1434,7 +1440,8 @@ segment_length = AV_RB16(p); p += 2; - if (page_id == ctx->composition_id || page_id == ctx->ancillary_id) { + if (page_id == ctx->composition_id || page_id == ctx->ancillary_id || + ctx->composition_id == -1 || ctx->ancillary_id == -1) { switch (segment_type) { case DVBSUB_PAGE_SEGMENT: dvbsub_parse_page_segment(avctx, p, segment_length);