# HG changeset patch # User reimar # Date 1279128520 0 # Node ID 59ba77fe9922faf8970c4f861395fb1e9cb55d3d # Parent 9cfc564bc3e699b51782e4128a7adef19c23f0bd 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. diff -r 9cfc564bc3e6 -r 59ba77fe9922 dvbsubdec.c --- 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);