From c53bf2c0860f6b0ff583ad9f4bc4c7e86d47fa94 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 6 Oct 2015 09:17:17 +0100 Subject: [PATCH] Speculative support for multi-part subtitles (#709). --- ChangeLog | 5 +++++ src/lib/ffmpeg_decoder.cc | 32 ++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index b3a58f1f7..598636ff1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-10-06 Carl Hetherington + + * Speculative support for multi-part + bitmap subtitles (#709). + 2015-10-05 Carl Hetherington * Version 2.4.0 released. diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index c23d56b42..3fdb2f2a9 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -412,8 +412,6 @@ FFmpegDecoder::decode_subtitle_packet () indicate that the previous subtitle should stop. We can ignore it here. */ return; - } else if (sub.num_rects > 1) { - throw DecodeError (_("multi-part subtitles not yet supported")); } /* Subtitle PTS (within the source, not taking into account any of the @@ -430,20 +428,22 @@ FFmpegDecoder::decode_subtitle_packet () period.to = ffmpeg_content()->subtitle_stream()->find_subtitle_to (period.from); } - AVSubtitleRect const * rect = sub.rects[0]; - - switch (rect->type) { - case SUBTITLE_NONE: - break; - case SUBTITLE_BITMAP: - decode_bitmap_subtitle (rect, period); - break; - case SUBTITLE_TEXT: - cout << "XXX: SUBTITLE_TEXT " << rect->text << "\n"; - break; - case SUBTITLE_ASS: - cout << "XXX: SUBTITLE_ASS " << rect->ass << "\n"; - break; + for (unsigned int i = 0; i < sub.num_rects; ++i) { + AVSubtitleRect const * rect = sub.rects[i]; + + switch (rect->type) { + case SUBTITLE_NONE: + break; + case SUBTITLE_BITMAP: + decode_bitmap_subtitle (rect, period); + break; + case SUBTITLE_TEXT: + cout << "XXX: SUBTITLE_TEXT " << rect->text << "\n"; + break; + case SUBTITLE_ASS: + cout << "XXX: SUBTITLE_ASS " << rect->ass << "\n"; + break; + } } avsubtitle_free (&sub); -- 2.30.2