Speculative support for multi-part subtitles (#709).
authorCarl Hetherington <cth@carlh.net>
Tue, 6 Oct 2015 08:17:17 +0000 (09:17 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 6 Oct 2015 08:17:17 +0000 (09:17 +0100)
ChangeLog
src/lib/ffmpeg_decoder.cc

index b3a58f1f74f68c20b4eff9f475749f26a5e2bc96..598636ff1a1e39aa29259e77dce36cf226c2b34f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-06  Carl Hetherington  <cth@carlh.net>
+
+       * Speculative support for multi-part
+       bitmap subtitles (#709).
+
 2015-10-05  Carl Hetherington  <cth@carlh.net>
 
        * Version 2.4.0 released.
index c23d56b425e575c83169ae7f2eaffc3f43cbda84..3fdb2f2a95da828d41375aa58bf16dce7898cca3 100644 (file)
@@ -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);