X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fssa_reader.cc;h=147f1bad75691a7c2bddd9caee6b9da2b3a27e0d;hb=73740022051f377e3965ac9f8494ae3fbc65da8b;hp=05c908e2c86b3c1bbfef35d940116eea57342298;hpb=53f0390517bbc62401cee85f8ad28754d07a6749;p=libsub.git diff --git a/src/ssa_reader.cc b/src/ssa_reader.cc index 05c908e..147f1ba 100644 --- a/src/ssa_reader.cc +++ b/src/ssa_reader.cc @@ -22,15 +22,14 @@ #include "sub_assert.h" #include "raw_convert.h" #include "subtitle.h" +#include #include #include #include -#include #include #include using std::string; -using std::stringstream; using std::vector; using std::map; using std::cout; @@ -43,7 +42,7 @@ using namespace sub; /** @param s Subtitle string encoded in UTF-8 */ SSAReader::SSAReader (string const & s) { - stringstream str (s); + locked_stringstream str (s); this->read (boost::bind (&get_line_stringstream, &str)); } @@ -61,6 +60,7 @@ public: , primary_colour (255, 255, 255) , bold (false) , italic (false) + , underline (false) , vertical_reference (BOTTOM_OF_SCREEN) , vertical_margin (0) {} @@ -70,6 +70,7 @@ public: , primary_colour (255, 255, 255) , bold (false) , italic (false) + , underline (false) , vertical_reference (BOTTOM_OF_SCREEN) , vertical_margin (0) { @@ -99,6 +100,8 @@ public: bold = style[i] == "-1"; } else if (keys[i] == "Italic") { italic = style[i] == "-1"; + } else if (keys[i] == "Underline") { + underline = style[i] == "-1"; } else if (keys[i] == "BorderStyle") { if (style[i] == "1") { effect = SHADOW; @@ -130,6 +133,7 @@ public: optional back_colour; bool bold; bool italic; + bool underline; optional effect; VerticalReference vertical_reference; int vertical_margin; @@ -243,6 +247,10 @@ SSAReader::parse_line (RawSubtitle base, string line) current.bold = true; } else if (style == "\\b0") { current.bold = false; + } else if (style == "\\u1") { + current.underline = true; + } else if (style == "\\u0") { + current.underline = false; } else if (style == "\\an1" || style == "\\an2" || style == "\\an3") { current.vertical_position.reference = sub::BOTTOM_OF_SCREEN; } else if (style == "\\an4" || style == "\\an5" || style == "\\an6") { @@ -389,6 +397,7 @@ SSAReader::read (function ()> get_line) sub.effect_colour = style.back_colour; sub.bold = style.bold; sub.italic = style.italic; + sub.underline = style.underline; sub.effect = style.effect; sub.vertical_position.reference = style.vertical_reference; sub.vertical_position.proportional = float(style.vertical_margin) / play_res_y;