diff options
author | Paul Kendall <paul@kcbbs.gen.nz> | 2012-01-29 14:50:19 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2012-01-29 14:52:56 +0100 |
commit | 7df9937fcc6a91ce4763dfa1ea6fc331f7e77295 (patch) | |
tree | 49028921de57f4b243f2eee75ecb3dca402d1379 /libavcodec | |
parent | f4e8292eb7560730291172de14ced171b55638b6 (diff) | |
download | ffmpeg-7df9937fcc6a91ce4763dfa1ea6fc331f7e77295.tar.gz |
Fix dvb subtitle decoding when display segment is missing.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dvbsubdec.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index e2a804a9db..e2b4ee6193 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1452,6 +1452,7 @@ static int dvbsub_decode(AVCodecContext *avctx, int page_id; int segment_length; int i; + int got_segment = 0; av_dlog(avctx, "DVB sub packet:\n"); @@ -1490,21 +1491,26 @@ static int dvbsub_decode(AVCodecContext *avctx, switch (segment_type) { case DVBSUB_PAGE_SEGMENT: dvbsub_parse_page_segment(avctx, p, segment_length); + got_segment |= 1; break; case DVBSUB_REGION_SEGMENT: dvbsub_parse_region_segment(avctx, p, segment_length); + got_segment |= 2; break; case DVBSUB_CLUT_SEGMENT: dvbsub_parse_clut_segment(avctx, p, segment_length); + got_segment |= 4; break; case DVBSUB_OBJECT_SEGMENT: dvbsub_parse_object_segment(avctx, p, segment_length); + got_segment |= 8; break; case DVBSUB_DISPLAYDEFINITION_SEGMENT: dvbsub_parse_display_definition_segment(avctx, p, segment_length); break; case DVBSUB_DISPLAY_SEGMENT: *data_size = dvbsub_display_end_segment(avctx, p, segment_length, sub); + got_segment |= 16; break; default: av_dlog(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n", @@ -1515,6 +1521,10 @@ static int dvbsub_decode(AVCodecContext *avctx, p += segment_length; } + // Some streams do not send a display segment but if we have all the other + // segments then we need no further data. + if (got_segment == 15 && sub) + *data_size = dvbsub_display_end_segment(avctx, p, 0, sub); return p - buf; } |