From 334b94526f2c1271718a94fe97cfa843cf6ef7a1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 13 Apr 2016 14:46:01 +0100 Subject: [PATCH] Basics of subtitle split. --- src/lib/content.h | 3 ++- src/lib/content_part.h | 5 +++++ src/lib/dcp_content.cc | 20 +++++++------------- src/lib/dcp_content.h | 3 +-- src/lib/dcp_decoder.cc | 2 +- src/lib/dcp_subtitle_content.cc | 17 ++++++++--------- src/lib/dcp_subtitle_content.h | 6 +++--- src/lib/dcp_subtitle_decoder.cc | 2 +- src/lib/ffmpeg_content.cc | 13 +++++++------ src/lib/ffmpeg_content.h | 3 +-- src/lib/ffmpeg_decoder.cc | 3 +-- src/lib/player.cc | 27 +++++++++++++-------------- src/lib/playlist.cc | 8 ++++---- src/lib/subtitle_content.cc | 26 +++++++------------------- src/lib/subtitle_content.h | 24 ++++++++---------------- src/lib/text_subtitle_content.cc | 9 ++++----- src/lib/text_subtitle_content.h | 8 +++++--- src/lib/text_subtitle_decoder.cc | 2 +- 18 files changed, 79 insertions(+), 102 deletions(-) diff --git a/src/lib/content.h b/src/lib/content.h index 0ce9d39c1..f488962b3 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington + Copyright (C) 2013-2016 Carl Hetherington 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 @@ -167,6 +167,7 @@ public: boost::signals2::signal, int, bool)> Changed; boost::shared_ptr video; + boost::shared_ptr subtitle; void signal_changed (int); diff --git a/src/lib/content_part.h b/src/lib/content_part.h index 2d0f73f7f..b1282d98d 100644 --- a/src/lib/content_part.h +++ b/src/lib/content_part.h @@ -17,6 +17,9 @@ */ +#ifndef DCPOMATIC_CONTENT_PART_H +#define DCPOMATIC_CONTENT_PART_H + #include class Content; @@ -35,3 +38,5 @@ protected: boost::weak_ptr _film; mutable boost::mutex _mutex; }; + +#endif diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 5a9a47fb1..81068262b 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -26,6 +26,7 @@ #include "overlaps.h" #include "compose.hpp" #include "dcp_decoder.h" +#include "subtitle_content.h" #include #include #include @@ -54,7 +55,6 @@ int const DCPContentProperty::REFERENCE_SUBTITLE = 603; DCPContent::DCPContent (shared_ptr film, boost::filesystem::path p) : Content (film) , SingleStreamAudioContent (film) - , SubtitleContent (film) , _has_subtitles (false) , _encrypted (false) , _kdm_valid (false) @@ -63,6 +63,7 @@ DCPContent::DCPContent (shared_ptr film, boost::filesystem::path p) , _reference_subtitle (false) { video.reset (new VideoContent (this, film)); + subtitle.reset (new SubtitleContent (this, film)); read_directory (p); set_default_colour_conversion (); @@ -71,9 +72,9 @@ DCPContent::DCPContent (shared_ptr film, boost::filesystem::path p) DCPContent::DCPContent (shared_ptr film, cxml::ConstNodePtr node, int version) : Content (film, node) , SingleStreamAudioContent (film, node, version) - , SubtitleContent (film, node, version) { video.reset (new VideoContent (this, film, node, version)); + subtitle.reset (new SubtitleContent (this, film, node, version)); _name = node->string_child ("Name"); _has_subtitles = node->bool_child ("HasSubtitles"); @@ -148,7 +149,7 @@ DCPContent::as_xml (xmlpp::Node* node) const Content::as_xml (node); video->as_xml (node); SingleStreamAudioContent::as_xml (node); - SubtitleContent::as_xml (node); + subtitle->as_xml (node); boost::mutex::scoped_lock lm (_mutex); node->add_child("Name")->add_child_text (_name); @@ -174,7 +175,7 @@ string DCPContent::identifier () const { SafeStringStream s; - s << Content::identifier() << "_" << video->identifier() << "_" << SubtitleContent::identifier () << " " + s << Content::identifier() << "_" << video->identifier() << "_" << subtitle->identifier () << " " << (_reference_video ? "1" : "0") << (_reference_subtitle ? "1" : "0"); return s.str (); @@ -337,15 +338,8 @@ DCPContent::can_reference_audio (list& why_not) const bool DCPContent::can_reference_subtitle (list& why_not) const { - DCPDecoder decoder (shared_from_this(), film()->log(), false); - BOOST_FOREACH (shared_ptr i, decoder.reels()) { - if (!i->main_subtitle()) { - why_not.push_back (_("The DCP does not have subtitles in all reels.")); - return false; - } - } - - return can_reference (_("There is other subtitle content overlapping this DCP; remove it."), why_not); + /* XXX: this needs to be fixed */ + return true; } double diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 1edc3a3aa..81432b6d3 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -25,7 +25,6 @@ */ #include "single_stream_audio_content.h" -#include "subtitle_content.h" #include #include @@ -41,7 +40,7 @@ public: /** @class DCPContent * @brief An existing DCP used as input. */ -class DCPContent : public SingleStreamAudioContent, public SubtitleContent +class DCPContent : public SingleStreamAudioContent { public: DCPContent (boost::shared_ptr, boost::filesystem::path p); diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index e8c64a086..f032ee661 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -45,7 +45,7 @@ using boost::dynamic_pointer_cast; DCPDecoder::DCPDecoder (shared_ptr c, shared_ptr log, bool fast) : VideoDecoder (c->video, log) , AudioDecoder (c, fast) - , SubtitleDecoder (c) + , SubtitleDecoder (c->subtitle) , _dcp_content (c) { dcp::DCP dcp (c->directory ()); diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index 39f24b215..b38c0c6a7 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -21,6 +21,7 @@ #include "dcp_subtitle_content.h" #include "raw_convert.h" #include "film.h" +#include "subtitle_content.h" #include #include #include @@ -36,18 +37,16 @@ using boost::dynamic_pointer_cast; DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, boost::filesystem::path path) : Content (film, path) - , SubtitleContent (film, path) { - + subtitle.reset (new SubtitleContent (this, film)); } DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, cxml::ConstNodePtr node, int version) : Content (film, node) - , SubtitleContent (film, node, version) , _length (node->number_child ("Length")) , _frame_rate (node->optional_number_child("SubtitleFrameRate")) { - + subtitle.reset (new SubtitleContent (this, film, node, version)); } void @@ -58,24 +57,24 @@ DCPSubtitleContent::examine (shared_ptr job) shared_ptr sc = load (path (0)); /* Default to turning these subtitles on */ - set_use_subtitles (true); + subtitle->set_use_subtitles (true); boost::mutex::scoped_lock lm (_mutex); shared_ptr iop = dynamic_pointer_cast (sc); if (iop) { - _subtitle_language = iop->language (); + subtitle->set_subtitle_language (iop->language ()); } shared_ptr smpte = dynamic_pointer_cast (sc); if (smpte) { - _subtitle_language = smpte->language().get_value_or (""); + subtitle->set_subtitle_language (smpte->language().get_value_or ("")); _frame_rate = smpte->edit_rate().numerator; } _length = ContentTime::from_seconds (sc->latest_subtitle_out().as_seconds ()); BOOST_FOREACH (shared_ptr i, sc->load_font_nodes ()) { - add_font (shared_ptr (new Font (i->id))); + subtitle->add_font (shared_ptr (new Font (i->id))); } } @@ -103,7 +102,7 @@ DCPSubtitleContent::as_xml (xmlpp::Node* node) const { node->add_child("Type")->add_child_text ("DCPSubtitle"); Content::as_xml (node); - SubtitleContent::as_xml (node); + subtitle->as_xml (node); node->add_child("Length")->add_child_text (raw_convert (_length.get ())); } diff --git a/src/lib/dcp_subtitle_content.h b/src/lib/dcp_subtitle_content.h index 887328393..de9fa68ec 100644 --- a/src/lib/dcp_subtitle_content.h +++ b/src/lib/dcp_subtitle_content.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington + Copyright (C) 2014-2016 Carl Hetherington 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 @@ -17,10 +17,10 @@ */ -#include "subtitle_content.h" #include "dcp_subtitle.h" +#include "content.h" -class DCPSubtitleContent : public SubtitleContent, public DCPSubtitle +class DCPSubtitleContent : public DCPSubtitle, public Content { public: DCPSubtitleContent (boost::shared_ptr, boost::filesystem::path); diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 1bcc7fcf1..964ee6f20 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -27,7 +27,7 @@ using std::cout; using boost::shared_ptr; DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr content) - : SubtitleDecoder (content) + : SubtitleDecoder (content->subtitle) { shared_ptr c (load (content->path (0))); _subtitles = c->subtitles (); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index a8b7fb716..f276a16a3 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -32,6 +32,7 @@ #include "frame_rate_change.h" #include "safe_stringstream.h" #include "raw_convert.h" +#include "subtitle_content.h" #include extern "C" { #include @@ -62,9 +63,9 @@ int const FFmpegContentProperty::FILTERS = 102; FFmpegContent::FFmpegContent (shared_ptr film, boost::filesystem::path p) : Content (film, p) , AudioContent (film, p) - , SubtitleContent (film, p) { video.reset (new VideoContent (this, film)); + subtitle.reset (new SubtitleContent (this, film)); set_default_colour_conversion (); } @@ -72,9 +73,9 @@ FFmpegContent::FFmpegContent (shared_ptr film, boost::filesystem::pa FFmpegContent::FFmpegContent (shared_ptr film, cxml::ConstNodePtr node, int version, list& notes) : Content (film, node) , AudioContent (film, node) - , SubtitleContent (film, node, version) { video.reset (new VideoContent (this, film, node, version)); + subtitle.reset (new SubtitleContent (this, film, node, version)); list c = node->node_children ("SubtitleStream"); for (list::const_iterator i = c.begin(); i != c.end(); ++i) { @@ -121,16 +122,16 @@ FFmpegContent::FFmpegContent (shared_ptr film, cxml::ConstNodePtr no FFmpegContent::FFmpegContent (shared_ptr film, vector > c) : Content (film, c) , AudioContent (film, c) - , SubtitleContent (film, c) { video.reset (new VideoContent (this, film, c)); + subtitle.reset (new SubtitleContent (this, film, c)); shared_ptr ref = dynamic_pointer_cast (c[0]); DCPOMATIC_ASSERT (ref); for (size_t i = 0; i < c.size(); ++i) { shared_ptr fc = dynamic_pointer_cast (c[i]); - if (fc->use_subtitles() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { + if (fc->subtitle->use_subtitles() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { throw JoinError (_("Content to be joined must use the same subtitle stream.")); } } @@ -156,7 +157,7 @@ FFmpegContent::as_xml (xmlpp::Node* node) const Content::as_xml (node); video->as_xml (node); AudioContent::as_xml (node); - SubtitleContent::as_xml (node); + subtitle->as_xml (node); boost::mutex::scoped_lock lm (_mutex); @@ -312,7 +313,7 @@ FFmpegContent::identifier () const s << Content::identifier() << "_" << video->identifier() << "_" - << SubtitleContent::identifier(); + << subtitle->identifier(); boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index d210d63a8..da0eb48af 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -21,7 +21,6 @@ #define DCPOMATIC_FFMPEG_CONTENT_H #include "audio_content.h" -#include "subtitle_content.h" struct AVFormatContext; struct AVStream; @@ -42,7 +41,7 @@ public: static int const FILTERS; }; -class FFmpegContent : public AudioContent, public SubtitleContent +class FFmpegContent : public AudioContent { public: FFmpegContent (boost::shared_ptr, boost::filesystem::path); diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 5240decb2..15cc9b256 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -74,12 +74,11 @@ using dcp::Size; FFmpegDecoder::FFmpegDecoder (shared_ptr c, shared_ptr log, bool fast) : VideoDecoder (c->video, log) , AudioDecoder (c, fast) - , SubtitleDecoder (c) + , SubtitleDecoder (c->subtitle) , FFmpeg (c) , _log (log) , _pts_offset (pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->video->video_frame_rate())) { - } void diff --git a/src/lib/player.cc b/src/lib/player.cc index 2b65fd54e..ca833208c 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -631,12 +631,11 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt, PlayerSubtitles ps (time, length); for (list >::const_iterator j = subs.begin(); j != subs.end(); ++j) { - shared_ptr subtitle_content = dynamic_pointer_cast ((*j)->content); - if (!subtitle_content->use_subtitles () || (!_always_burn_subtitles && (burnt != subtitle_content->burn_subtitles ()))) { + if (!(*j)->content->subtitle->use_subtitles () || (!_always_burn_subtitles && (burnt != (*j)->content->subtitle->burn_subtitles ()))) { continue; } - shared_ptr dcp_content = dynamic_pointer_cast (subtitle_content); + shared_ptr dcp_content = dynamic_pointer_cast ((*j)->content); if (dcp_content && dcp_content->reference_subtitle () && !_play_referenced) { continue; } @@ -650,16 +649,16 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt, for (list::iterator i = image.begin(); i != image.end(); ++i) { /* Apply content's subtitle offsets */ - i->sub.rectangle.x += subtitle_content->subtitle_x_offset (); - i->sub.rectangle.y += subtitle_content->subtitle_y_offset (); + i->sub.rectangle.x += (*j)->content->subtitle->subtitle_x_offset (); + i->sub.rectangle.y += (*j)->content->subtitle->subtitle_y_offset (); /* Apply content's subtitle scale */ - i->sub.rectangle.width *= subtitle_content->subtitle_x_scale (); - i->sub.rectangle.height *= subtitle_content->subtitle_y_scale (); + i->sub.rectangle.width *= (*j)->content->subtitle->subtitle_x_scale (); + i->sub.rectangle.height *= (*j)->content->subtitle->subtitle_y_scale (); /* Apply a corrective translation to keep the subtitle centred after that scale */ - i->sub.rectangle.x -= i->sub.rectangle.width * (subtitle_content->subtitle_x_scale() - 1); - i->sub.rectangle.y -= i->sub.rectangle.height * (subtitle_content->subtitle_y_scale() - 1); + i->sub.rectangle.x -= i->sub.rectangle.width * ((*j)->content->subtitle->subtitle_x_scale() - 1); + i->sub.rectangle.y -= i->sub.rectangle.height * ((*j)->content->subtitle->subtitle_y_scale() - 1); ps.image.push_back (i->sub); } @@ -667,10 +666,10 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt, list text = subtitle_decoder->get_text_subtitles (ContentTimePeriod (from, to), starting, accurate); BOOST_FOREACH (ContentTextSubtitle& ts, text) { BOOST_FOREACH (dcp::SubtitleString s, ts.subs) { - s.set_h_position (s.h_position() + subtitle_content->subtitle_x_offset ()); - s.set_v_position (s.v_position() + subtitle_content->subtitle_y_offset ()); - float const xs = subtitle_content->subtitle_x_scale(); - float const ys = subtitle_content->subtitle_y_scale(); + s.set_h_position (s.h_position() + (*j)->content->subtitle->subtitle_x_offset ()); + s.set_v_position (s.v_position() + (*j)->content->subtitle->subtitle_y_offset ()); + float const xs = (*j)->content->subtitle->subtitle_x_scale(); + float const ys = (*j)->content->subtitle->subtitle_y_scale(); float size = s.size(); /* Adjust size to express the common part of the scaling; @@ -688,7 +687,7 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt, s.set_in (dcp::Time(content_subtitle_to_dcp (*j, ts.period().from).seconds(), 1000)); s.set_out (dcp::Time(content_subtitle_to_dcp (*j, ts.period().to).seconds(), 1000)); ps.text.push_back (s); - ps.add_fonts (subtitle_content->fonts ()); + ps.add_fonts ((*j)->content->subtitle->fonts ()); } } } diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index f03f8a9a1..9df7857b5 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -21,6 +21,7 @@ #include "sndfile_content.h" #include "sndfile_decoder.h" #include "video_content.h" +#include "subtitle_content.h" #include "ffmpeg_decoder.h" #include "ffmpeg_content.h" #include "image_decoder.h" @@ -129,13 +130,12 @@ Playlist::maybe_sequence () DCPTime next; BOOST_FOREACH (shared_ptr i, _content) { - shared_ptr sc = dynamic_pointer_cast (i); - if (!sc || !sc->has_subtitles() || find (placed.begin(), placed.end(), i) != placed.end()) { + if (!i->subtitle || !i->subtitle->has_subtitles() || find (placed.begin(), placed.end(), i) != placed.end()) { continue; } - sc->set_position (next); - next = sc->end(); + i->set_position (next); + next = i->end(); } diff --git a/src/lib/subtitle_content.cc b/src/lib/subtitle_content.cc index 48c9e9cf6..bdc2b729c 100644 --- a/src/lib/subtitle_content.cc +++ b/src/lib/subtitle_content.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2014 Carl Hetherington + Copyright (C) 2013-2016 Carl Hetherington 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 @@ -47,8 +47,8 @@ int const SubtitleContentProperty::SUBTITLE_LANGUAGE = 506; int const SubtitleContentProperty::FONTS = 507; int const SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE = 508; -SubtitleContent::SubtitleContent (shared_ptr film) - : Content (film) +SubtitleContent::SubtitleContent (Content* parent, shared_ptr film) + : ContentPart (parent, film) , _use_subtitles (false) , _burn_subtitles (false) , _subtitle_x_offset (0) @@ -59,20 +59,8 @@ SubtitleContent::SubtitleContent (shared_ptr film) } -SubtitleContent::SubtitleContent (shared_ptr film, boost::filesystem::path p) - : Content (film, p) - , _use_subtitles (false) - , _burn_subtitles (false) - , _subtitle_x_offset (0) - , _subtitle_y_offset (0) - , _subtitle_x_scale (1) - , _subtitle_y_scale (1) -{ - -} - -SubtitleContent::SubtitleContent (shared_ptr film, cxml::ConstNodePtr node, int version) - : Content (film, node) +SubtitleContent::SubtitleContent (Content* parent, shared_ptr film, cxml::ConstNodePtr node, int version) + : ContentParet (parent, film) , _use_subtitles (false) , _burn_subtitles (false) , _subtitle_x_offset (0) @@ -109,8 +97,8 @@ SubtitleContent::SubtitleContent (shared_ptr film, cxml::ConstNodePt connect_to_fonts (); } -SubtitleContent::SubtitleContent (shared_ptr film, vector > c) - : Content (film, c) +SubtitleContent::SubtitleContent (Content* parent, shared_ptr film, vector > c) + : ContentPart (parent, film) { shared_ptr ref = dynamic_pointer_cast (c[0]); DCPOMATIC_ASSERT (ref); diff --git a/src/lib/subtitle_content.h b/src/lib/subtitle_content.h index e9017e40d..f9d5336f2 100644 --- a/src/lib/subtitle_content.h +++ b/src/lib/subtitle_content.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2014 Carl Hetherington + Copyright (C) 2013-2016 Carl Hetherington 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 @@ -20,7 +20,9 @@ #ifndef DCPOMATIC_SUBTITLE_CONTENT_H #define DCPOMATIC_SUBTITLE_CONTENT_H -#include "content.h" +#include "content_part.h" +#include +#include class Font; @@ -38,27 +40,17 @@ public: static int const SUBTITLE_VIDEO_FRAME_RATE; }; -/** @class SubtitleContent - * @brief Parent for content which has the potential to include subtitles. - * - * Although inheriting from this class indicates that the content could - * have subtitles, it may not. ::has_subtitles() will tell you. - */ -class SubtitleContent : public virtual Content +class SubtitleContent : public ContentPart { public: - SubtitleContent (boost::shared_ptr); - SubtitleContent (boost::shared_ptr, boost::filesystem::path); - SubtitleContent (boost::shared_ptr, cxml::ConstNodePtr, int version); - SubtitleContent (boost::shared_ptr, std::vector >); + SubtitleContent (Content* parent, boost::shared_ptr); + SubtitleContent (Content* parent, boost::shared_ptr, cxml::ConstNodePtr, int version); + SubtitleContent (Content* parent, boost::shared_ptr, std::vector >); void as_xml (xmlpp::Node *) const; std::string identifier () const; bool has_subtitles () const; - virtual bool has_text_subtitles () const = 0; - virtual bool has_image_subtitles () const = 0; - virtual double subtitle_video_frame_rate () const = 0; void add_font (boost::shared_ptr font); diff --git a/src/lib/text_subtitle_content.cc b/src/lib/text_subtitle_content.cc index 0de219574..88890ebdc 100644 --- a/src/lib/text_subtitle_content.cc +++ b/src/lib/text_subtitle_content.cc @@ -23,6 +23,7 @@ #include "film.h" #include "font.h" #include "raw_convert.h" +#include "subtitle_content.h" #include #include @@ -40,17 +41,15 @@ int const TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE_COLOUR = 302; TextSubtitleContent::TextSubtitleContent (shared_ptr film, boost::filesystem::path path) : Content (film, path) - , SubtitleContent (film, path) , _colour (255, 255, 255) , _outline (false) , _outline_colour (0, 0, 0) { - + subtitle.reset (new SubtitleContent (this, film, path)); } TextSubtitleContent::TextSubtitleContent (shared_ptr film, cxml::ConstNodePtr node, int version) : Content (film, node) - , SubtitleContent (film, node, version) , _length (node->number_child ("Length")) , _frame_rate (node->optional_number_child("SubtitleVideoFrameRate")) , _colour ( @@ -65,7 +64,7 @@ TextSubtitleContent::TextSubtitleContent (shared_ptr film, cxml::Con node->optional_number_child("OutlineBlue").get_value_or(255) ) { - + subtitle.reset (new SubtitleContent (this, film, node, version)); } void @@ -99,7 +98,7 @@ TextSubtitleContent::as_xml (xmlpp::Node* node) const { node->add_child("Type")->add_child_text ("TextSubtitle"); Content::as_xml (node); - SubtitleContent::as_xml (node); + subtitle->as_xml (node); node->add_child("Length")->add_child_text (raw_convert (_length.get ())); if (_frame_rate) { node->add_child("SubtitleVideoFrameRate")->add_child_text (raw_convert (_frame_rate.get())); diff --git a/src/lib/text_subtitle_content.h b/src/lib/text_subtitle_content.h index 2c8e3b1b7..a2ef5d98a 100644 --- a/src/lib/text_subtitle_content.h +++ b/src/lib/text_subtitle_content.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington + Copyright (C) 2014-2016 Carl Hetherington 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 @@ -17,7 +17,9 @@ */ -#include "subtitle_content.h" +#include "content.h" + +class Job; class TextSubtitleContentProperty { @@ -30,7 +32,7 @@ public: /** @class TextSubtitleContent * @brief SubRip or SSA subtitles. */ -class TextSubtitleContent : public SubtitleContent +class TextSubtitleContent : public Content { public: TextSubtitleContent (boost::shared_ptr, boost::filesystem::path); diff --git a/src/lib/text_subtitle_decoder.cc b/src/lib/text_subtitle_decoder.cc index c94a002f5..36e44cc99 100644 --- a/src/lib/text_subtitle_decoder.cc +++ b/src/lib/text_subtitle_decoder.cc @@ -33,7 +33,7 @@ using boost::optional; using boost::dynamic_pointer_cast; TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr content) - : SubtitleDecoder (content) + : SubtitleDecoder (content->subtitle) , TextSubtitle (content) , _next (0) { -- 2.30.2