mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Fix dvb subtitle decoding when display segment is missing.
This commit is contained in:
parent
f4e8292eb7
commit
7df9937fcc
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user