diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-02-12 00:28:25 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-02-12 00:28:25 +0000 |
| commit | 4155e64244c9a975a11b491d0a0822fe90abc2f8 (patch) | |
| tree | 35c9c32d25d07b4c3e5c1eae42675d7a552cfee9 | |
| parent | 80400212e939dc2f3b987cb6df57709929aa5178 (diff) | |
Basic SSA support (#128).
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | cscript | 2 | ||||
| -rw-r--r-- | src/lib/text_subtitle.cc | 14 |
3 files changed, 17 insertions, 3 deletions
@@ -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. @@ -281,7 +281,7 @@ def dependencies(target): return (('ffmpeg-cdist', '96d67de', ffmpeg_options), ('libdcp', '4e38f82'), - ('libsub', '4e4e5f7')) + ('libsub', 'd79b29f')) def configure_options(target): opt = '' diff --git a/src/lib/text_subtitle.cc b/src/lib/text_subtitle.cc index d55ff68d7..7faecb459 100644 --- a/src/lib/text_subtitle.cc +++ b/src/lib/text_subtitle.cc @@ -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 |
