aboutsummaryrefslogtreecommitdiff
path: root/lib/ffmpeg/libavcodec
diff options
context:
space:
mode:
authorPaul Kendall <paul@kcbbs.gen.nz>2012-01-29 14:50:19 +0100
committerelupus <elupus@xbmc.org>2012-02-11 15:19:51 +0100
commit6373f33e5b12eb06e37d670c9bba4e7041cded79 (patch)
tree1894143b3a8388737183f8d26a7747c5a55e78e1 /lib/ffmpeg/libavcodec
parenta41ea84f45a150191f818df72c7455070ee46b4c (diff)
Fix dvb subtitle decoding when display segment is missing.
closes ticket #8504
Diffstat (limited to 'lib/ffmpeg/libavcodec')
-rw-r--r--lib/ffmpeg/libavcodec/dvbsubdec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ffmpeg/libavcodec/dvbsubdec.c b/lib/ffmpeg/libavcodec/dvbsubdec.c
index 7c37915aaa..e8ef8ce252 100644
--- a/lib/ffmpeg/libavcodec/dvbsubdec.c
+++ b/lib/ffmpeg/libavcodec/dvbsubdec.c
@@ -1409,6 +1409,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
int segment_type;
int page_id;
int segment_length;
+ int got_segment = 0;
#ifdef DEBUG_PACKET_CONTENTS
int i;
@@ -1445,21 +1446,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",
@@ -1470,6 +1476,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);
if (p != p_end) {
av_dlog(avctx, "Junk at end of packet\n");