summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-12-18 14:51:49 +0000
committerCarl Hetherington <cth@carlh.net>2015-12-18 14:51:49 +0000
commit95dc81ecbc031b6ffaee2053884115de4ee4b393 (patch)
treeb6f7fd430fe5de560bc6505eafc9c4e3729e7bed /src
parentc41e0eb748cd39ce6ebe0c7c354e99ccf87a951b (diff)
parent485794f8322b090a22da841961025b19642e42a2 (diff)
Merge branch '1.0' of git.carlh.net:git/libsub into 1.0
Diffstat (limited to 'src')
-rw-r--r--src/dcp_reader.h6
-rw-r--r--src/exceptions.cc30
-rw-r--r--src/exceptions.h47
-rw-r--r--src/font_size.h12
-rw-r--r--src/rational.cc33
-rw-r--r--src/rational.h45
-rw-r--r--src/raw_subtitle.h6
-rw-r--r--src/reader.h2
-rw-r--r--src/reader_factory.cc2
-rw-r--r--src/smpte_dcp_reader.cc8
-rw-r--r--src/stl_binary_tables.cc14
-rw-r--r--src/stl_binary_tables.h6
-rw-r--r--src/stl_binary_writer.cc51
-rw-r--r--src/sub_assert.h22
-rw-r--r--src/sub_time.cc47
-rw-r--r--src/sub_time.h27
-rw-r--r--src/subtitle.cc2
-rw-r--r--src/subtitle.h10
-rw-r--r--src/vertical_position.cc2
-rw-r--r--src/vertical_position.h4
-rw-r--r--src/vertical_reference.cc2
-rw-r--r--src/vertical_reference.h2
-rw-r--r--src/wscript5
-rw-r--r--src/xml.h6
24 files changed, 276 insertions, 115 deletions
diff --git a/src/dcp_reader.h b/src/dcp_reader.h
index f749f82..82a211c 100644
--- a/src/dcp_reader.h
+++ b/src/dcp_reader.h
@@ -38,7 +38,7 @@ namespace dcp {
*/
class DCPReader : public Reader
{
-protected:
+protected:
struct ParseState {
std::list<boost::shared_ptr<dcp::Font> > font_nodes;
@@ -49,11 +49,11 @@ protected:
void parse_common (cxml::NodePtr root, boost::optional<int> tcr);
std::string _id;
-
+
private:
void parse_node (xmlpp::Node const * node, ParseState& parse_state, boost::optional<int> tcr);
void maybe_add_subtitle (std::string text, ParseState const & parse_state);
-
+
std::string _reel_number;
std::string _language;
};
diff --git a/src/exceptions.cc b/src/exceptions.cc
new file mode 100644
index 0000000..4d9d29f
--- /dev/null
+++ b/src/exceptions.cc
@@ -0,0 +1,30 @@
+/*
+ Copyright (C) 2014-2015 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "compose.hpp"
+#include "exceptions.h"
+
+using std::string;
+using namespace sub;
+
+ProgrammingError::ProgrammingError (string file, int line)
+ : runtime_error (String::compose ("Programming error at %1:%2", file, line))
+{
+
+}
diff --git a/src/exceptions.h b/src/exceptions.h
index 62be0d5..c6f7f1a 100644
--- a/src/exceptions.h
+++ b/src/exceptions.h
@@ -25,80 +25,69 @@
namespace sub {
-class MessageError : public std::exception
-{
-public:
- MessageError (std::string const & message)
- : _message (message) {}
- ~MessageError () throw () {}
-
- /** @return error message */
- char const * what () const throw () {
- return _message.c_str ();
- }
-
-private:
- /** error message */
- std::string _message;
-};
-
/** @class XMLError
* @brief An error raised when reading an XML file.
*/
-class XMLError : public MessageError
+class XMLError : public std::runtime_error
{
public:
XMLError (std::string const & message)
- : MessageError (message)
+ : std::runtime_error (message)
{}
};
/** @class STLError
* @brief An error raised when reading a binary STL file.
*/
-class STLError : public MessageError
+class STLError : public std::runtime_error
{
public:
STLError (std::string const & message)
- : MessageError (message)
+ : std::runtime_error (message)
{}
};
/** @class SubripError
* @brief An error raised when reading a Subrip file.
*/
-class SubripError : public MessageError
+class SubripError : public std::runtime_error
{
public:
SubripError (std::string saw, std::string expecting)
- : MessageError ("Error in SubRip file: saw " + saw + " while expecting " + expecting)
+ : std::runtime_error ("Error in SubRip file: saw " + saw + " while expecting " + expecting)
{}
};
-class MXFError : public MessageError
+class MXFError : public std::runtime_error
{
public:
MXFError (std::string const & message)
- : MessageError (message)
+ : std::runtime_error (message)
{}
};
-class UnknownFrameRateError : public MessageError
+class UnknownFrameRateError : public std::runtime_error
{
public:
UnknownFrameRateError ()
- : MessageError ("unknown frame rate")
+ : std::runtime_error ("unknown frame rate")
{}
};
-class DCPError : public MessageError
+class DCPError : public std::runtime_error
{
public:
DCPError (std::string const & message)
- : MessageError (message)
+ : std::runtime_error (message)
{}
};
+class ProgrammingError : public std::runtime_error
+{
+public:
+ ProgrammingError (std::string file, int line);
+};
+
}
#endif
diff --git a/src/font_size.h b/src/font_size.h
index 6f4f8a5..6439c8f 100644
--- a/src/font_size.h
+++ b/src/font_size.h
@@ -36,7 +36,7 @@ public:
void set_proportional (float p) {
_proportional = p;
}
-
+
void set_points (int p) {
_points = p;
}
@@ -44,20 +44,20 @@ public:
boost::optional<float> proportional () const {
return _proportional;
}
-
+
boost::optional<int> points () const {
return _points;
}
-
+
float proportional (int screen_height_in_points) const;
int points (int screen_height_in_points) const;
-
-private:
+
+private:
/** as a proportion of screen height */
boost::optional<float> _proportional;
/** in points */
boost::optional<int> _points;
-
+
};
}
diff --git a/src/rational.cc b/src/rational.cc
new file mode 100644
index 0000000..09dadab
--- /dev/null
+++ b/src/rational.cc
@@ -0,0 +1,33 @@
+/*
+ Copyright (C) 2014-2015 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "rational.h"
+
+using namespace sub;
+
+bool sub::operator== (Rational const & a, Rational const & b)
+{
+ return (a.numerator == b.numerator && a.denominator == b.denominator);
+}
+
+bool
+Rational::integer () const
+{
+ return (numerator % denominator) == 0;
+}
diff --git a/src/rational.h b/src/rational.h
new file mode 100644
index 0000000..7ff71c0
--- /dev/null
+++ b/src/rational.h
@@ -0,0 +1,45 @@
+/*
+ Copyright (C) 2014-2015 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+namespace sub {
+
+class Rational
+{
+public:
+ Rational (int numerator_, int denominator_)
+ : numerator (numerator_)
+ , denominator (denominator_)
+ {}
+
+ int numerator;
+ int denominator;
+
+ double fraction () const {
+ return double (numerator) / denominator;
+ }
+
+ bool integer () const;
+ int integer_fraction () const {
+ return numerator / denominator;
+ }
+};
+
+bool operator== (Rational const & a, Rational const & b);
+
+}
diff --git a/src/raw_subtitle.h b/src/raw_subtitle.h
index a27329a..2a202c1 100644
--- a/src/raw_subtitle.h
+++ b/src/raw_subtitle.h
@@ -54,7 +54,7 @@ public:
boost::optional<Effect> effect;
boost::optional<Colour> effect_colour;
-
+
Colour colour;
bool bold; ///< true to use a bold version of font
bool italic; ///< true to use an italic version of font
@@ -67,12 +67,12 @@ public:
Time from;
/** to time */
Time to;
-
+
boost::optional<Time> fade_up;
boost::optional<Time> fade_down;
};
-bool operator< (RawSubtitle const &, RawSubtitle const &);
+bool operator< (RawSubtitle const &, RawSubtitle const &);
}
diff --git a/src/reader.h b/src/reader.h
index 091df61..08474f6 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -36,7 +36,7 @@ class Reader
{
public:
virtual ~Reader () {}
-
+
std::list<RawSubtitle> subtitles () const {
return _subs;
}
diff --git a/src/reader_factory.cc b/src/reader_factory.cc
index 05634c0..6c0259d 100644
--- a/src/reader_factory.cc
+++ b/src/reader_factory.cc
@@ -50,7 +50,7 @@ sub::reader_factory (boost::filesystem::path file_name)
return shared_ptr<Reader> (new SMPTEDCPReader (file_name, false));
}
}
-
+
if (ext == ".mxf") {
/* Assume this is some MXF-wrapped SMPTE subtitles */
return shared_ptr<Reader> (new SMPTEDCPReader (file_name, true));
diff --git a/src/smpte_dcp_reader.cc b/src/smpte_dcp_reader.cc
index 6014196..606d9e5 100644
--- a/src/smpte_dcp_reader.cc
+++ b/src/smpte_dcp_reader.cc
@@ -36,14 +36,14 @@ using namespace sub;
SMPTEDCPReader::SMPTEDCPReader (boost::filesystem::path file, bool mxf)
{
shared_ptr<cxml::Document> xml (new cxml::Document ("SubtitleReel"));
-
+
if (mxf) {
ASDCP::TimedText::MXFReader reader;
Kumu::Result_t r = reader.OpenRead (file.string().c_str ());
if (ASDCP_FAILURE (r)) {
boost::throw_exception (MXFError ("could not open MXF file for reading"));
}
-
+
string s;
reader.ReadTimedTextResource (s, 0, 0);
stringstream t;
@@ -52,7 +52,7 @@ SMPTEDCPReader::SMPTEDCPReader (boost::filesystem::path file, bool mxf)
ASDCP::WriterInfo info;
reader.FillWriterInfo (info);
-
+
char buffer[64];
Kumu::bin2UUIDhex (info.AssetUUID, ASDCP::UUIDlen, buffer, sizeof (buffer));
_id = buffer;
@@ -60,7 +60,7 @@ SMPTEDCPReader::SMPTEDCPReader (boost::filesystem::path file, bool mxf)
xml->read_file (file);
_id = xml->string_child("Id").substr (9);
}
-
+
_load_font_nodes = type_children<dcp::SMPTELoadFont> (xml, "LoadFont");
parse_common (xml, xml->number_child<int> ("TimeCodeRate"));
diff --git a/src/stl_binary_tables.cc b/src/stl_binary_tables.cc
index 9aaf4b8..db623bf 100644
--- a/src/stl_binary_tables.cc
+++ b/src/stl_binary_tables.cc
@@ -19,8 +19,8 @@
#include "stl_binary_tables.h"
#include "exceptions.h"
+#include "sub_assert.h"
#include "compose.hpp"
-#include <cassert>
using std::map;
using std::string;
@@ -55,7 +55,7 @@ enum_to_file (E k, map<F, STLBinaryCode<E> > m)
}
}
- assert (false);
+ SUB_ASSERT (false);
return F ();
}
@@ -84,7 +84,7 @@ description_to_enum (string d, map<F, STLBinaryCode<E> > const & m)
return boost::optional<E> ();
}
-
+
DisplayStandard
STLBinaryTables::display_standard_file_to_enum (string s) const
{
@@ -150,13 +150,13 @@ STLBinaryTables::comment_enum_to_file (Comment v) const
{
return enum_to_file (v, _comment_map);
}
-
+
string
STLBinaryTables::display_standard_enum_to_description (DisplayStandard v) const
{
return enum_to_description (v, _display_standard_map);
}
-
+
string
STLBinaryTables::language_group_enum_to_description (LanguageGroup v) const
{
@@ -205,13 +205,13 @@ STLBinaryTables::STLBinaryTables ()
code<DisplayStandard, string> (_display_standard_map, "0", DISPLAY_STANDARD_OPEN_SUBTITLING, "Open subtitling");
code<DisplayStandard, string> (_display_standard_map, "1", DISPLAY_STANDARD_LEVEL_1_TELETEXT, "Level 1 teletext");
code<DisplayStandard, string> (_display_standard_map, "2", DISPLAY_STANDARD_LEVEL_2_TELETEXT, "Level 2 teletext");
-
+
code<LanguageGroup, string> (_language_group_map, "00", LANGUAGE_GROUP_LATIN, "Latin");
code<LanguageGroup, string> (_language_group_map, "01", LANGUAGE_GROUP_LATIN_CYRILLIC, "Latin/Cyrillic");
code<LanguageGroup, string> (_language_group_map, "02", LANGUAGE_GROUP_LATIN_ARABIC, "Latin/Arabic");
code<LanguageGroup, string> (_language_group_map, "03", LANGUAGE_GROUP_LATIN_GREEK, "Latin/Greek");
code<LanguageGroup, string> (_language_group_map, "04", LANGUAGE_GROUP_LATIN_HEBREW, "Latin/Hebrew");
-
+
code<Language, string> (_language_map, "00", LANGUAGE_UNKNOWN, "Unknown");
code<Language, string> (_language_map, "01", LANGUAGE_ALBANIAN, "Albanian");
code<Language, string> (_language_map, "02", LANGUAGE_BRETON, "Breton");
diff --git a/src/stl_binary_tables.h b/src/stl_binary_tables.h
index adaae82..4a6a7d8 100644
--- a/src/stl_binary_tables.h
+++ b/src/stl_binary_tables.h
@@ -32,7 +32,7 @@ enum DisplayStandard {
DISPLAY_STANDARD_LEVEL_1_TELETEXT,
DISPLAY_STANDARD_LEVEL_2_TELETEXT
};
-
+
enum LanguageGroup {
LANGUAGE_GROUP_LATIN,
LANGUAGE_GROUP_LATIN_CYRILLIC,
@@ -186,7 +186,7 @@ public:
: value (v)
, description (d)
{}
-
+
T value;
std::string description;
};
@@ -222,7 +222,7 @@ public:
boost::optional<Language> language_description_to_enum (std::string) const;
-private:
+private:
std::map<std::string, STLBinaryCode<DisplayStandard> > _display_standard_map;
std::map<std::string, STLBinaryCode<LanguageGroup> > _language_group_map;
std::map<std::string, STLBinaryCode<Language> > _language_map;
diff --git a/src/stl_binary_writer.cc b/src/stl_binary_writer.cc
index 43b0adf..aa8943c 100644
--- a/src/stl_binary_writer.cc
+++ b/src/stl_binary_writer.cc
@@ -26,6 +26,7 @@
#include "iso6937.h"
#include "stl_util.h"
#include "compose.hpp"
+#include "sub_assert.h"
#include <boost/locale.hpp>
#include <list>
#include <cmath>
@@ -62,8 +63,8 @@ put_string (char* p, string s)
static void
put_string (char* p, unsigned int n, string s)
{
- assert (s.length() <= n);
-
+ SUB_ASSERT (s.length() <= n);
+
memcpy (p, s.c_str (), s.length ());
memset (p + s.length(), ' ', n - s.length ());
}
@@ -76,7 +77,7 @@ put_int_as_string (char* p, int v, unsigned int n)
s.imbue (std::locale::classic ());
s << setw (n) << setfill ('0');
s << v;
- assert (s.str().length() == n);
+ SUB_ASSERT (s.str().length() == n);
put_string (p, s.str ());
}
@@ -110,20 +111,20 @@ sub::write_stl_binary (
boost::filesystem::path file_name
)
{
- assert (original_programme_title.size() <= 32);
- assert (original_episode_title.size() <= 32);
- assert (translated_programme_title.size() <= 32);
- assert (translated_episode_title.size() <= 32);
- assert (translator_name.size() <= 32);
- assert (translator_contact_details.size() <= 32);
- assert (creation_date.size() == 6);
- assert (revision_date.size() == 6);
- assert (revision_number <= 99);
- assert (country_of_origin.size() == 3);
- assert (publisher.size() <= 32);
- assert (editor_name.size() <= 32);
- assert (editor_contact_details.size() <= 32);
-
+ SUB_ASSERT (original_programme_title.size() <= 32);
+ SUB_ASSERT (original_episode_title.size() <= 32);
+ SUB_ASSERT (translated_programme_title.size() <= 32);
+ SUB_ASSERT (translated_episode_title.size() <= 32);
+ SUB_ASSERT (translator_name.size() <= 32);
+ SUB_ASSERT (translator_contact_details.size() <= 32);
+ SUB_ASSERT (creation_date.size() == 6);
+ SUB_ASSERT (revision_date.size() == 6);
+ SUB_ASSERT (revision_number <= 99);
+ SUB_ASSERT (country_of_origin.size() == 3);
+ SUB_ASSERT (publisher.size() <= 32);
+ SUB_ASSERT (editor_name.size() <= 32);
+ SUB_ASSERT (editor_contact_details.size() <= 32);
+
char* buffer = new char[1024];
memset (buffer, 0, 1024);
ofstream output (file_name.string().c_str ());
@@ -144,7 +145,7 @@ sub::write_stl_binary (
++lines;
}
}
-
+
/* Code page: 850 */
put_string (buffer + 0, "850");
/* Disk format code */
@@ -256,12 +257,12 @@ sub::write_stl_binary (
put_int_as_int (buffer + 14, tables.justification_enum_to_file (JUSTIFICATION_NONE), 1);
/* Comment flag */
put_int_as_int (buffer + 15, tables.comment_enum_to_file (COMMENT_NO), 1);
-
+
/* Text */
string text;
bool italic = false;
bool underline = false;
-
+
for (list<Block>::const_iterator k = j->blocks.begin(); k != j->blocks.end(); ++k) {
if (k->underline && !underline) {
text += "\x82";
@@ -277,20 +278,20 @@ sub::write_stl_binary (
text += "\x81";
italic = false;
}
-
+
text += utf16_to_iso6937 (utf_to_utf<wchar_t> (k->text));
}
-
+
text += "\x8A";
-
+
if (text.length() > 111) {
text = text.substr (111);
}
-
+
while (text.length() < 112) {
text += "\x8F";
}
-
+
put_string (buffer + 16, text);
output.write (buffer, 128);
diff --git a/src/sub_assert.h b/src/sub_assert.h
new file mode 100644
index 0000000..67c8abe
--- /dev/null
+++ b/src/sub_assert.h
@@ -0,0 +1,22 @@
+/*
+ Copyright (C) 2014 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "exceptions.h"
+
+#define SUB_ASSERT(x) if (!(x)) throw ProgrammingError (__FILE__, __LINE__);
diff --git a/src/sub_time.cc b/src/sub_time.cc
index 68dac19..c4e00ba 100644
--- a/src/sub_time.cc
+++ b/src/sub_time.cc
@@ -18,6 +18,7 @@
*/
#include "sub_time.h"
+#include "sub_assert.h"
#include "exceptions.h"
#include <cmath>
#include <iomanip>
@@ -154,8 +155,54 @@ Time::from_hms (int h, int m, int s, int ms)
return Time (h * 3600 + m * 60 + s, ms, Rational (1000, 1));
}
+/** Create a Time from a number of frames.
+ * rate must be integer.
+ */
+Time
+Time::from_frames (int f, Rational rate)
+{
+ SUB_ASSERT (rate.denominator != 0);
+ SUB_ASSERT (rate.integer ());
+ return Time (f / rate.integer_fraction(), f % rate.integer_fraction(), rate);
+}
+
double
Time::all_as_seconds () const
{
return _seconds + double(milliseconds ()) / 1000;
}
+
+/** Add a time to this one. This time must have an integer _rate
+ * and t must have the same rate.
+ */
+void
+Time::add (Time t)
+{
+ SUB_ASSERT (_rate);
+
+ _seconds += t._seconds;
+ _frames += t._frames;
+
+ SUB_ASSERT (_rate.get().denominator != 0);
+ SUB_ASSERT (_rate.get().integer ());
+
+ if (_frames >= _rate.get().integer_fraction()) {
+ _frames -= _rate.get().integer_fraction();
+ ++_seconds;
+ }
+}
+
+void
+Time::scale (float f)
+{
+ SUB_ASSERT (_rate);
+ SUB_ASSERT (_rate->denominator != 0);
+ SUB_ASSERT (_rate->integer ());
+
+ _seconds = rint (_seconds * f);
+ _frames = rint (_frames * f);
+ if (_frames >= _rate->integer_fraction()) {
+ _frames -= _rate->integer_fraction ();
+ ++_seconds;
+ }
+}
diff --git a/src/sub_time.h b/src/sub_time.h
index 22178e9..93088cb 100644
--- a/src/sub_time.h
+++ b/src/sub_time.h
@@ -20,25 +20,10 @@
#ifndef LIBSUB_SUB_TIME_H
#define LIBSUB_SUB_TIME_H
+#include "rational.h"
#include <boost/optional.hpp>
namespace sub {
-
-class Rational
-{
-public:
- Rational (int numerator_, int denominator_)
- : numerator (numerator_)
- , denominator (denominator_)
- {}
-
- int numerator;
- int denominator;
-
- double fraction () const {
- return double (numerator) / denominator;
- }
-};
class Time
{
@@ -57,9 +42,13 @@ public:
double all_as_seconds () const;
+ void add (Time t);
+ void scale (float f);
+
static Time from_hmsf (int h, int m, int s, int f, boost::optional<Rational> rate = boost::optional<Rational> ());
static Time from_hms (int h, int m, int s, int ms);
-
+ static Time from_frames (int frames, Rational rate);
+
private:
friend bool operator< (Time const & a, Time const & b);
friend bool operator> (Time const & a, Time const & b);
@@ -71,7 +60,7 @@ private:
, _frames (frames)
, _rate (rate)
{}
-
+
int _seconds;
int _frames;
boost::optional<Rational> _rate;
@@ -82,7 +71,7 @@ bool operator> (Time const & a, Time const & b);
bool operator== (Time const & a, Time const & b);
bool operator!= (Time const & a, Time const & b);
std::ostream& operator<< (std::ostream& s, Time const & t);
-
+
}
#endif
diff --git a/src/subtitle.cc b/src/subtitle.cc
index d828628..663c161 100644
--- a/src/subtitle.cc
+++ b/src/subtitle.cc
@@ -59,5 +59,5 @@ Block::Block (RawSubtitle s)
, italic (s.italic)
, underline (s.underline)
{
-
+
}
diff --git a/src/subtitle.h b/src/subtitle.h
index 3906314..2d22dac 100644
--- a/src/subtitle.h
+++ b/src/subtitle.h
@@ -49,7 +49,7 @@ public:
/** Construct a Block taking any relevant information from a RawSubtitle */
Block (RawSubtitle s);
-
+
/** Subtitle text in UTF-8 */
std::string text;
boost::optional<std::string> font;
@@ -59,7 +59,7 @@ public:
boost::optional<Effect> effect;
boost::optional<Colour> effect_colour;
-
+
Colour colour;
bool bold; ///< true to use a bold version of font
bool italic; ///< true to use an italic version of font
@@ -75,7 +75,7 @@ class Line
{
public:
Line () {}
-
+
/** Construct a Line taking any relevant information from a RawSubtitle */
Line (RawSubtitle s);
@@ -101,12 +101,12 @@ public:
/** Construct a Line taking any relevant information from a RawSubtitle */
Subtitle (RawSubtitle s);
-
+
/** from time */
Time from;
/** to time */
Time to;
-
+
boost::optional<Time> fade_up;
boost::optional<Time> fade_down;
diff --git a/src/vertical_position.cc b/src/vertical_position.cc
index 5f7d0d0..9801e4d 100644
--- a/src/vertical_position.cc
+++ b/src/vertical_position.cc
@@ -30,7 +30,7 @@ VerticalPosition::fraction_from_screen_top () const
}
float const prop = proportional ? proportional.get() : (float (line.get()) / lines.get ());
-
+
switch (reference.get ()) {
case TOP_OF_SCREEN:
return prop;
diff --git a/src/vertical_position.h b/src/vertical_position.h
index 9f04056..7bc057e 100644
--- a/src/vertical_position.h
+++ b/src/vertical_position.h
@@ -39,13 +39,13 @@ public:
boost::optional<int> lines;
/** reference point */
boost::optional<VerticalReference> reference;
-
+
bool operator== (VerticalPosition const & other) const;
bool operator< (VerticalPosition const & other) const;
float fraction_from_screen_top () const;
};
-
+
}
#endif
diff --git a/src/vertical_reference.cc b/src/vertical_reference.cc
index 3f9219b..7dff965 100644
--- a/src/vertical_reference.cc
+++ b/src/vertical_reference.cc
@@ -34,6 +34,6 @@ sub::string_to_vertical_reference (string s)
} else if (s == "bottom") {
return BOTTOM_OF_SCREEN;
}
-
+
throw XMLError ("unknown subtitle valign type");
}
diff --git a/src/vertical_reference.h b/src/vertical_reference.h
index 4bdcde8..8f5d899 100644
--- a/src/vertical_reference.h
+++ b/src/vertical_reference.h
@@ -33,7 +33,7 @@ enum VerticalReference
};
VerticalReference string_to_vertical_reference (std::string s);
-
+
}
#endif
diff --git a/src/wscript b/src/wscript
index a054a91..ae53ae6 100644
--- a/src/wscript
+++ b/src/wscript
@@ -15,10 +15,12 @@ def build(bld):
colour.cc
dcp_reader.cc
effect.cc
+ exceptions.cc
font_size.cc
interop_dcp_reader.cc
iso6937.cc
iso6937_tables.cc
+ rational.cc
raw_subtitle.cc
reader.cc
reader_factory.cc
@@ -47,8 +49,11 @@ def build(bld):
dcp_reader.h
effect.h
font_size.h
+ interop_dcp_reader.h
+ rational.h
raw_subtitle.h
reader.h
+ smpte_dcp_reader.h
stl_binary_tables.h
stl_binary_reader.h
stl_binary_writer.h
diff --git a/src/xml.h b/src/xml.h
index d62dbd6..d07188f 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -48,7 +48,7 @@ template <class T>
boost::shared_ptr<T> type_child (boost::shared_ptr<const cxml::Node> node, std::string name) {
return boost::shared_ptr<T> (new T (node->node_child (name)));
}
-
+
template <class T>
boost::shared_ptr<T>
optional_type_child (boost::shared_ptr<const cxml::Node> node, std::string name)
@@ -74,7 +74,7 @@ type_children (boost::shared_ptr<const cxml::Node> node, std::string name)
{
return type_children<T> (*node.get(), name);
}
-
+
template <class T>
std::list<boost::shared_ptr<T> >
type_grand_children (cxml::Node const & node, std::string name, std::string sub)
@@ -89,7 +89,7 @@ type_grand_children (boost::shared_ptr<const cxml::Node> node, std::string name,
{
return type_grand_children<T> (*node.get(), name, sub);
}
-
+
}
#endif