summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-02-12 00:28:25 +0000
committerCarl Hetherington <cth@carlh.net>2016-02-12 00:28:25 +0000
commit4155e64244c9a975a11b491d0a0822fe90abc2f8 (patch)
tree35c9c32d25d07b4c3e5c1eae42675d7a552cfee9 /src/lib
parent80400212e939dc2f3b987cb6df57709929aa5178 (diff)
Basic SSA support (#128).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/text_subtitle.cc14
1 files changed, 12 insertions, 2 deletions
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