From 1fc20af6af3ec31d0ee665557885b6c20c6d3686 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 29 Jul 2015 17:59:51 +0200 Subject: [PATCH] avcodec/dvbsubdec: Implement display definition segment fallback from ETSI EN 300 743 V1.3.1 Fixes: subtitles.ts Fixes: Ticket679 Signed-off-by: Michael Niedermayer --- libavcodec/dvbsubdec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index e3b72ab1ff..ce03e12d4a 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1606,6 +1606,7 @@ static int dvbsub_decode(AVCodecContext *avctx, int i; int ret = 0; int got_segment = 0; + int got_dds = 0; ff_dlog(avctx, "DVB sub packet:\n"); @@ -1668,9 +1669,15 @@ static int dvbsub_decode(AVCodecContext *avctx, case DVBSUB_DISPLAYDEFINITION_SEGMENT: ret = dvbsub_parse_display_definition_segment(avctx, p, segment_length); + got_dds = 1; break; case DVBSUB_DISPLAY_SEGMENT: ret = dvbsub_display_end_segment(avctx, p, segment_length, sub, data_size); + if (got_segment == 15 && !got_dds && !avctx->width && !avctx->height) { + // Default from ETSI EN 300 743 V1.3.1 (7.2.1) + avctx->width = 720; + avctx->height = 576; + } got_segment |= 16; break; default: