summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-02-14 00:16:45 +0100
committerCarl Hetherington <cth@carlh.net>2020-02-14 00:25:35 +0100
commit013f6aab443f5b7857871b6f0b6b41f7562bc870 (patch)
treefc2187fb26c90b7ef6911c87b0b31c58c035cd77 /src
parent257f325258866b9241fea68e5aae60adcd679701 (diff)
Support SSA tags in SRT files (DoM #938).
Diffstat (limited to 'src')
-rw-r--r--src/subrip_reader.cc9
-rw-r--r--src/subrip_reader.h4
2 files changed, 8 insertions, 5 deletions
diff --git a/src/subrip_reader.cc b/src/subrip_reader.cc
index 5e41699..beb81e1 100644
--- a/src/subrip_reader.cc
+++ b/src/subrip_reader.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
#include "util.h"
#include "sub_assert.h"
#include "raw_convert.h"
+#include "ssa_reader.h"
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
@@ -69,9 +70,6 @@ SubripReader::read (function<optional<string> ()> get_line)
RawSubtitle rs;
- /* This reader extracts no information about where the subtitle
- should be on screen, so its reference is TOP_OF_SUBTITLE.
- */
rs.vertical_position.line = 0;
rs.vertical_position.reference = TOP_OF_SUBTITLE;
@@ -105,6 +103,7 @@ SubripReader::read (function<optional<string> ()> get_line)
rs.italic = false;
rs.underline = false;
rs.vertical_position.line = 0;
+ rs.vertical_position.reference = TOP_OF_SUBTITLE;
}
break;
case METADATA:
@@ -266,6 +265,8 @@ SubripReader::convert_line (string t, RawSubtitle& p)
SUB_ASSERT (!colours.empty());
colours.pop_back ();
p.colour = colours.back ();
+ } else if (tag.size() > 0 && tag[0] == '\\') {
+ SSAReader::parse_style (p, tag, 288, 288);
}
tag.clear ();
state = TEXT;
diff --git a/src/subrip_reader.h b/src/subrip_reader.h
index f6586a4..f45e7c8 100644
--- a/src/subrip_reader.h
+++ b/src/subrip_reader.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +30,7 @@
struct subrip_reader_convert_line_test;
struct subrip_reader_convert_time_test;
struct subrip_reader_test5;
+struct subrip_reader_test6;
namespace sub {
@@ -44,6 +45,7 @@ private:
friend struct ::subrip_reader_convert_line_test;
friend struct ::subrip_reader_convert_time_test;
friend struct ::subrip_reader_test5;
+ friend struct ::subrip_reader_test6;
SubripReader () {}
Time convert_time (std::string t);