PlainText -> PlainTextFile.
authorCarl Hetherington <cth@carlh.net>
Thu, 19 Jul 2018 13:36:04 +0000 (14:36 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 19 Jul 2018 22:45:23 +0000 (23:45 +0100)
27 files changed:
src/lib/content_factory.cc
src/lib/decoder_factory.cc
src/lib/plain_text.cc [deleted file]
src/lib/plain_text.h [deleted file]
src/lib/plain_text_content.cc [deleted file]
src/lib/plain_text_content.h [deleted file]
src/lib/plain_text_decoder.cc [deleted file]
src/lib/plain_text_decoder.h [deleted file]
src/lib/plain_text_file.cc [new file with mode: 0644]
src/lib/plain_text_file.h [new file with mode: 0644]
src/lib/plain_text_file_content.cc [new file with mode: 0644]
src/lib/plain_text_file_content.h [new file with mode: 0644]
src/lib/plain_text_file_decoder.cc [new file with mode: 0644]
src/lib/plain_text_file_decoder.h [new file with mode: 0644]
src/lib/wscript
src/wx/content_panel.cc
src/wx/subtitle_appearance_dialog.cc
src/wx/subtitle_panel.cc
src/wx/subtitle_view.cc
src/wx/timing_panel.cc
test/ffmpeg_encoder_test.cc
test/player_test.cc
test/reels_test.cc
test/srt_subtitle_test.cc
test/ssa_subtitle_test.cc
test/subtitle_charset_test.cc
test/subtitle_reel_number_test.cc

index 4e8880ffe2645ebe91d479264f225adfbc0d4c71..167b3f4e929cbceffe29507ebaed609d0d5af5e7 100644 (file)
@@ -26,7 +26,7 @@
 #include "audio_content.h"
 #include "image_content.h"
 #include "atmos_mxf_content.h"
-#include "plain_text_content.h"
+#include "plain_text_file_content.h"
 #include "dcp_content.h"
 #include "dcp_text_content.h"
 #include "util.h"
@@ -88,7 +88,7 @@ content_factory (shared_ptr<const Film> film, cxml::NodePtr node, int version, l
                        );
 
        } else if (type == "SubRip" || type == "TextSubtitle") {
-               content.reset (new PlainTextContent (film, node, version));
+               content.reset (new PlainTextFileContent (film, node, version));
        } else if (type == "DCP") {
                content.reset (new DCPContent (film, node, version));
        } else if (type == "DCPSubtitle") {
@@ -210,7 +210,7 @@ content_factory (shared_ptr<const Film> film, boost::filesystem::path path)
                if (valid_image_file (path)) {
                        single.reset (new ImageContent (film, path));
                } else if (ext == ".srt" || ext == ".ssa" || ext == ".ass") {
-                       single.reset (new PlainTextContent (film, path));
+                       single.reset (new PlainTextFileContent (film, path));
                } else if (ext == ".xml") {
                        cxml::Document doc;
                        doc.read_file (path);
index 73a5b66fe44dfd31937c7e0c58eb5f65a0f0e264..a7367dd244ad709adefe5226c63335b43a237e26 100644 (file)
@@ -24,8 +24,8 @@
 #include "dcp_decoder.h"
 #include "image_content.h"
 #include "image_decoder.h"
-#include "plain_text_content.h"
-#include "plain_text_decoder.h"
+#include "plain_text_file_content.h"
+#include "plain_text_file_decoder.h"
 #include "dcp_text_content.h"
 #include "dcp_text_decoder.h"
 #include "video_mxf_content.h"
@@ -54,9 +54,9 @@ decoder_factory (shared_ptr<const Content> content, shared_ptr<Log> log, bool fa
                return shared_ptr<Decoder> (new ImageDecoder (ic, log));
        }
 
-       shared_ptr<const PlainTextContent> rc = dynamic_pointer_cast<const PlainTextContent> (content);
+       shared_ptr<const PlainTextFileContent> rc = dynamic_pointer_cast<const PlainTextFileContent> (content);
        if (rc) {
-               return shared_ptr<Decoder> (new PlainTextDecoder (rc, log));
+               return shared_ptr<Decoder> (new PlainTextFileDecoder (rc, log));
        }
 
        shared_ptr<const DCPTextContent> dsc = dynamic_pointer_cast<const DCPTextContent> (content);
diff --git a/src/lib/plain_text.cc b/src/lib/plain_text.cc
deleted file mode 100644 (file)
index 58035a0..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic 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.
-
-    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "plain_text.h"
-#include "cross.h"
-#include "exceptions.h"
-#include "plain_text_content.h"
-#include <sub/subrip_reader.h>
-#include <sub/ssa_reader.h>
-#include <sub/collect.h>
-#include <unicode/ucsdet.h>
-#include <unicode/ucnv.h>
-#include <iostream>
-
-#include "i18n.h"
-
-using std::vector;
-using std::cout;
-using std::string;
-using boost::shared_ptr;
-using boost::scoped_array;
-using boost::optional;
-using dcp::Data;
-
-PlainText::PlainText (shared_ptr<const PlainTextContent> content)
-{
-       Data in (content->path (0));
-
-       UErrorCode status = U_ZERO_ERROR;
-       UCharsetDetector* detector = ucsdet_open (&status);
-       ucsdet_setText (detector, reinterpret_cast<const char *> (in.data().get()), in.size(), &status);
-
-       UCharsetMatch const * match = ucsdet_detect (detector, &status);
-       char const * in_charset = ucsdet_getName (match, &status);
-
-       UConverter* to_utf16 = ucnv_open (in_charset, &status);
-       /* This is a guess; I think we should be able to encode any input in 4 times its input size */
-       scoped_array<uint16_t> utf16 (new uint16_t[in.size() * 2]);
-       int const utf16_len = ucnv_toUChars (
-               to_utf16, reinterpret_cast<UChar*>(utf16.get()), in.size() * 2,
-               reinterpret_cast<const char *> (in.data().get()), in.size(),
-               &status
-               );
-
-       UConverter* to_utf8 = ucnv_open ("UTF-8", &status);
-       /* Another guess */
-       scoped_array<char> utf8 (new char[utf16_len * 2]);
-       ucnv_fromUChars (to_utf8, utf8.get(), utf16_len * 2, reinterpret_cast<UChar*>(utf16.get()), utf16_len, &status);
-
-       /* Fix OS X line endings */
-       size_t utf8_len = strlen (utf8.get ());
-       for (size_t i = 0; i < utf8_len; ++i) {
-               if (utf8[i] == '\r' && ((i == utf8_len - 1) || utf8[i + 1] != '\n')) {
-                       utf8[i] = '\n';
-               }
-       }
-
-       ucsdet_close (detector);
-       ucnv_close (to_utf16);
-       ucnv_close (to_utf8);
-
-       sub::Reader* reader = 0;
-
-       string ext = content->path(0).extension().string();
-       transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
-
-       if (ext == ".srt") {
-               reader = new sub::SubripReader (utf8.get());
-       } else if (ext == ".ssa" || ext == ".ass") {
-               reader = new sub::SSAReader (utf8.get());
-       }
-
-       if (reader) {
-               _subtitles = sub::collect<vector<sub::Subtitle> > (reader->subtitles ());
-       }
-
-       delete reader;
-}
-
-/** @return time of first subtitle, if there is one */
-optional<ContentTime>
-PlainText::first () const
-{
-       if (_subtitles.empty()) {
-               return optional<ContentTime>();
-       }
-
-       return ContentTime::from_seconds(_subtitles[0].from.all_as_seconds());
-}
-
-ContentTime
-PlainText::length () const
-{
-       if (_subtitles.empty ()) {
-               return ContentTime ();
-       }
-
-       return ContentTime::from_seconds (_subtitles.back().to.all_as_seconds ());
-}
diff --git a/src/lib/plain_text.h b/src/lib/plain_text.h
deleted file mode 100644 (file)
index 01d3d77..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-    Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic 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.
-
-    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef DCPOMATIC_TEXT_SUBTITLE_H
-#define DCPOMATIC_TEXT_SUBTITLE_H
-
-#include "dcpomatic_time.h"
-#include <sub/subtitle.h>
-#include <boost/shared_ptr.hpp>
-#include <vector>
-
-class PlainTextContent;
-class plain_text_time_test;
-class plain_text_coordinate_test;
-class plain_text_content_test;
-class plain_text_parse_test;
-
-class PlainText
-{
-public:
-       explicit PlainText (boost::shared_ptr<const PlainTextContent>);
-
-       boost::optional<ContentTime> first () const;
-       ContentTime length () const;
-
-protected:
-       std::vector<sub::Subtitle> _subtitles;
-};
-
-#endif
diff --git a/src/lib/plain_text_content.cc b/src/lib/plain_text_content.cc
deleted file mode 100644 (file)
index a07dcb6..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic 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.
-
-    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "plain_text_content.h"
-#include "util.h"
-#include "plain_text.h"
-#include "film.h"
-#include "font.h"
-#include "text_content.h"
-#include <dcp/raw_convert.h>
-#include <libxml++/libxml++.h>
-#include <iostream>
-
-#include "i18n.h"
-
-using std::string;
-using std::cout;
-using boost::shared_ptr;
-using dcp::raw_convert;
-
-PlainTextContent::PlainTextContent (shared_ptr<const Film> film, boost::filesystem::path path)
-       : Content (film, path)
-{
-       subtitle.reset (new TextContent (this));
-}
-
-PlainTextContent::PlainTextContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
-       : Content (film, node)
-       , _length (node->number_child<ContentTime::Type> ("Length"))
-{
-       subtitle = TextContent::from_xml (this, node, version);
-}
-
-void
-PlainTextContent::examine (boost::shared_ptr<Job> job)
-{
-       Content::examine (job);
-       PlainText s (shared_from_this ());
-
-       /* Default to turning these subtitles on */
-       subtitle->set_use (true);
-
-       boost::mutex::scoped_lock lm (_mutex);
-       _length = s.length ();
-       subtitle->add_font (shared_ptr<Font> (new Font (TEXT_FONT_ID)));
-}
-
-string
-PlainTextContent::summary () const
-{
-       return path_summary() + " " + _("[subtitles]");
-}
-
-string
-PlainTextContent::technical_summary () const
-{
-       return Content::technical_summary() + " - " + _("Text subtitles");
-}
-
-void
-PlainTextContent::as_xml (xmlpp::Node* node, bool with_paths) const
-{
-       node->add_child("Type")->add_child_text ("TextSubtitle");
-       Content::as_xml (node, with_paths);
-
-       if (subtitle) {
-               subtitle->as_xml (node);
-       }
-
-       node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ()));
-}
-
-DCPTime
-PlainTextContent::full_length () const
-{
-       FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate ());
-       return DCPTime (_length, frc);
-}
diff --git a/src/lib/plain_text_content.h b/src/lib/plain_text_content.h
deleted file mode 100644 (file)
index 02b4596..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-    Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic 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.
-
-    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "content.h"
-
-class Job;
-
-/** @class PlainText
- *  @brief SubRip or SSA subtitles.
- */
-class PlainTextContent : public Content
-{
-public:
-       PlainTextContent (boost::shared_ptr<const Film>, boost::filesystem::path);
-       PlainTextContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
-
-       boost::shared_ptr<PlainTextContent> shared_from_this () {
-               return boost::dynamic_pointer_cast<PlainTextContent> (Content::shared_from_this ());
-       }
-
-       void examine (boost::shared_ptr<Job>);
-       std::string summary () const;
-       std::string technical_summary () const;
-       void as_xml (xmlpp::Node *, bool with_paths) const;
-       DCPTime full_length () const;
-
-private:
-       ContentTime _length;
-};
diff --git a/src/lib/plain_text_decoder.cc b/src/lib/plain_text_decoder.cc
deleted file mode 100644 (file)
index 005d306..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-    Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic 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.
-
-    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "plain_text_decoder.h"
-#include "plain_text_content.h"
-#include "text_content.h"
-#include <dcp/subtitle_string.h>
-#include <boost/foreach.hpp>
-#include <iostream>
-
-using std::list;
-using std::vector;
-using std::string;
-using std::cout;
-using std::max;
-using boost::shared_ptr;
-using boost::optional;
-using boost::dynamic_pointer_cast;
-
-PlainTextDecoder::PlainTextDecoder (shared_ptr<const PlainTextContent> content, shared_ptr<Log> log)
-       : PlainText (content)
-       , _next (0)
-{
-       ContentTime first;
-       if (!_subtitles.empty()) {
-               first = content_time_period(_subtitles[0]).from;
-       }
-       subtitle.reset (new TextDecoder (this, content->subtitle, log, first));
-}
-
-void
-PlainTextDecoder::seek (ContentTime time, bool accurate)
-{
-       /* It's worth back-tracking a little here as decoding is cheap and it's nice if we don't miss
-          too many subtitles when seeking.
-       */
-       time -= ContentTime::from_seconds (5);
-       if (time < ContentTime()) {
-               time = ContentTime();
-       }
-
-       Decoder::seek (time, accurate);
-
-       _next = 0;
-       while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) {
-               ++_next;
-       }
-}
-
-bool
-PlainTextDecoder::pass ()
-{
-       if (_next >= _subtitles.size ()) {
-               return true;
-       }
-
-       ContentTimePeriod const p = content_time_period (_subtitles[_next]);
-       subtitle->emit_plain (p, _subtitles[_next]);
-
-       ++_next;
-       return false;
-}
-
-ContentTimePeriod
-PlainTextDecoder::content_time_period (sub::Subtitle s) const
-{
-       return ContentTimePeriod (
-               ContentTime::from_seconds (s.from.all_as_seconds()),
-               ContentTime::from_seconds (s.to.all_as_seconds())
-               );
-}
diff --git a/src/lib/plain_text_decoder.h b/src/lib/plain_text_decoder.h
deleted file mode 100644 (file)
index f11fe3e..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-    Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic 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.
-
-    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef DCPOMATIC_TEXT_SUBTITLE_DECODER_H
-#define DCPOMATIC_TEXT_SUBTITLE_DECODER_H
-
-#include "text_decoder.h"
-#include "plain_text.h"
-
-class PlainText;
-
-class PlainTextDecoder : public Decoder, public PlainText
-{
-public:
-       PlainTextDecoder (boost::shared_ptr<const PlainTextContent>, boost::shared_ptr<Log> log);
-
-       void seek (ContentTime time, bool accurate);
-       bool pass ();
-
-private:
-       ContentTimePeriod content_time_period (sub::Subtitle s) const;
-
-       size_t _next;
-};
-
-#endif
diff --git a/src/lib/plain_text_file.cc b/src/lib/plain_text_file.cc
new file mode 100644 (file)
index 0000000..4ed1349
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic 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.
+
+    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "plain_text_file.h"
+#include "cross.h"
+#include "exceptions.h"
+#include "plain_text_file_content.h"
+#include <sub/subrip_reader.h>
+#include <sub/ssa_reader.h>
+#include <sub/collect.h>
+#include <unicode/ucsdet.h>
+#include <unicode/ucnv.h>
+#include <iostream>
+
+#include "i18n.h"
+
+using std::vector;
+using std::cout;
+using std::string;
+using boost::shared_ptr;
+using boost::scoped_array;
+using boost::optional;
+using dcp::Data;
+
+PlainTextFile::PlainTextFile (shared_ptr<const PlainTextFileContent> content)
+{
+       Data in (content->path (0));
+
+       UErrorCode status = U_ZERO_ERROR;
+       UCharsetDetector* detector = ucsdet_open (&status);
+       ucsdet_setText (detector, reinterpret_cast<const char *> (in.data().get()), in.size(), &status);
+
+       UCharsetMatch const * match = ucsdet_detect (detector, &status);
+       char const * in_charset = ucsdet_getName (match, &status);
+
+       UConverter* to_utf16 = ucnv_open (in_charset, &status);
+       /* This is a guess; I think we should be able to encode any input in 4 times its input size */
+       scoped_array<uint16_t> utf16 (new uint16_t[in.size() * 2]);
+       int const utf16_len = ucnv_toUChars (
+               to_utf16, reinterpret_cast<UChar*>(utf16.get()), in.size() * 2,
+               reinterpret_cast<const char *> (in.data().get()), in.size(),
+               &status
+               );
+
+       UConverter* to_utf8 = ucnv_open ("UTF-8", &status);
+       /* Another guess */
+       scoped_array<char> utf8 (new char[utf16_len * 2]);
+       ucnv_fromUChars (to_utf8, utf8.get(), utf16_len * 2, reinterpret_cast<UChar*>(utf16.get()), utf16_len, &status);
+
+       /* Fix OS X line endings */
+       size_t utf8_len = strlen (utf8.get ());
+       for (size_t i = 0; i < utf8_len; ++i) {
+               if (utf8[i] == '\r' && ((i == utf8_len - 1) || utf8[i + 1] != '\n')) {
+                       utf8[i] = '\n';
+               }
+       }
+
+       ucsdet_close (detector);
+       ucnv_close (to_utf16);
+       ucnv_close (to_utf8);
+
+       sub::Reader* reader = 0;
+
+       string ext = content->path(0).extension().string();
+       transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
+
+       if (ext == ".srt") {
+               reader = new sub::SubripReader (utf8.get());
+       } else if (ext == ".ssa" || ext == ".ass") {
+               reader = new sub::SSAReader (utf8.get());
+       }
+
+       if (reader) {
+               _subtitles = sub::collect<vector<sub::Subtitle> > (reader->subtitles ());
+       }
+
+       delete reader;
+}
+
+/** @return time of first subtitle, if there is one */
+optional<ContentTime>
+PlainTextFile::first () const
+{
+       if (_subtitles.empty()) {
+               return optional<ContentTime>();
+       }
+
+       return ContentTime::from_seconds(_subtitles[0].from.all_as_seconds());
+}
+
+ContentTime
+PlainTextFile::length () const
+{
+       if (_subtitles.empty ()) {
+               return ContentTime ();
+       }
+
+       return ContentTime::from_seconds (_subtitles.back().to.all_as_seconds ());
+}
diff --git a/src/lib/plain_text_file.h b/src/lib/plain_text_file.h
new file mode 100644 (file)
index 0000000..34dc084
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic 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.
+
+    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef DCPOMATIC_PLAIN_TEXT_FILE_H
+#define DCPOMATIC_PLAIN_TEXT_FILE_H
+
+#include "dcpomatic_time.h"
+#include <sub/subtitle.h>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+class PlainTextFileContent;
+class plain_text_time_test;
+class plain_text_coordinate_test;
+class plain_text_content_test;
+class plain_text_parse_test;
+
+/** @class PlainTextFile
+ *  @brief Base for PlainTextFile decoder and examiner.
+ *
+ *  In fact this is sufficient for the examiner, so it's used as-is rather than deriving
+ *  a pointless PlainTextFileExaminer.
+ */
+class PlainTextFile
+{
+public:
+       explicit PlainTextFile (boost::shared_ptr<const PlainTextFileContent>);
+
+       boost::optional<ContentTime> first () const;
+       ContentTime length () const;
+
+protected:
+       std::vector<sub::Subtitle> _subtitles;
+};
+
+#endif
diff --git a/src/lib/plain_text_file_content.cc b/src/lib/plain_text_file_content.cc
new file mode 100644 (file)
index 0000000..2b52cee
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic 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.
+
+    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "plain_text_file_content.h"
+#include "util.h"
+#include "plain_text_file.h"
+#include "film.h"
+#include "font.h"
+#include "text_content.h"
+#include <dcp/raw_convert.h>
+#include <libxml++/libxml++.h>
+#include <iostream>
+
+#include "i18n.h"
+
+using std::string;
+using std::cout;
+using boost::shared_ptr;
+using dcp::raw_convert;
+
+PlainTextFileContent::PlainTextFileContent (shared_ptr<const Film> film, boost::filesystem::path path)
+       : Content (film, path)
+{
+       subtitle.reset (new TextContent (this));
+}
+
+PlainTextFileContent::PlainTextFileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
+       : Content (film, node)
+       , _length (node->number_child<ContentTime::Type> ("Length"))
+{
+       subtitle = TextContent::from_xml (this, node, version);
+}
+
+void
+PlainTextFileContent::examine (boost::shared_ptr<Job> job)
+{
+       Content::examine (job);
+       PlainTextFile s (shared_from_this ());
+
+       /* Default to turning these subtitles on */
+       subtitle->set_use (true);
+
+       boost::mutex::scoped_lock lm (_mutex);
+       _length = s.length ();
+       subtitle->add_font (shared_ptr<Font> (new Font (TEXT_FONT_ID)));
+}
+
+string
+PlainTextFileContent::summary () const
+{
+       return path_summary() + " " + _("[subtitles]");
+}
+
+string
+PlainTextFileContent::technical_summary () const
+{
+       return Content::technical_summary() + " - " + _("Text subtitles");
+}
+
+void
+PlainTextFileContent::as_xml (xmlpp::Node* node, bool with_paths) const
+{
+       node->add_child("Type")->add_child_text ("TextSubtitle");
+       Content::as_xml (node, with_paths);
+
+       if (subtitle) {
+               subtitle->as_xml (node);
+       }
+
+       node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ()));
+}
+
+DCPTime
+PlainTextFileContent::full_length () const
+{
+       FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate ());
+       return DCPTime (_length, frc);
+}
diff --git a/src/lib/plain_text_file_content.h b/src/lib/plain_text_file_content.h
new file mode 100644 (file)
index 0000000..603931e
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic 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.
+
+    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "content.h"
+
+class Job;
+
+/** @class PlainTextFileContent
+ *  @brief A SubRip, SSA or ASS file.
+ */
+class PlainTextFileContent : public Content
+{
+public:
+       PlainTextFileContent (boost::shared_ptr<const Film>, boost::filesystem::path);
+       PlainTextFileContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
+
+       boost::shared_ptr<PlainTextFileContent> shared_from_this () {
+               return boost::dynamic_pointer_cast<PlainTextFileContent> (Content::shared_from_this ());
+       }
+
+       void examine (boost::shared_ptr<Job>);
+       std::string summary () const;
+       std::string technical_summary () const;
+       void as_xml (xmlpp::Node *, bool with_paths) const;
+       DCPTime full_length () const;
+
+private:
+       ContentTime _length;
+};
diff --git a/src/lib/plain_text_file_decoder.cc b/src/lib/plain_text_file_decoder.cc
new file mode 100644 (file)
index 0000000..40a6059
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic 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.
+
+    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "plain_text_file_decoder.h"
+#include "plain_text_file_content.h"
+#include "text_content.h"
+#include "text_decoder.h"
+#include <dcp/subtitle_string.h>
+#include <boost/foreach.hpp>
+#include <iostream>
+
+using std::list;
+using std::vector;
+using std::string;
+using std::cout;
+using std::max;
+using boost::shared_ptr;
+using boost::optional;
+using boost::dynamic_pointer_cast;
+
+PlainTextFileDecoder::PlainTextFileDecoder (shared_ptr<const PlainTextFileContent> content, shared_ptr<Log> log)
+       : PlainTextFile (content)
+       , _next (0)
+{
+       ContentTime first;
+       if (!_subtitles.empty()) {
+               first = content_time_period(_subtitles[0]).from;
+       }
+       subtitle.reset (new TextDecoder (this, content->subtitle, log, first));
+}
+
+void
+PlainTextFileDecoder::seek (ContentTime time, bool accurate)
+{
+       /* It's worth back-tracking a little here as decoding is cheap and it's nice if we don't miss
+          too many subtitles when seeking.
+       */
+       time -= ContentTime::from_seconds (5);
+       if (time < ContentTime()) {
+               time = ContentTime();
+       }
+
+       Decoder::seek (time, accurate);
+
+       _next = 0;
+       while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) {
+               ++_next;
+       }
+}
+
+bool
+PlainTextFileDecoder::pass ()
+{
+       if (_next >= _subtitles.size ()) {
+               return true;
+       }
+
+       ContentTimePeriod const p = content_time_period (_subtitles[_next]);
+       subtitle->emit_plain (p, _subtitles[_next]);
+
+       ++_next;
+       return false;
+}
+
+ContentTimePeriod
+PlainTextFileDecoder::content_time_period (sub::Subtitle s) const
+{
+       return ContentTimePeriod (
+               ContentTime::from_seconds (s.from.all_as_seconds()),
+               ContentTime::from_seconds (s.to.all_as_seconds())
+               );
+}
diff --git a/src/lib/plain_text_file_decoder.h b/src/lib/plain_text_file_decoder.h
new file mode 100644 (file)
index 0000000..ea64a29
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic 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.
+
+    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef DCPOMATIC_PLAIN_TEXT_FILE_DECODER_H
+#define DCPOMATIC_PLAIN_TEXT_FILE_DECODER_H
+
+#include "plain_text_file.h"
+#include "decoder.h"
+
+class PlainTextFileContent;
+class Log;
+
+class PlainTextFileDecoder : public Decoder, public PlainTextFile
+{
+public:
+       PlainTextFileDecoder (boost::shared_ptr<const PlainTextFileContent>, boost::shared_ptr<Log> log);
+
+       void seek (ContentTime time, bool accurate);
+       bool pass ();
+
+private:
+       ContentTimePeriod content_time_period (sub::Subtitle s) const;
+
+       size_t _next;
+};
+
+#endif
index dd7c87f398d0571a513ea10d4a700fb1a6e3c013..9e2d07d7c97da0204d47fecdda28182ed5f4c9f9 100644 (file)
@@ -134,9 +134,9 @@ sources = """
           string_log_entry.cc
           text_content.cc
           text_decoder.cc
-          plain_text.cc
-          plain_text_content.cc
-          plain_text_decoder.cc
+          plain_text_file.cc
+          plain_text_file_content.cc
+          plain_text_file_decoder.cc
           timer.cc
           transcode_job.cc
           types.cc
index 8a24b21702639675e935b1044ada4fa65cd640bf..70364106cae7aabb22e8eb589569f3bec516d3a8 100644 (file)
@@ -39,8 +39,8 @@
 #include "lib/config.h"
 #include "lib/log.h"
 #include "lib/compose.hpp"
-#include "lib/plain_text_content.h"
-#include "lib/plain_text.h"
+#include "lib/plain_text_file_content.h"
+#include "lib/plain_text_file.h"
 #include <wx/wx.h>
 #include <wx/notebook.h>
 #include <wx/listctrl.h>
@@ -258,11 +258,11 @@ ContentPanel::selection_changed ()
        BOOST_FOREACH (shared_ptr<Content> i, selected ()) {
                DCPTime p;
                p = i->position();
-               if (dynamic_pointer_cast<PlainTextContent>(i) && i->paths_valid()) {
+               if (dynamic_pointer_cast<PlainTextFileContent>(i) && i->paths_valid()) {
                        /* Rather special case; if we select a text subtitle file jump to its
                           first subtitle.
                        */
-                       PlainText ts (dynamic_pointer_cast<PlainTextContent>(i));
+                       PlainTextFile ts (dynamic_pointer_cast<PlainTextFileContent>(i));
                        if (ts.first()) {
                                p += DCPTime(ts.first().get(), _film->active_frame_rate_change(i->position()));
                        }
index eb13a8f2762bf2ae610f5d35c4be617d97a2fab1..77109909f52fd0347019c33b3348f23287a3d8e1 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "subtitle_appearance_dialog.h"
 #include "rgba_colour_picker.h"
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file_content.h"
 #include "lib/text_content.h"
 #include "lib/ffmpeg_subtitle_stream.h"
 #include "lib/ffmpeg_content.h"
index 3308f40e9d70129425baab41256a7e1be0109d72..84c02c42835304fa41529bbf1f5f7bda982a5d2f 100644 (file)
 #include "fonts_dialog.h"
 #include "subtitle_appearance_dialog.h"
 #include "lib/ffmpeg_content.h"
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file_content.h"
 #include "lib/ffmpeg_subtitle_stream.h"
 #include "lib/dcp_text_content.h"
-#include "lib/plain_text_decoder.h"
+#include "lib/plain_text_file_decoder.h"
 #include "lib/dcp_text_decoder.h"
 #include "lib/dcp_content.h"
 #include "lib/text_content.h"
@@ -265,7 +265,7 @@ SubtitlePanel::setup_sensitivity ()
        BOOST_FOREACH (shared_ptr<Content> i, sel) {
                /* These are the content types that could include subtitles */
                shared_ptr<const FFmpegContent> fc = boost::dynamic_pointer_cast<const FFmpegContent> (i);
-               shared_ptr<const PlainText> sc = boost::dynamic_pointer_cast<const PlainText> (i);
+               shared_ptr<const PlainTextFileContent> sc = boost::dynamic_pointer_cast<const PlainTextFileContent> (i);
                shared_ptr<const DCPContent> dc = boost::dynamic_pointer_cast<const DCPContent> (i);
                shared_ptr<const DCPTextContent> dsc = boost::dynamic_pointer_cast<const DCPTextContent> (i);
                if (fc) {
index a3d06106c578514ac77cc5a9a819d1466db9c606..b2e74eb88b56d985e706f8cf4051a9d1eadaa15c 100644 (file)
 
 */
 
-#include "lib/plain_text_decoder.h"
+#include "lib/plain_text_file_decoder.h"
 #include "lib/content_text.h"
 #include "lib/video_decoder.h"
 #include "lib/audio_decoder.h"
 #include "lib/film.h"
 #include "lib/config.h"
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file_content.h"
+#include "lib/text_decoder.h"
 #include "subtitle_view.h"
 #include "film_viewer.h"
 #include "wx_util.h"
index 67a6596854c2df08c04d1adf01128b03f03e9e25..93ac0278438bac6ff8932f4e0ecaa094fc123be3 100644 (file)
@@ -29,7 +29,7 @@
 #include "lib/text_content.h"
 #include "lib/dcp_text_content.h"
 #include "lib/audio_content.h"
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file_content.h"
 #include "lib/video_content.h"
 #include <dcp/locale_convert.h>
 #include <boost/foreach.hpp>
index e579621c69eaa81869833579affaa31b41ee451a..00ca976e0e6fd364d1d8a1dc46a21af69c7c41e9 100644 (file)
@@ -24,7 +24,7 @@
 #include "lib/image_content.h"
 #include "lib/video_content.h"
 #include "lib/audio_content.h"
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file_content.h"
 #include "lib/ratio.h"
 #include "lib/transcode_job.h"
 #include "lib/dcp_content.h"
@@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test6)
        film->set_container (Ratio::from_id ("185"));
        film->set_audio_channels (6);
 
-       shared_ptr<PlainTextContent> s (new PlainTextContent (film, "test/data/subrip2.srt"));
+       shared_ptr<PlainTextFileContent> s (new PlainTextFileContent (film, "test/data/subrip2.srt"));
        film->examine_and_add_content (s);
        BOOST_REQUIRE (!wait_for_jobs ());
        s->subtitle->set_colour (dcp::Colour (255, 255, 0));
@@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test7)
        film->examine_and_add_content (c);
        BOOST_REQUIRE (!wait_for_jobs ());
 
-       shared_ptr<PlainTextContent> s (new PlainTextContent (film, "test/data/subrip.srt"));
+       shared_ptr<PlainTextFileContent> s (new PlainTextFileContent (film, "test/data/subrip.srt"));
        film->examine_and_add_content (s);
        BOOST_REQUIRE (!wait_for_jobs ());
        s->subtitle->set_colour (dcp::Colour (255, 255, 0));
@@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test2)
        film->set_container (Ratio::from_id ("185"));
        film->set_audio_channels (6);
 
-       shared_ptr<PlainTextContent> s (new PlainTextContent (film, "test/data/subrip2.srt"));
+       shared_ptr<PlainTextFileContent> s (new PlainTextFileContent (film, "test/data/subrip2.srt"));
        film->examine_and_add_content (s);
        BOOST_REQUIRE (!wait_for_jobs ());
        s->subtitle->set_colour (dcp::Colour (255, 255, 0));
@@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3)
        film->examine_and_add_content (c);
        BOOST_REQUIRE (!wait_for_jobs ());
 
-       shared_ptr<PlainTextContent> s (new PlainTextContent (film, "test/data/subrip.srt"));
+       shared_ptr<PlainTextFileContent> s (new PlainTextFileContent (film, "test/data/subrip.srt"));
        film->examine_and_add_content (s);
        BOOST_REQUIRE (!wait_for_jobs ());
        s->subtitle->set_colour (dcp::Colour (255, 255, 0));
index 7cc3bc27b0550c39b88f80bb4f8e1e14a629c36d..a66860911bedcfcfaa2b3b60243fafe74f7d8ee2 100644 (file)
@@ -31,7 +31,7 @@
 #include "lib/player.h"
 #include "lib/video_content.h"
 #include "lib/image_content.h"
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file_content.h"
 #include "lib/content_factory.h"
 #include "lib/dcp_content.h"
 #include "lib/text_content.h"
@@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE (player_interleave_test)
        film->examine_and_add_content (c);
        BOOST_REQUIRE (!wait_for_jobs ());
 
-       shared_ptr<PlainTextContent> s (new PlainTextContent (film, "test/data/subrip.srt"));
+       shared_ptr<PlainTextFileContent> s (new PlainTextFileContent (film, "test/data/subrip.srt"));
        film->examine_and_add_content (s);
        BOOST_REQUIRE (!wait_for_jobs ());
 
index 70552a70360eb67bd54d17c842997b1169243bdb..9a915ab2b11cdee1062d50f89b038730426f6ed6 100644 (file)
@@ -30,7 +30,7 @@
 #include "lib/dcp_content_type.h"
 #include "lib/dcp_content.h"
 #include "lib/video_content.h"
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file_content.h"
 #include "lib/content_factory.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
@@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE (reels_test3)
 
        shared_ptr<Content> dcp (new DCPContent (film, "test/data/reels_test2"));
        film->examine_and_add_content (dcp);
-       shared_ptr<Content> sub (new PlainTextContent (film, "test/data/subrip.srt"));
+       shared_ptr<Content> sub (new PlainTextFileContent (film, "test/data/subrip.srt"));
        film->examine_and_add_content (sub);
        wait_for_jobs ();
 
@@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE (reels_test4)
                content[i]->video->set_length (24);
        }
 
-       shared_ptr<PlainTextContent> subs (new PlainTextContent (film, "test/data/subrip3.srt"));
+       shared_ptr<PlainTextFileContent> subs (new PlainTextFileContent (film, "test/data/subrip3.srt"));
        film->examine_and_add_content (subs);
        wait_for_jobs ();
 
index e44e33c14972836fd3643105bd2fb489ef024602..268da347258ec14af59601b2dd229963b91547b2 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "lib/film.h"
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/font.h"
 #include "lib/ratio.h"
@@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test)
        film->set_name ("frobozz");
        film->set_audio_channels (6);
        film->set_interop (false);
-       shared_ptr<PlainTextContent> content (new PlainTextContent (film, "test/data/subrip2.srt"));
+       shared_ptr<PlainTextFileContent> content (new PlainTextFileContent (film, "test/data/subrip2.srt"));
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test2)
        film->set_name ("frobozz");
        film->set_audio_channels (6);
        film->set_interop (false);
-       shared_ptr<PlainTextContent> content (new PlainTextContent (film, "test/data/subrip2.srt"));
+       shared_ptr<PlainTextFileContent> content (new PlainTextFileContent (film, "test/data/subrip2.srt"));
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
@@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test3)
        film->set_name ("frobozz");
        film->set_interop (true);
        film->set_audio_channels (6);
-       shared_ptr<PlainTextContent> content (new PlainTextContent (film, private_data / "Ankoemmling_short.srt"));
+       shared_ptr<PlainTextFileContent> content (new PlainTextFileContent (film, private_data / "Ankoemmling_short.srt"));
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
@@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test4)
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
        film->set_interop (false);
-       shared_ptr<PlainTextContent> content (new PlainTextContent (film, "test/data/subrip2.srt"));
+       shared_ptr<PlainTextFileContent> content (new PlainTextFileContent (film, "test/data/subrip2.srt"));
        content->subtitle->set_use (true);
        content->subtitle->set_burn (false);
        film->examine_and_add_content (content);
@@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test5)
        film->set_name ("frobozz");
        film->set_interop (true);
        film->set_sequence (false);
-       shared_ptr<PlainTextContent> content (new PlainTextContent (film, "test/data/subrip2.srt"));
+       shared_ptr<PlainTextFileContent> content (new PlainTextFileContent (film, "test/data/subrip2.srt"));
        content->subtitle->set_use (true);
        content->subtitle->set_burn (false);
        film->examine_and_add_content (content);
@@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test6)
 {
        shared_ptr<Film> film = new_test_film2 ("srt_subtitle_test6");
        film->set_interop (false);
-       shared_ptr<PlainTextContent> content (new PlainTextContent (film, "test/data/frames.srt"));
+       shared_ptr<PlainTextFileContent> content (new PlainTextFileContent (film, "test/data/frames.srt"));
        content->subtitle->set_use (true);
        content->subtitle->set_burn (false);
        film->examine_and_add_content (content);
@@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test6)
 BOOST_AUTO_TEST_CASE (srt_subtitle_test4)
 {
        shared_ptr<Film> film = new_test_film ("subrip_render_test");
-       shared_ptr<PlainText> content (new PlainText (film, "test/data/subrip.srt"));
+       shared_ptr<PlainTextFile> content (new PlainTextFile (film, "test/data/subrip.srt"));
        content->examine (shared_ptr<Job> (), true);
        BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds ((3 * 60) + 56.471));
 
index ab15af1397662ebf0f40cf634f8029aa14a72e54..536a3ce6a31c3f379001cbb55f9b655f090d8bea 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "lib/film.h"
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/font.h"
 #include "lib/ratio.h"
@@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE (ssa_subtitle_test1)
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
        film->set_interop (true);
-       shared_ptr<PlainTextContent> content (new PlainTextContent (film, private_data / "DKH_UT_EN20160601def.ssa"));
+       shared_ptr<PlainTextFileContent> content (new PlainTextFileContent (film, private_data / "DKH_UT_EN20160601def.ssa"));
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
index 2b1b97b256883fea83f40ceeddd71d61ac31fa2d..892ea76f5ca0cd1e158f5acfb52d6cba5ea6e7bb 100644 (file)
@@ -22,8 +22,8 @@
 #include "lib/content.h"
 #include "lib/film.h"
 #include "lib/content_factory.h"
-#include "lib/plain_text.h"
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file.h"
+#include "lib/plain_text_file_content.h"
 #include <boost/test/unit_test.hpp>
 
 using boost::shared_ptr;
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE (subtitle_charset_test2)
        shared_ptr<Content> content = content_factory (film, "test/data/osx.srt").front ();
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs ());
-       shared_ptr<PlainText> ts = dynamic_pointer_cast<PlainText> (content);
+       shared_ptr<PlainTextFile> ts = dynamic_pointer_cast<PlainTextFile> (content);
        BOOST_REQUIRE (ts);
        /* Make sure we got the subtitle data from the file */
        BOOST_REQUIRE_EQUAL (content->full_length().get(), 6052032);
index 317f93ff5ed2eccf951f7ca0cf48d420e1280bfa..ee9c8ecc7a2bdc30d704c3bfa22791dd75df54d4 100644 (file)
@@ -18,7 +18,7 @@
 
 */
 
-#include "lib/plain_text_content.h"
+#include "lib/plain_text_file_content.h"
 #include "lib/film.h"
 #include "lib/ratio.h"
 #include "lib/text_content.h"
@@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_number_test)
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
-       shared_ptr<PlainTextContent> content (new PlainTextContent (film, "test/data/subrip5.srt"));
+       shared_ptr<PlainTextFileContent> content (new PlainTextFileContent (film, "test/data/subrip5.srt"));
        film->examine_and_add_content (content);
        BOOST_REQUIRE (!wait_for_jobs ());
        content->subtitle->set_use (true);