Basic SSA support (#128).
authorCarl Hetherington <cth@carlh.net>
Fri, 12 Feb 2016 00:28:25 +0000 (00:28 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 Feb 2016 00:28:25 +0000 (00:28 +0000)
ChangeLog
cscript
src/lib/text_subtitle.cc

index 368935f2d7676ae58ac162239e0c4d0427ac89a8..ac5fe0333efb62b9a07d2e96a3e398a1d6873f6d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-02-12  Carl Hetherington  <cth@carlh.net>
+
+       * Add basic support for SSA (SubStation Alpha) subtitles (#128).
+
 2016-02-09  Carl Hetherington  <cth@carlh.net>
 
        * Version 2.6.20 released.
diff --git a/cscript b/cscript
index 0d54fb467b30caa4cb79b736966d47e95b1c2775..b9b683f04af2dc11ad6026fbe6549f597d5b932a 100644 (file)
--- a/cscript
+++ b/cscript
@@ -281,7 +281,7 @@ def dependencies(target):
 
     return (('ffmpeg-cdist', '96d67de', ffmpeg_options),
             ('libdcp', '4e38f82'),
-            ('libsub', '4e4e5f7'))
+            ('libsub', 'd79b29f'))
 
 def configure_options(target):
     opt = ''
index d55ff68d7e46f3bc1702389ac75b2ea72888382a..7faecb459b4f2b6f7f6f20a2007ea4d77da8fcd3 100644 (file)
@@ -22,6 +22,7 @@
 #include "exceptions.h"
 #include "text_subtitle_content.h"
 #include <sub/subrip_reader.h>
+#include <sub/ssa_reader.h>
 #include <sub/collect.h>
 #include <unicode/ucsdet.h>
 #include <unicode/ucnv.h>
@@ -65,8 +66,17 @@ TextSubtitle::TextSubtitle (shared_ptr<const TextSubtitleContent> content)
        ucnv_close (to_utf16);
        ucnv_close (to_utf8);
 
-       sub::SubripReader reader (utf8.get());
-       _subtitles = sub::collect<vector<sub::Subtitle> > (reader.subtitles ());
+       sub::Reader* reader = 0;
+
+       if (content->path(0).extension() == ".srt" || content->path(0).extension() == ".SRT") {
+               reader = new sub::SubripReader (utf8.get());
+       } else if (content->path(0).extension() == ".ssa" || content->path(0).extension() == ".SSA") {
+               reader = new sub::SSAReader (utf8.get());
+       }
+
+       if (reader) {
+               _subtitles = sub::collect<vector<sub::Subtitle> > (reader->subtitles ());
+       }
 }
 
 ContentTime