#include "ffmpeg_content.h"
#include "image_content.h"
#include "sndfile_content.h"
-#include "subrip_content.h"
+#include "text_subtitle_content.h"
#include "dcp_content.h"
#include "dcp_subtitle_content.h"
#include "util.h"
content.reset (new ImageContent (film, node, version));
} else if (type == "Sndfile") {
content.reset (new SndfileContent (film, node, version));
- } else if (type == "SubRip") {
- content.reset (new SubRipContent (film, node, version));
+ } else if (type == "SubRip" || type == "TextSubtitle") {
+ content.reset (new TextSubtitleContent (film, node, version));
} else if (type == "DCP") {
content.reset (new DCPContent (film, node, version));
} else if (type == "DCPSubtitle") {
content.reset (new ImageContent (film, path));
} else if (SndfileContent::valid_file (path)) {
content.reset (new SndfileContent (film, path));
- } else if (ext == ".srt") {
- content.reset (new SubRipContent (film, path));
+ } else if (ext == ".srt" || ext == ".ssa") {
+ content.reset (new TextSubtitleContent (film, path));
} else if (ext == ".xml") {
content.reset (new DCPSubtitleContent (film, path));
} else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf (path)) {
}
-SubRipError::SubRipError (string saw, string expecting, boost::filesystem::path f)
- : FileError (String::compose (_("Error in SubRip file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f)
+TextSubtitleError::TextSubtitleError (string saw, string expecting, boost::filesystem::path f)
+ : FileError (String::compose (_("Error in subtitle file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f)
{
}
PixelFormatError (std::string o, AVPixelFormat f);
};
-/** @class SubRipError
- * @brief An error that occurs while parsing a SubRip file.
+/** @class TextSubtitleError
+ * @brief An error that occurs while parsing a TextSubtitleError file.
*/
-class SubRipError : public FileError
+class TextSubtitleError : public FileError
{
public:
- SubRipError (std::string, std::string, boost::filesystem::path);
+ TextSubtitleError (std::string, std::string, boost::filesystem::path);
};
class DCPError : public std::runtime_error
#include "sndfile_decoder.h"
#include "sndfile_content.h"
#include "subtitle_content.h"
-#include "subrip_decoder.h"
-#include "subrip_content.h"
+#include "text_subtitle_decoder.h"
+#include "text_subtitle_content.h"
#include "dcp_content.h"
#include "job.h"
#include "image.h"
as simultaneous video content (like we do with audio).
*/
- /* SubRipContent */
- shared_ptr<const SubRipContent> rc = dynamic_pointer_cast<const SubRipContent> (i);
+ /* TextSubtitleContent */
+ shared_ptr<const TextSubtitleContent> rc = dynamic_pointer_cast<const TextSubtitleContent> (i);
if (rc) {
- decoder.reset (new SubRipDecoder (rc));
+ decoder.reset (new TextSubtitleDecoder (rc));
frc = FrameRateChange (rc->subtitle_video_frame_rate(), _film->video_frame_rate());
}
property == ContentProperty::PATH ||
property == VideoContentProperty::VIDEO_FRAME_TYPE ||
property == DCPContentProperty::CAN_BE_PLAYED ||
- property == SubRipContentProperty::SUBTITLE_COLOUR ||
- property == SubRipContentProperty::SUBTITLE_OUTLINE ||
- property == SubRipContentProperty::SUBTITLE_OUTLINE_COLOUR
+ property == TextSubtitleContentProperty::TEXT_SUBTITLE_COLOUR ||
+ property == TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE ||
+ property == TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE_COLOUR
) {
_have_valid_pieces = false;
+++ /dev/null
-/*
- 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 "subrip.h"
-#include "cross.h"
-#include "exceptions.h"
-#include "subrip_content.h"
-#include <sub/subrip_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 dcp::Data;
-
-SubRip::SubRip (shared_ptr<const SubRipContent> 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);
-
- ucsdet_close (detector);
- ucnv_close (to_utf16);
- ucnv_close (to_utf8);
-
- sub::SubripReader reader (utf8.get());
- _subtitles = sub::collect<vector<sub::Subtitle> > (reader.subtitles ());
-}
-
-ContentTime
-SubRip::length () const
-{
- if (_subtitles.empty ()) {
- return ContentTime ();
- }
-
- return ContentTime::from_seconds (_subtitles.back().to.all_as_seconds ());
-}
+++ /dev/null
-/*
- 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.
-
-*/
-
-#ifndef DCPOMATIC_SUBRIP_H
-#define DCPOMATIC_SUBRIP_H
-
-#include "dcpomatic_time.h"
-#include <sub/subtitle.h>
-#include <boost/shared_ptr.hpp>
-#include <vector>
-
-class SubRipContent;
-class subrip_time_test;
-class subrip_coordinate_test;
-class subrip_content_test;
-class subrip_parse_test;
-
-class SubRip
-{
-public:
- SubRip (boost::shared_ptr<const SubRipContent>);
-
- ContentTime length () const;
-
-protected:
- std::vector<sub::Subtitle> _subtitles;
-};
-
-#endif
+++ /dev/null
-/*
- 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 "subrip_content.h"
-#include "util.h"
-#include "subrip.h"
-#include "film.h"
-#include "font.h"
-#include "raw_convert.h"
-#include <libxml++/libxml++.h>
-#include <iostream>
-
-#include "i18n.h"
-
-using std::string;
-using std::cout;
-using boost::shared_ptr;
-using boost::lexical_cast;
-
-std::string const SubRipContent::font_id = "font";
-
-int const SubRipContentProperty::SUBTITLE_COLOUR = 300;
-int const SubRipContentProperty::SUBTITLE_OUTLINE = 301;
-int const SubRipContentProperty::SUBTITLE_OUTLINE_COLOUR = 302;
-
-SubRipContent::SubRipContent (shared_ptr<const Film> film, boost::filesystem::path path)
- : Content (film, path)
- , SubtitleContent (film, path)
- , _colour (255, 255, 255)
- , _outline (false)
- , _outline_colour (0, 0, 0)
-{
-
-}
-
-SubRipContent::SubRipContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : Content (film, node)
- , SubtitleContent (film, node, version)
- , _length (node->number_child<ContentTime::Type> ("Length"))
- , _frame_rate (node->optional_number_child<double>("SubtitleFrameRate"))
- , _colour (
- node->optional_number_child<int>("Red").get_value_or(255),
- node->optional_number_child<int>("Green").get_value_or(255),
- node->optional_number_child<int>("Blue").get_value_or(255)
- )
- , _outline (node->optional_bool_child("Outline").get_value_or(false))
- , _outline_colour (
- node->optional_number_child<int>("OutlineRed").get_value_or(255),
- node->optional_number_child<int>("OutlineGreen").get_value_or(255),
- node->optional_number_child<int>("OutlineBlue").get_value_or(255)
- )
-{
-
-}
-
-void
-SubRipContent::examine (boost::shared_ptr<Job> job)
-{
- Content::examine (job);
- SubRip s (shared_from_this ());
-
- /* Default to turning these subtitles on */
- set_use_subtitles (true);
-
- boost::mutex::scoped_lock lm (_mutex);
- _length = s.length ();
- add_font (shared_ptr<Font> (new Font (font_id)));
-}
-
-string
-SubRipContent::summary () const
-{
- return path_summary() + " " + _("[subtitles]");
-}
-
-string
-SubRipContent::technical_summary () const
-{
- return Content::technical_summary() + " - " + _("SubRip subtitles");
-}
-
-void
-SubRipContent::as_xml (xmlpp::Node* node) const
-{
- node->add_child("Type")->add_child_text ("SubRip");
- Content::as_xml (node);
- SubtitleContent::as_xml (node);
- node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ()));
- node->add_child("Red")->add_child_text (raw_convert<string> (_colour.r));
- node->add_child("Green")->add_child_text (raw_convert<string> (_colour.g));
- node->add_child("Blue")->add_child_text (raw_convert<string> (_colour.b));
- node->add_child("Outline")->add_child_text (raw_convert<string> (_outline));
- node->add_child("OutlineRed")->add_child_text (raw_convert<string> (_outline_colour.r));
- node->add_child("OutlineGreen")->add_child_text (raw_convert<string> (_outline_colour.g));
- node->add_child("OutlineBlue")->add_child_text (raw_convert<string> (_outline_colour.b));
-}
-
-DCPTime
-SubRipContent::full_length () const
-{
- FrameRateChange const frc (subtitle_video_frame_rate(), film()->video_frame_rate ());
- return DCPTime (_length, frc);
-}
-
-void
-SubRipContent::set_subtitle_video_frame_rate (int r)
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- _frame_rate = r;
- }
-
- signal_changed (SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE);
-}
-
-double
-SubRipContent::subtitle_video_frame_rate () const
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- if (_frame_rate) {
- return _frame_rate.get ();
- }
- }
-
- /* No frame rate specified, so assume this content has been
- prepared for any concurrent video content.
- */
- return film()->active_frame_rate_change(position()).source;
-}
-
-void
-SubRipContent::set_colour (dcp::Colour colour)
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- if (_colour == colour) {
- return;
- }
-
- _colour = colour;
- }
-
- signal_changed (SubRipContentProperty::SUBTITLE_COLOUR);
-}
-
-void
-SubRipContent::set_outline (bool o)
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- if (_outline == o) {
- return;
- }
-
- _outline = o;
- }
-
- signal_changed (SubRipContentProperty::SUBTITLE_OUTLINE);
-}
-
-void
-SubRipContent::set_outline_colour (dcp::Colour colour)
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- if (_outline_colour == colour) {
- return;
- }
-
- _outline_colour = colour;
- }
-
- signal_changed (SubRipContentProperty::SUBTITLE_OUTLINE_COLOUR);
-}
+++ /dev/null
-/*
- 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 "subtitle_content.h"
-
-class SubRipContentProperty
-{
-public:
- static int const SUBTITLE_COLOUR;
- static int const SUBTITLE_OUTLINE;
- static int const SUBTITLE_OUTLINE_COLOUR;
-};
-
-
-class SubRipContent : public SubtitleContent
-{
-public:
- SubRipContent (boost::shared_ptr<const Film>, boost::filesystem::path);
- SubRipContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
-
- boost::shared_ptr<SubRipContent> shared_from_this () {
- return boost::dynamic_pointer_cast<SubRipContent> (Content::shared_from_this ());
- }
-
- /* Content */
- void examine (boost::shared_ptr<Job>);
- std::string summary () const;
- std::string technical_summary () const;
- void as_xml (xmlpp::Node *) const;
- DCPTime full_length () const;
-
- /* SubtitleContent */
-
- bool has_text_subtitles () const {
- return true;
- }
-
- bool has_image_subtitles () const {
- return false;
- }
-
- double subtitle_video_frame_rate () const;
- void set_subtitle_video_frame_rate (int r);
-
- void set_colour (dcp::Colour);
-
- dcp::Colour colour () const {
- boost::mutex::scoped_lock lm (_mutex);
- return _colour;
- }
-
- void set_outline (bool);
-
- bool outline () const {
- boost::mutex::scoped_lock lm (_mutex);
- return _outline;
- }
-
- void set_outline_colour (dcp::Colour);
-
- dcp::Colour outline_colour () const {
- boost::mutex::scoped_lock lm (_mutex);
- return _outline_colour;
- }
-
- static std::string const font_id;
-
-private:
- ContentTime _length;
- /** Video frame rate that this content has been prepared for, if known */
- boost::optional<double> _frame_rate;
- dcp::Colour _colour;
- bool _outline;
- dcp::Colour _outline_colour;
-};
+++ /dev/null
-/*
- 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 "subrip_decoder.h"
-#include "subrip_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;
-
-SubRipDecoder::SubRipDecoder (shared_ptr<const SubRipContent> content)
- : SubtitleDecoder (content)
- , SubRip (content)
- , _next (0)
-{
-
-}
-
-void
-SubRipDecoder::seek (ContentTime time, bool accurate)
-{
- SubtitleDecoder::seek (time, accurate);
-
- _next = 0;
- while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) {
- ++_next;
- }
-}
-
-bool
-SubRipDecoder::pass (PassReason, bool)
-{
- if (_next >= _subtitles.size ()) {
- return true;
- }
-
- /* XXX: we are ignoring positioning specified in the file */
-
- shared_ptr<const SubRipContent> content = dynamic_pointer_cast<const SubRipContent> (_subtitle_content);
- DCPOMATIC_ASSERT (content);
-
- list<dcp::SubtitleString> out;
-
- /* Highest line index in this subtitle */
- int highest = 0;
- BOOST_FOREACH (sub::Line i, _subtitles[_next].lines) {
- DCPOMATIC_ASSERT (i.vertical_position.reference && i.vertical_position.reference.get() == sub::TOP_OF_SUBTITLE);
- DCPOMATIC_ASSERT (i.vertical_position.line);
- highest = max (highest, i.vertical_position.line.get());
- }
-
- BOOST_FOREACH (sub::Line i, _subtitles[_next].lines) {
- BOOST_FOREACH (sub::Block j, i.blocks) {
- out.push_back (
- dcp::SubtitleString (
- SubRipContent::font_id,
- j.italic,
- /* force the colour to whatever is configured */
- content->colour(),
- j.font_size.points (72 * 11),
- 1.0,
- dcp::Time (_subtitles[_next].from.all_as_seconds(), 1000),
- dcp::Time (_subtitles[_next].to.all_as_seconds(), 1000),
- 0,
- dcp::HALIGN_CENTER,
- /* This 1.015 is an arbitrary value to lift the bottom sub off the bottom
- of the screen a bit to a pleasing degree.
- */
- 1.015 - ((1 + highest - i.vertical_position.line.get()) * 1.5 / 22),
- dcp::VALIGN_TOP,
- j.text,
- content->outline() ? dcp::BORDER : dcp::NONE,
- content->outline_colour(),
- dcp::Time (0, 1000),
- dcp::Time (0, 1000)
- )
- );
- }
- }
-
- text_subtitle (content_time_period (_subtitles[_next]), out);
-
- ++_next;
- return false;
-}
-
-list<ContentTimePeriod>
-SubRipDecoder::image_subtitles_during (ContentTimePeriod, bool) const
-{
- return list<ContentTimePeriod> ();
-}
-
-list<ContentTimePeriod>
-SubRipDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const
-{
- /* XXX: inefficient */
-
- list<ContentTimePeriod> d;
-
- for (vector<sub::Subtitle>::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
- ContentTimePeriod t = content_time_period (*i);
- if ((starting && p.contains (t.from)) || (!starting && p.overlaps (t))) {
- d.push_back (t);
- }
- }
-
- return d;
-}
-
-ContentTimePeriod
-SubRipDecoder::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())
- );
-}
+++ /dev/null
-/*
- 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.
-
-*/
-
-#ifndef DCPOMATIC_SUBRIP_DECODER_H
-#define DCPOMATIC_SUBRIP_DECODER_H
-
-#include "subtitle_decoder.h"
-#include "subrip.h"
-
-class SubRipContent;
-
-class SubRipDecoder : public SubtitleDecoder, public SubRip
-{
-public:
- SubRipDecoder (boost::shared_ptr<const SubRipContent>);
-
-protected:
- void seek (ContentTime time, bool accurate);
- bool pass (PassReason, bool accurate);
-
-private:
- std::list<ContentTimePeriod> image_subtitles_during (ContentTimePeriod, bool starting) const;
- std::list<ContentTimePeriod> text_subtitles_during (ContentTimePeriod, bool starting) const;
- ContentTimePeriod content_time_period (sub::Subtitle s) const;
-
- size_t _next;
-};
-
-#endif
--- /dev/null
+/*
+ Copyright (C) 2014-2016 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 "text_subtitle.h"
+#include "cross.h"
+#include "exceptions.h"
+#include "text_subtitle_content.h"
+#include <sub/subrip_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 dcp::Data;
+
+TextSubtitle::TextSubtitle (shared_ptr<const TextSubtitleContent> 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);
+
+ ucsdet_close (detector);
+ ucnv_close (to_utf16);
+ ucnv_close (to_utf8);
+
+ sub::SubripReader reader (utf8.get());
+ _subtitles = sub::collect<vector<sub::Subtitle> > (reader.subtitles ());
+}
+
+ContentTime
+TextSubtitle::length () const
+{
+ if (_subtitles.empty ()) {
+ return ContentTime ();
+ }
+
+ return ContentTime::from_seconds (_subtitles.back().to.all_as_seconds ());
+}
--- /dev/null
+/*
+ Copyright (C) 2014-2016 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.
+
+*/
+
+#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 TextSubtitleContent;
+class text_subtitle_time_test;
+class text_subtitle_coordinate_test;
+class text_subtitle_content_test;
+class text_subtitle_parse_test;
+
+class TextSubtitle
+{
+public:
+ TextSubtitle (boost::shared_ptr<const TextSubtitleContent>);
+
+ ContentTime length () const;
+
+protected:
+ std::vector<sub::Subtitle> _subtitles;
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2014-2016 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 "text_subtitle_content.h"
+#include "util.h"
+#include "text_subtitle.h"
+#include "film.h"
+#include "font.h"
+#include "raw_convert.h"
+#include <libxml++/libxml++.h>
+#include <iostream>
+
+#include "i18n.h"
+
+using std::string;
+using std::cout;
+using boost::shared_ptr;
+using boost::lexical_cast;
+
+std::string const TextSubtitleContent::font_id = "font";
+
+int const TextSubtitleContentProperty::TEXT_SUBTITLE_COLOUR = 300;
+int const TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE = 301;
+int const TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE_COLOUR = 302;
+
+TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
+ : Content (film, path)
+ , SubtitleContent (film, path)
+ , _colour (255, 255, 255)
+ , _outline (false)
+ , _outline_colour (0, 0, 0)
+{
+
+}
+
+TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
+ : Content (film, node)
+ , SubtitleContent (film, node, version)
+ , _length (node->number_child<ContentTime::Type> ("Length"))
+ , _frame_rate (node->optional_number_child<double>("SubtitleFrameRate"))
+ , _colour (
+ node->optional_number_child<int>("Red").get_value_or(255),
+ node->optional_number_child<int>("Green").get_value_or(255),
+ node->optional_number_child<int>("Blue").get_value_or(255)
+ )
+ , _outline (node->optional_bool_child("Outline").get_value_or(false))
+ , _outline_colour (
+ node->optional_number_child<int>("OutlineRed").get_value_or(255),
+ node->optional_number_child<int>("OutlineGreen").get_value_or(255),
+ node->optional_number_child<int>("OutlineBlue").get_value_or(255)
+ )
+{
+
+}
+
+void
+TextSubtitleContent::examine (boost::shared_ptr<Job> job)
+{
+ Content::examine (job);
+ TextSubtitle s (shared_from_this ());
+
+ /* Default to turning these subtitles on */
+ set_use_subtitles (true);
+
+ boost::mutex::scoped_lock lm (_mutex);
+ _length = s.length ();
+ add_font (shared_ptr<Font> (new Font (font_id)));
+}
+
+string
+TextSubtitleContent::summary () const
+{
+ return path_summary() + " " + _("[subtitles]");
+}
+
+string
+TextSubtitleContent::technical_summary () const
+{
+ return Content::technical_summary() + " - " + _("Text subtitles");
+}
+
+void
+TextSubtitleContent::as_xml (xmlpp::Node* node) const
+{
+ node->add_child("Type")->add_child_text ("TextSubtitle");
+ Content::as_xml (node);
+ SubtitleContent::as_xml (node);
+ node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ()));
+ node->add_child("Red")->add_child_text (raw_convert<string> (_colour.r));
+ node->add_child("Green")->add_child_text (raw_convert<string> (_colour.g));
+ node->add_child("Blue")->add_child_text (raw_convert<string> (_colour.b));
+ node->add_child("Outline")->add_child_text (raw_convert<string> (_outline));
+ node->add_child("OutlineRed")->add_child_text (raw_convert<string> (_outline_colour.r));
+ node->add_child("OutlineGreen")->add_child_text (raw_convert<string> (_outline_colour.g));
+ node->add_child("OutlineBlue")->add_child_text (raw_convert<string> (_outline_colour.b));
+}
+
+DCPTime
+TextSubtitleContent::full_length () const
+{
+ FrameRateChange const frc (subtitle_video_frame_rate(), film()->video_frame_rate ());
+ return DCPTime (_length, frc);
+}
+
+void
+TextSubtitleContent::set_subtitle_video_frame_rate (int r)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _frame_rate = r;
+ }
+
+ signal_changed (SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE);
+}
+
+double
+TextSubtitleContent::subtitle_video_frame_rate () const
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_frame_rate) {
+ return _frame_rate.get ();
+ }
+ }
+
+ /* No frame rate specified, so assume this content has been
+ prepared for any concurrent video content.
+ */
+ return film()->active_frame_rate_change(position()).source;
+}
+
+void
+TextSubtitleContent::set_colour (dcp::Colour colour)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_colour == colour) {
+ return;
+ }
+
+ _colour = colour;
+ }
+
+ signal_changed (TextSubtitleContentProperty::TEXT_SUBTITLE_COLOUR);
+}
+
+void
+TextSubtitleContent::set_outline (bool o)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_outline == o) {
+ return;
+ }
+
+ _outline = o;
+ }
+
+ signal_changed (TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE);
+}
+
+void
+TextSubtitleContent::set_outline_colour (dcp::Colour colour)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_outline_colour == colour) {
+ return;
+ }
+
+ _outline_colour = colour;
+ }
+
+ signal_changed (TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE_COLOUR);
+}
--- /dev/null
+/*
+ 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 "subtitle_content.h"
+
+class TextSubtitleContentProperty
+{
+public:
+ static int const TEXT_SUBTITLE_COLOUR;
+ static int const TEXT_SUBTITLE_OUTLINE;
+ static int const TEXT_SUBTITLE_OUTLINE_COLOUR;
+};
+
+
+class TextSubtitleContent : public SubtitleContent
+{
+public:
+ TextSubtitleContent (boost::shared_ptr<const Film>, boost::filesystem::path);
+ TextSubtitleContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
+
+ boost::shared_ptr<TextSubtitleContent> shared_from_this () {
+ return boost::dynamic_pointer_cast<TextSubtitleContent> (Content::shared_from_this ());
+ }
+
+ /* Content */
+ void examine (boost::shared_ptr<Job>);
+ std::string summary () const;
+ std::string technical_summary () const;
+ void as_xml (xmlpp::Node *) const;
+ DCPTime full_length () const;
+
+ /* SubtitleContent */
+
+ bool has_text_subtitles () const {
+ return true;
+ }
+
+ bool has_image_subtitles () const {
+ return false;
+ }
+
+ double subtitle_video_frame_rate () const;
+ void set_subtitle_video_frame_rate (int r);
+
+ void set_colour (dcp::Colour);
+
+ dcp::Colour colour () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _colour;
+ }
+
+ void set_outline (bool);
+
+ bool outline () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _outline;
+ }
+
+ void set_outline_colour (dcp::Colour);
+
+ dcp::Colour outline_colour () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _outline_colour;
+ }
+
+ static std::string const font_id;
+
+private:
+ ContentTime _length;
+ /** Video frame rate that this content has been prepared for, if known */
+ boost::optional<double> _frame_rate;
+ dcp::Colour _colour;
+ bool _outline;
+ dcp::Colour _outline_colour;
+};
--- /dev/null
+/*
+ Copyright (C) 2014-2016 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 "text_subtitle_decoder.h"
+#include "text_subtitle_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;
+
+TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr<const TextSubtitleContent> content)
+ : SubtitleDecoder (content)
+ , TextSubtitle (content)
+ , _next (0)
+{
+
+}
+
+void
+TextSubtitleDecoder::seek (ContentTime time, bool accurate)
+{
+ SubtitleDecoder::seek (time, accurate);
+
+ _next = 0;
+ while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) {
+ ++_next;
+ }
+}
+
+bool
+TextSubtitleDecoder::pass (PassReason, bool)
+{
+ if (_next >= _subtitles.size ()) {
+ return true;
+ }
+
+ /* XXX: we are ignoring positioning specified in the file */
+
+ shared_ptr<const TextSubtitleContent> content = dynamic_pointer_cast<const TextSubtitleContent> (_subtitle_content);
+ DCPOMATIC_ASSERT (content);
+
+ list<dcp::SubtitleString> out;
+
+ /* Highest line index in this subtitle */
+ int highest = 0;
+ BOOST_FOREACH (sub::Line i, _subtitles[_next].lines) {
+ DCPOMATIC_ASSERT (i.vertical_position.reference && i.vertical_position.reference.get() == sub::TOP_OF_SUBTITLE);
+ DCPOMATIC_ASSERT (i.vertical_position.line);
+ highest = max (highest, i.vertical_position.line.get());
+ }
+
+ BOOST_FOREACH (sub::Line i, _subtitles[_next].lines) {
+ BOOST_FOREACH (sub::Block j, i.blocks) {
+ out.push_back (
+ dcp::SubtitleString (
+ TextSubtitleContent::font_id,
+ j.italic,
+ /* force the colour to whatever is configured */
+ content->colour(),
+ j.font_size.points (72 * 11),
+ 1.0,
+ dcp::Time (_subtitles[_next].from.all_as_seconds(), 1000),
+ dcp::Time (_subtitles[_next].to.all_as_seconds(), 1000),
+ 0,
+ dcp::HALIGN_CENTER,
+ /* This 1.015 is an arbitrary value to lift the bottom sub off the bottom
+ of the screen a bit to a pleasing degree.
+ */
+ 1.015 - ((1 + highest - i.vertical_position.line.get()) * 1.5 / 22),
+ dcp::VALIGN_TOP,
+ j.text,
+ content->outline() ? dcp::BORDER : dcp::NONE,
+ content->outline_colour(),
+ dcp::Time (0, 1000),
+ dcp::Time (0, 1000)
+ )
+ );
+ }
+ }
+
+ text_subtitle (content_time_period (_subtitles[_next]), out);
+
+ ++_next;
+ return false;
+}
+
+list<ContentTimePeriod>
+TextSubtitleDecoder::image_subtitles_during (ContentTimePeriod, bool) const
+{
+ return list<ContentTimePeriod> ();
+}
+
+list<ContentTimePeriod>
+TextSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const
+{
+ /* XXX: inefficient */
+
+ list<ContentTimePeriod> d;
+
+ for (vector<sub::Subtitle>::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
+ ContentTimePeriod t = content_time_period (*i);
+ if ((starting && p.contains (t.from)) || (!starting && p.overlaps (t))) {
+ d.push_back (t);
+ }
+ }
+
+ return d;
+}
+
+ContentTimePeriod
+TextSubtitleDecoder::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())
+ );
+}
--- /dev/null
+/*
+ Copyright (C) 2014-2016 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.
+
+*/
+
+#ifndef DCPOMATIC_TEXT_SUBTITLE_DECODER_H
+#define DCPOMATIC_TEXT_SUBTITLE_DECODER_H
+
+#include "subtitle_decoder.h"
+#include "text_subtitle.h"
+
+class TextSubtitleContent;
+
+class TextSubtitleDecoder : public SubtitleDecoder, public TextSubtitle
+{
+public:
+ TextSubtitleDecoder (boost::shared_ptr<const TextSubtitleContent>);
+
+protected:
+ void seek (ContentTime time, bool accurate);
+ bool pass (PassReason, bool accurate);
+
+private:
+ std::list<ContentTimePeriod> image_subtitles_during (ContentTimePeriod, bool starting) const;
+ std::list<ContentTimePeriod> text_subtitles_during (ContentTimePeriod, bool starting) const;
+ ContentTimePeriod content_time_period (sub::Subtitle s) const;
+
+ size_t _next;
+};
+
+#endif
sndfile_decoder.cc
sndfile_examiner.cc
string_log_entry.cc
- subrip.cc
- subrip_content.cc
- subrip_decoder.cc
+ text_subtitle.cc
+ text_subtitle_content.cc
+ text_subtitle_decoder.cc
subtitle_content.cc
subtitle_decoder.cc
timer.cc
*/
#include "subtitle_appearance_dialog.h"
-#include "lib/subrip_content.h"
+#include "lib/text_subtitle_content.h"
#include <wx/wx.h>
#include <wx/clrpicker.h>
using boost::shared_ptr;
-SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr<SubRipContent> content)
+SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr<TextSubtitleContent> content)
: TableDialog (parent, _("Subtitle appearance"), 2, 1, true)
, _content (content)
{
class wxCheckBox;
class wxColourPickerCtrl;
-class SubRipContent;
+class TextSubtitleContent;
class SubtitleAppearanceDialog : public TableDialog
{
public:
- SubtitleAppearanceDialog (wxWindow* parent, boost::shared_ptr<SubRipContent> content);
+ SubtitleAppearanceDialog (wxWindow* parent, boost::shared_ptr<TextSubtitleContent> content);
void apply ();
wxCheckBox* _outline;
wxColourPickerCtrl* _outline_colour;
- boost::shared_ptr<SubRipContent> _content;
+ boost::shared_ptr<TextSubtitleContent> _content;
};
#include "fonts_dialog.h"
#include "subtitle_appearance_dialog.h"
#include "lib/ffmpeg_content.h"
-#include "lib/subrip_content.h"
+#include "lib/text_subtitle_content.h"
#include "lib/ffmpeg_subtitle_stream.h"
#include "lib/dcp_subtitle_content.h"
-#include "lib/subrip_decoder.h"
+#include "lib/text_subtitle_decoder.h"
#include "lib/dcp_subtitle_decoder.h"
#include "lib/dcp_content.h"
#include <wx/spinctrl.h>
{
int any_subs = 0;
int ffmpeg_subs = 0;
- int subrip_subs = 0;
+ int text_subs = 0;
int dcp_subs = 0;
int image_subs = 0;
SubtitleContentList sel = _parent->selected_subtitle ();
BOOST_FOREACH (shared_ptr<SubtitleContent> i, sel) {
shared_ptr<const FFmpegContent> fc = boost::dynamic_pointer_cast<const FFmpegContent> (i);
- shared_ptr<const SubRipContent> sc = boost::dynamic_pointer_cast<const SubRipContent> (i);
+ shared_ptr<const TextSubtitleContent> sc = boost::dynamic_pointer_cast<const TextSubtitleContent> (i);
shared_ptr<const DCPSubtitleContent> dsc = boost::dynamic_pointer_cast<const DCPSubtitleContent> (i);
if (fc) {
if (fc->has_subtitles ()) {
++any_subs;
}
} else if (sc) {
- ++subrip_subs;
+ ++text_subs;
++any_subs;
} else if (dsc) {
++dcp_subs;
_y_scale->Enable (!reference && any_subs > 0 && use);
_language->Enable (!reference && any_subs > 0 && use);
_stream->Enable (!reference && ffmpeg_subs == 1);
- _subtitle_view_button->Enable (!reference && (subrip_subs == 1 || dcp_subs == 1));
- _fonts_dialog_button->Enable (!reference && (subrip_subs == 1 || dcp_subs == 1));
- _appearance_dialog_button->Enable (!reference && subrip_subs == 1);
+ _subtitle_view_button->Enable (!reference && (text_subs == 1 || dcp_subs == 1));
+ _fonts_dialog_button->Enable (!reference && (text_subs == 1 || dcp_subs == 1));
+ _appearance_dialog_button->Enable (!reference && text_subs == 1);
}
void
shared_ptr<SubtitleDecoder> decoder;
- shared_ptr<SubRipContent> sr = dynamic_pointer_cast<SubRipContent> (c.front ());
+ shared_ptr<TextSubtitleContent> sr = dynamic_pointer_cast<TextSubtitleContent> (c.front ());
if (sr) {
- decoder.reset (new SubRipDecoder (sr));
+ decoder.reset (new TextSubtitleDecoder (sr));
}
shared_ptr<DCPSubtitleContent> dc = dynamic_pointer_cast<DCPSubtitleContent> (c.front ());
SubtitleContentList c = _parent->selected_subtitle ();
DCPOMATIC_ASSERT (c.size() == 1);
- shared_ptr<SubRipContent> sr = dynamic_pointer_cast<SubRipContent> (c.front ());
+ shared_ptr<TextSubtitleContent> sr = dynamic_pointer_cast<TextSubtitleContent> (c.front ());
DCPOMATIC_ASSERT (sr);
SubtitleAppearanceDialog* d = new SubtitleAppearanceDialog (this, sr);
*/
-#include "lib/subrip_decoder.h"
+#include "lib/text_subtitle_decoder.h"
#include "lib/content_subtitle.h"
#include "lib/film.h"
-#include "lib/subrip_content.h"
+#include "lib/text_subtitle_content.h"
#include "subtitle_view.h"
#include "wx_util.h"
#include "lib/raw_convert.h"
#include "lib/subtitle_content.h"
#include "lib/dcp_subtitle_content.h"
-#include "lib/subrip_content.h"
+#include "lib/text_subtitle_content.h"
#include <boost/foreach.hpp>
#include <set>
#include <iostream>
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (i);
shared_ptr<DCPSubtitleContent> dsc = dynamic_pointer_cast<DCPSubtitleContent> (i);
- shared_ptr<SubRipContent> ssc = dynamic_pointer_cast<SubRipContent> (i);
+ shared_ptr<TextSubtitleContent> tsc = dynamic_pointer_cast<TextSubtitleContent> (i);
if (vc) {
vc->set_video_frame_rate (raw_convert<double> (wx_to_std (_video_frame_rate->GetValue ())));
} else if (dsc) {
dsc->set_subtitle_video_frame_rate (raw_convert<double> (wx_to_std (_video_frame_rate->GetValue ())));
- } else if (ssc) {
- ssc->set_subtitle_video_frame_rate (raw_convert<double> (wx_to_std (_video_frame_rate->GetValue ())));
+ } else if (tsc) {
+ tsc->set_subtitle_video_frame_rate (raw_convert<double> (wx_to_std (_video_frame_rate->GetValue ())));
}
_set_video_frame_rate->Enable (false);
}
*/
#include <boost/test/unit_test.hpp>
-#include "lib/subrip_content.h"
+#include "lib/text_subtitle_content.h"
#include "lib/dcp_subtitle_content.h"
#include "lib/film.h"
#include "lib/ratio.h"
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<SubRipContent> content (new SubRipContent (film, "test/data/subrip2.srt"));
+ shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip2.srt"));
content->set_use_subtitles (true);
content->set_burn_subtitles (true);
film->examine_and_add_content (content, true);
#include "lib/image_content.h"
#include "lib/dcp_content_type.h"
#include "lib/dcp_content.h"
-#include "lib/subrip_content.h"
+#include "lib/text_subtitle_content.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
#include <boost/foreach.hpp>
shared_ptr<Content> dcp (new DCPContent (film, "test/data/reels_test2"));
film->examine_and_add_content (dcp);
- shared_ptr<Content> sub (new SubRipContent (film, "test/data/subrip.srt"));
+ shared_ptr<Content> sub (new TextSubtitleContent (film, "test/data/subrip.srt"));
film->examine_and_add_content (sub);
wait_for_jobs ();
content[i]->set_video_length (24);
}
- shared_ptr<SubRipContent> subs (new SubRipContent (film, "test/data/subrip3.srt"));
+ shared_ptr<TextSubtitleContent> subs (new TextSubtitleContent (film, "test/data/subrip3.srt"));
film->examine_and_add_content (subs);
wait_for_jobs ();
*/
#include "lib/film.h"
-#include "lib/subrip_content.h"
+#include "lib/text_subtitle_content.h"
#include "lib/dcp_content_type.h"
#include "lib/font.h"
#include "lib/ratio.h"
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<SubRipContent> content (new SubRipContent (film, "test/data/subrip2.srt"));
+ shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip2.srt"));
film->examine_and_add_content (content);
wait_for_jobs ();
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<SubRipContent> content (new SubRipContent (film, "test/data/subrip2.srt"));
+ shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip2.srt"));
film->examine_and_add_content (content);
wait_for_jobs ();
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_interop (true);
- shared_ptr<SubRipContent> content (new SubRipContent (film, private_data / "Ankoemmling.srt"));
+ shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, private_data / "Ankoemmling.srt"));
film->examine_and_add_content (content);
wait_for_jobs ();
BOOST_AUTO_TEST_CASE (subrip_render_test)
{
shared_ptr<Film> film = new_test_film ("subrip_render_test");
- shared_ptr<SubRipContent> content (new SubRipContent (film, "test/data/subrip.srt"));
+ shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip.srt"));
content->examine (shared_ptr<Job> (), true);
BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds ((3 * 60) + 56.471));
*/
#include <boost/test/unit_test.hpp>
-#include "lib/subrip_content.h"
+#include "lib/text_subtitle_content.h"
#include "lib/film.h"
#include "lib/ratio.h"
#include "lib/dcp_content_type.h"
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<SubRipContent> content (new SubRipContent (film, "test/data/subrip2.srt"));
+ shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip2.srt"));
content->set_use_subtitles (true);
content->set_burn_subtitles (false);
film->examine_and_add_content (content);