diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-10 16:16:51 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-10 16:16:51 +0100 |
| commit | a75132724be4962225e5cb0f5ef5297e2e78aeee (patch) | |
| tree | 8bd6860f89de21e2ec14226a4eb8d1d6ba87aff4 /src/subtitle_content.cc | |
| parent | 1045480655c09c6fdf0d81f5d9714cb218933c19 (diff) | |
Move _intrinsic_duration and _edit_rate up to the MXF class as XML subtitle files do not contain this information (whereas MXF files do).
Diffstat (limited to 'src/subtitle_content.cc')
| -rw-r--r-- | src/subtitle_content.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/subtitle_content.cc b/src/subtitle_content.cc index 85a4b360..12ed2afc 100644 --- a/src/subtitle_content.cc +++ b/src/subtitle_content.cc @@ -43,7 +43,6 @@ using namespace dcp; SubtitleContent::SubtitleContent (boost::filesystem::path file, bool mxf) : Content (file) - , _need_sort (false) { shared_ptr<cxml::Document> xml; @@ -99,12 +98,10 @@ SubtitleContent::SubtitleContent (boost::filesystem::path file, bool mxf) examine_font_nodes (xml, font_nodes, parse_state); } -SubtitleContent::SubtitleContent (Fraction edit_rate, string movie_title, string language) - : Content (edit_rate) - , _movie_title (movie_title) +SubtitleContent::SubtitleContent (string movie_title, string language) + : _movie_title (movie_title) , _reel_number ("1") , _language (language) - , _need_sort (false) { } @@ -223,7 +220,6 @@ void SubtitleContent::add (SubtitleString s) { _subtitles.push_back (s); - _need_sort = true; } struct SubtitleSorter { @@ -277,9 +273,7 @@ SubtitleContent::xml_as_string () const } list<SubtitleString> sorted = _subtitles; - if (_need_sort) { - sorted.sort (SubtitleSorter ()); - } + sorted.sort (SubtitleSorter ()); /* XXX: multiple fonts not supported */ /* XXX: script, underlined, weight not supported */ @@ -366,3 +360,15 @@ SubtitleContent::xml_as_string () const return doc.write_to_string_formatted ("UTF-8"); } +Time +SubtitleContent::latest_subtitle_out () const +{ + Time t; + for (list<SubtitleString>::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) { + if (i->out() > t) { + t = i->out (); + } + } + + return t; +} |
