summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2011-06-13 02:58:23 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2011-06-13 02:58:23 (GMT)
commitd27bedf5571bdb80c164ce5d11a8af55f0275b92 (patch)
treec70c5024f97443f5e15997e46c97ebfd183fb0dc
parentfec82bc812708bff68dee89c8e5c8628c3418d47 (diff)
DVB Subtitles: Fix display of subs with no display segment.
The DVB subtitle standard reads: 'Within a display set the sequence of segments (when present) is: - page composition; - region composition; - CLUT definition; - object data; - end of display segment;' In the samples provided in #9373, the end of display segment is not seen. The 'when present' above suggests that it is not required but the ffmpeg code assumes it is. The workaround is to check that the previous 4 segments have been seen and, if so, process a dummy display segment. mplayer and ffplay both appear to have the same problem. Refs #9373
-rw-r--r--mythtv/external/FFmpeg/libavcodec/dvbsubdec.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mythtv/external/FFmpeg/libavcodec/dvbsubdec.c b/mythtv/external/FFmpeg/libavcodec/dvbsubdec.c
index 9b54403..76c944f 100644
--- a/mythtv/external/FFmpeg/libavcodec/dvbsubdec.c
+++ b/mythtv/external/FFmpeg/libavcodec/dvbsubdec.c
@@ -1455,6 +1455,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
p = buf;
p_end = buf + buf_size;
+ int gotpage, gotregion, gotclut, gotobject, gotdisplay = 0;
while (p_end - p >= 6 && *p == 0x0f) {
p += 1;
segment_type = *p++;
@@ -1473,21 +1474,26 @@ static int dvbsub_decode(AVCodecContext *avctx,
switch (segment_type) {
case DVBSUB_PAGE_SEGMENT:
dvbsub_parse_page_segment(avctx, p, segment_length);
+ gotpage = 1;
break;
case DVBSUB_REGION_SEGMENT:
dvbsub_parse_region_segment(avctx, p, segment_length);
+ gotregion = 1;
break;
case DVBSUB_CLUT_SEGMENT:
dvbsub_parse_clut_segment(avctx, p, segment_length);
+ gotclut = 1;
break;
case DVBSUB_OBJECT_SEGMENT:
dvbsub_parse_object_segment(avctx, p, segment_length);
+ gotobject = 1;
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);
+ gotdisplay = 1;
break;
default:
av_dlog(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n",
@@ -1499,6 +1505,11 @@ 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. see #9373
+ if ((gotpage & gotregion & gotclut & gotobject) && !gotdisplay && sub)
+ *data_size = dvbsub_display_end_segment(avctx, p, 0, sub);
+
return p - buf;
}