diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-07-19 22:44:53 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-07-19 23:45:23 +0100 |
| commit | 27b83475435dda4e84a90cf59a52f150905c4ab1 (patch) | |
| tree | 51d0158c7a879f6b2f3c40843c5e5e455069a1dc /src/lib | |
| parent | 9cb73fbc0fa4643612f01665bc6d9fc430656f32 (diff) | |
Clean up after previous commit.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/active_captions.cc | 4 | ||||
| -rw-r--r-- | src/lib/bitmap_caption.h (renamed from src/lib/bitmap_text.h) | 8 | ||||
| -rw-r--r-- | src/lib/caption_content.cc (renamed from src/lib/text_content.cc) | 180 | ||||
| -rw-r--r-- | src/lib/caption_content.h (renamed from src/lib/text_content.h) | 26 | ||||
| -rw-r--r-- | src/lib/caption_decoder.cc (renamed from src/lib/text_decoder.cc) | 22 | ||||
| -rw-r--r-- | src/lib/caption_decoder.h (renamed from src/lib/text_decoder.h) | 20 | ||||
| -rw-r--r-- | src/lib/content.cc | 6 | ||||
| -rw-r--r-- | src/lib/content.h | 2 | ||||
| -rw-r--r-- | src/lib/content_caption.h (renamed from src/lib/content_text.h) | 24 | ||||
| -rw-r--r-- | src/lib/content_factory.cc | 8 | ||||
| -rw-r--r-- | src/lib/dcp_content.cc | 22 | ||||
| -rw-r--r-- | src/lib/dcp_decoder.cc | 8 | ||||
| -rw-r--r-- | src/lib/dcp_encoder.cc | 12 | ||||
| -rw-r--r-- | src/lib/dcp_encoder.h | 4 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_content.cc (renamed from src/lib/dcp_text_content.cc) | 36 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_content.h (renamed from src/lib/dcp_text_content.h) | 6 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_decoder.cc (renamed from src/lib/dcp_text_decoder.cc) | 18 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_decoder.h (renamed from src/lib/dcp_text_decoder.h) | 8 | ||||
| -rw-r--r-- | src/lib/decoder.cc | 12 | ||||
| -rw-r--r-- | src/lib/decoder.h | 6 | ||||
| -rw-r--r-- | src/lib/decoder_factory.cc | 8 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 28 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 20 | ||||
| -rw-r--r-- | src/lib/film.cc | 12 | ||||
| -rw-r--r-- | src/lib/hints.cc | 6 | ||||
| -rw-r--r-- | src/lib/player.cc | 102 | ||||
| -rw-r--r-- | src/lib/player.h | 10 | ||||
| -rw-r--r-- | src/lib/player_caption.h | 10 | ||||
| -rw-r--r-- | src/lib/playlist.cc | 10 | ||||
| -rw-r--r-- | src/lib/reel_writer.cc | 4 | ||||
| -rw-r--r-- | src/lib/reel_writer.h | 2 | ||||
| -rw-r--r-- | src/lib/text_caption_file.cc (renamed from src/lib/plain_text_file.cc) | 2 | ||||
| -rw-r--r-- | src/lib/text_caption_file.h (renamed from src/lib/plain_text_file.h) | 4 | ||||
| -rw-r--r-- | src/lib/text_caption_file_content.cc | 16 | ||||
| -rw-r--r-- | src/lib/text_caption_file_decoder.cc | 8 | ||||
| -rw-r--r-- | src/lib/text_caption_file_decoder.h | 6 | ||||
| -rw-r--r-- | src/lib/types.cc | 24 | ||||
| -rw-r--r-- | src/lib/types.h | 14 | ||||
| -rw-r--r-- | src/lib/writer.cc | 16 | ||||
| -rw-r--r-- | src/lib/writer.h | 4 | ||||
| -rw-r--r-- | src/lib/wscript | 10 |
41 files changed, 374 insertions, 374 deletions
diff --git a/src/lib/active_captions.cc b/src/lib/active_captions.cc index 972095e37..d41270382 100644 --- a/src/lib/active_captions.cc +++ b/src/lib/active_captions.cc @@ -20,7 +20,7 @@ #include "active_captions.h" #include "piece.h" -#include "text_content.h" +#include "caption_content.h" #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> @@ -47,7 +47,7 @@ ActiveCaptions::get_burnt (DCPTimePeriod period, bool always_burn_subtitles) con continue; } - if (!piece->content->subtitle->use() || (!always_burn_subtitles && !piece->content->subtitle->burn())) { + if (!piece->content->caption->use() || (!always_burn_subtitles && !piece->content->caption->burn())) { /* Not burning this piece */ continue; } diff --git a/src/lib/bitmap_text.h b/src/lib/bitmap_caption.h index 64de7686d..8883272ad 100644 --- a/src/lib/bitmap_text.h +++ b/src/lib/bitmap_caption.h @@ -18,18 +18,18 @@ */ -#ifndef DCPOMATIC_BITMAP_TEXT_H -#define DCPOMATIC_BITMAP_TEXT_H +#ifndef DCPOMATIC_BITMAP_CAPTION_H +#define DCPOMATIC_BITMAP_CAPTION_H #include "rect.h" #include <boost/shared_ptr.hpp> class Image; -class BitmapText +class BitmapCaption { public: - BitmapText (boost::shared_ptr<Image> i, dcpomatic::Rect<double> r) + BitmapCaption (boost::shared_ptr<Image> i, dcpomatic::Rect<double> r) : image (i) , rectangle (r) {} diff --git a/src/lib/text_content.cc b/src/lib/caption_content.cc index 8e1e416eb..33e21bc4a 100644 --- a/src/lib/text_content.cc +++ b/src/lib/caption_content.cc @@ -18,7 +18,7 @@ */ -#include "text_content.h" +#include "caption_content.h" #include "util.h" #include "exceptions.h" #include "font.h" @@ -40,24 +40,24 @@ using boost::dynamic_pointer_cast; using boost::optional; using dcp::raw_convert; -int const TextContentProperty::X_OFFSET = 500; -int const TextContentProperty::Y_OFFSET = 501; -int const TextContentProperty::X_SCALE = 502; -int const TextContentProperty::Y_SCALE = 503; -int const TextContentProperty::USE = 504; -int const TextContentProperty::BURN = 505; -int const TextContentProperty::LANGUAGE = 506; -int const TextContentProperty::FONTS = 507; -int const TextContentProperty::COLOUR = 508; -int const TextContentProperty::EFFECT = 509; -int const TextContentProperty::EFFECT_COLOUR = 510; -int const TextContentProperty::LINE_SPACING = 511; -int const TextContentProperty::FADE_IN = 512; -int const TextContentProperty::FADE_OUT = 513; -int const TextContentProperty::OUTLINE_WIDTH = 514; -int const TextContentProperty::TYPE = 515; - -TextContent::TextContent (Content* parent) +int const CaptionContentProperty::X_OFFSET = 500; +int const CaptionContentProperty::Y_OFFSET = 501; +int const CaptionContentProperty::X_SCALE = 502; +int const CaptionContentProperty::Y_SCALE = 503; +int const CaptionContentProperty::USE = 504; +int const CaptionContentProperty::BURN = 505; +int const CaptionContentProperty::LANGUAGE = 506; +int const CaptionContentProperty::FONTS = 507; +int const CaptionContentProperty::COLOUR = 508; +int const CaptionContentProperty::EFFECT = 509; +int const CaptionContentProperty::EFFECT_COLOUR = 510; +int const CaptionContentProperty::LINE_SPACING = 511; +int const CaptionContentProperty::FADE_IN = 512; +int const CaptionContentProperty::FADE_OUT = 513; +int const CaptionContentProperty::OUTLINE_WIDTH = 514; +int const CaptionContentProperty::TYPE = 515; + +CaptionContent::CaptionContent (Content* parent) : ContentPart (parent) , _use (false) , _burn (false) @@ -67,33 +67,33 @@ TextContent::TextContent (Content* parent) , _y_scale (1) , _line_spacing (1) , _outline_width (2) - , _type (TEXT_SUBTITLE) + , _type (CAPTION_OPEN) { } -shared_ptr<TextContent> -TextContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version) +shared_ptr<CaptionContent> +CaptionContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version) { if (version < 34) { /* With old metadata FFmpeg content has the subtitle-related tags even with no subtitle streams, so check for that. */ if (node->string_child("Type") == "FFmpeg" && node->node_children("SubtitleStream").empty()) { - return shared_ptr<TextContent> (); + return shared_ptr<CaptionContent> (); } /* Otherwise we can drop through to the newer logic */ } if (!node->optional_number_child<double>("SubtitleXOffset") && !node->optional_number_child<double>("SubtitleOffset")) { - return shared_ptr<TextContent> (); + return shared_ptr<CaptionContent> (); } - return shared_ptr<TextContent> (new TextContent (parent, node, version)); + return shared_ptr<CaptionContent> (new CaptionContent (parent, node, version)); } -TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version) +CaptionContent::CaptionContent (Content* parent, cxml::ConstNodePtr node, int version) : ContentPart (parent) , _use (false) , _burn (false) @@ -103,7 +103,7 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version) , _y_scale (1) , _line_spacing (node->optional_number_child<double>("LineSpacing").get_value_or (1)) , _outline_width (node->optional_number_child<int>("OutlineWidth").get_value_or (2)) - , _type (TEXT_SUBTITLE) + , _type (CAPTION_OPEN) { if (version >= 32) { _use = node->bool_child ("UseSubtitles"); @@ -183,55 +183,55 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version) connect_to_fonts (); - _type = string_to_text_type (node->optional_string_child("TextType").get_value_or("subtitle")); + _type = string_to_caption_type (node->optional_string_child("CaptionType").get_value_or("open")); } -TextContent::TextContent (Content* parent, vector<shared_ptr<Content> > c) +CaptionContent::CaptionContent (Content* parent, vector<shared_ptr<Content> > c) : ContentPart (parent) { - shared_ptr<TextContent> ref = c[0]->subtitle; + shared_ptr<CaptionContent> ref = c[0]->caption; DCPOMATIC_ASSERT (ref); list<shared_ptr<Font> > ref_fonts = ref->fonts (); for (size_t i = 1; i < c.size(); ++i) { - if (c[i]->subtitle->use() != ref->use()) { + if (c[i]->caption->use() != ref->use()) { throw JoinError (_("Content to be joined must have the same 'use subtitles' setting.")); } - if (c[i]->subtitle->burn() != ref->burn()) { + if (c[i]->caption->burn() != ref->burn()) { throw JoinError (_("Content to be joined must have the same 'burn subtitles' setting.")); } - if (c[i]->subtitle->x_offset() != ref->x_offset()) { + if (c[i]->caption->x_offset() != ref->x_offset()) { throw JoinError (_("Content to be joined must have the same subtitle X offset.")); } - if (c[i]->subtitle->y_offset() != ref->y_offset()) { + if (c[i]->caption->y_offset() != ref->y_offset()) { throw JoinError (_("Content to be joined must have the same subtitle Y offset.")); } - if (c[i]->subtitle->x_scale() != ref->x_scale()) { + if (c[i]->caption->x_scale() != ref->x_scale()) { throw JoinError (_("Content to be joined must have the same subtitle X scale.")); } - if (c[i]->subtitle->y_scale() != ref->y_scale()) { + if (c[i]->caption->y_scale() != ref->y_scale()) { throw JoinError (_("Content to be joined must have the same subtitle Y scale.")); } - if (c[i]->subtitle->line_spacing() != ref->line_spacing()) { + if (c[i]->caption->line_spacing() != ref->line_spacing()) { throw JoinError (_("Content to be joined must have the same subtitle line spacing.")); } - if ((c[i]->subtitle->fade_in() != ref->fade_in()) || (c[i]->subtitle->fade_out() != ref->fade_out())) { + if ((c[i]->caption->fade_in() != ref->fade_in()) || (c[i]->caption->fade_out() != ref->fade_out())) { throw JoinError (_("Content to be joined must have the same subtitle fades.")); } - if ((c[i]->subtitle->outline_width() != ref->outline_width())) { + if ((c[i]->caption->outline_width() != ref->outline_width())) { throw JoinError (_("Content to be joined must have the same outline width.")); } - list<shared_ptr<Font> > fonts = c[i]->subtitle->fonts (); + list<shared_ptr<Font> > fonts = c[i]->caption->fonts (); if (fonts.size() != ref_fonts.size()) { throw JoinError (_("Content to be joined must use the same fonts.")); } @@ -266,7 +266,7 @@ TextContent::TextContent (Content* parent, vector<shared_ptr<Content> > c) /** _mutex must not be held on entry */ void -TextContent::as_xml (xmlpp::Node* root) const +CaptionContent::as_xml (xmlpp::Node* root) const { boost::mutex::scoped_lock lm (_mutex); @@ -313,11 +313,11 @@ TextContent::as_xml (xmlpp::Node* root) const (*i)->as_xml (root->add_child("Font")); } - root->add_child("TextType")->add_child_text (text_type_to_string(_type)); + root->add_child("CaptionType")->add_child_text (caption_type_to_string(_type)); } string -TextContent::identifier () const +CaptionContent::identifier () const { string s = raw_convert<string> (x_scale()) + "_" + raw_convert<string> (y_scale()) @@ -348,14 +348,14 @@ TextContent::identifier () const } void -TextContent::add_font (shared_ptr<Font> font) +CaptionContent::add_font (shared_ptr<Font> font) { _fonts.push_back (font); connect_to_fonts (); } void -TextContent::connect_to_fonts () +CaptionContent::connect_to_fonts () { BOOST_FOREACH (boost::signals2::connection& i, _font_connections) { i.disconnect (); @@ -364,138 +364,138 @@ TextContent::connect_to_fonts () _font_connections.clear (); BOOST_FOREACH (shared_ptr<Font> i, _fonts) { - _font_connections.push_back (i->Changed.connect (boost::bind (&TextContent::font_changed, this))); + _font_connections.push_back (i->Changed.connect (boost::bind (&CaptionContent::font_changed, this))); } } void -TextContent::font_changed () +CaptionContent::font_changed () { - _parent->signal_changed (TextContentProperty::FONTS); + _parent->signal_changed (CaptionContentProperty::FONTS); } void -TextContent::set_colour (dcp::Colour colour) +CaptionContent::set_colour (dcp::Colour colour) { - maybe_set (_colour, colour, TextContentProperty::COLOUR); + maybe_set (_colour, colour, CaptionContentProperty::COLOUR); } void -TextContent::unset_colour () +CaptionContent::unset_colour () { - maybe_set (_colour, optional<dcp::Colour>(), TextContentProperty::COLOUR); + maybe_set (_colour, optional<dcp::Colour>(), CaptionContentProperty::COLOUR); } void -TextContent::set_effect (dcp::Effect e) +CaptionContent::set_effect (dcp::Effect e) { - maybe_set (_effect, e, TextContentProperty::EFFECT); + maybe_set (_effect, e, CaptionContentProperty::EFFECT); } void -TextContent::unset_effect () +CaptionContent::unset_effect () { - maybe_set (_effect, optional<dcp::Effect>(), TextContentProperty::EFFECT); + maybe_set (_effect, optional<dcp::Effect>(), CaptionContentProperty::EFFECT); } void -TextContent::set_effect_colour (dcp::Colour colour) +CaptionContent::set_effect_colour (dcp::Colour colour) { - maybe_set (_effect_colour, colour, TextContentProperty::EFFECT_COLOUR); + maybe_set (_effect_colour, colour, CaptionContentProperty::EFFECT_COLOUR); } void -TextContent::unset_effect_colour () +CaptionContent::unset_effect_colour () { - maybe_set (_effect_colour, optional<dcp::Colour>(), TextContentProperty::EFFECT_COLOUR); + maybe_set (_effect_colour, optional<dcp::Colour>(), CaptionContentProperty::EFFECT_COLOUR); } void -TextContent::set_use (bool u) +CaptionContent::set_use (bool u) { - maybe_set (_use, u, TextContentProperty::USE); + maybe_set (_use, u, CaptionContentProperty::USE); } void -TextContent::set_burn (bool b) +CaptionContent::set_burn (bool b) { - maybe_set (_burn, b, TextContentProperty::BURN); + maybe_set (_burn, b, CaptionContentProperty::BURN); } void -TextContent::set_x_offset (double o) +CaptionContent::set_x_offset (double o) { - maybe_set (_x_offset, o, TextContentProperty::X_OFFSET); + maybe_set (_x_offset, o, CaptionContentProperty::X_OFFSET); } void -TextContent::set_y_offset (double o) +CaptionContent::set_y_offset (double o) { - maybe_set (_y_offset, o, TextContentProperty::Y_OFFSET); + maybe_set (_y_offset, o, CaptionContentProperty::Y_OFFSET); } void -TextContent::set_x_scale (double s) +CaptionContent::set_x_scale (double s) { - maybe_set (_x_scale, s, TextContentProperty::X_SCALE); + maybe_set (_x_scale, s, CaptionContentProperty::X_SCALE); } void -TextContent::set_y_scale (double s) +CaptionContent::set_y_scale (double s) { - maybe_set (_y_scale, s, TextContentProperty::Y_SCALE); + maybe_set (_y_scale, s, CaptionContentProperty::Y_SCALE); } void -TextContent::set_language (string language) +CaptionContent::set_language (string language) { - maybe_set (_language, language, TextContentProperty::LANGUAGE); + maybe_set (_language, language, CaptionContentProperty::LANGUAGE); } void -TextContent::set_line_spacing (double s) +CaptionContent::set_line_spacing (double s) { - maybe_set (_line_spacing, s, TextContentProperty::LINE_SPACING); + maybe_set (_line_spacing, s, CaptionContentProperty::LINE_SPACING); } void -TextContent::set_fade_in (ContentTime t) +CaptionContent::set_fade_in (ContentTime t) { - maybe_set (_fade_in, t, TextContentProperty::FADE_IN); + maybe_set (_fade_in, t, CaptionContentProperty::FADE_IN); } void -TextContent::unset_fade_in () +CaptionContent::unset_fade_in () { - maybe_set (_fade_in, optional<ContentTime>(), TextContentProperty::FADE_IN); + maybe_set (_fade_in, optional<ContentTime>(), CaptionContentProperty::FADE_IN); } void -TextContent::set_fade_out (ContentTime t) +CaptionContent::set_fade_out (ContentTime t) { - maybe_set (_fade_out, t, TextContentProperty::FADE_OUT); + maybe_set (_fade_out, t, CaptionContentProperty::FADE_OUT); } void -TextContent::unset_fade_out () +CaptionContent::unset_fade_out () { - maybe_set (_fade_out, optional<ContentTime>(), TextContentProperty::FADE_OUT); + maybe_set (_fade_out, optional<ContentTime>(), CaptionContentProperty::FADE_OUT); } void -TextContent::set_type (TextType type) +CaptionContent::set_type (CaptionType type) { - maybe_set (_type, type, TextContentProperty::TYPE); + maybe_set (_type, type, CaptionContentProperty::TYPE); } void -TextContent::set_outline_width (int w) +CaptionContent::set_outline_width (int w) { - maybe_set (_outline_width, w, TextContentProperty::OUTLINE_WIDTH); + maybe_set (_outline_width, w, CaptionContentProperty::OUTLINE_WIDTH); } void -TextContent::take_settings_from (shared_ptr<const TextContent> c) +CaptionContent::take_settings_from (shared_ptr<const CaptionContent> c) { set_use (c->_use); set_burn (c->_burn); @@ -503,7 +503,7 @@ TextContent::take_settings_from (shared_ptr<const TextContent> c) set_y_offset (c->_y_offset); set_x_scale (c->_x_scale); set_y_scale (c->_y_scale); - maybe_set (_fonts, c->_fonts, TextContentProperty::FONTS); + maybe_set (_fonts, c->_fonts, CaptionContentProperty::FONTS); if (c->_colour) { set_colour (*c->_colour); } else { diff --git a/src/lib/text_content.h b/src/lib/caption_content.h index cca678ad2..25f7a1d66 100644 --- a/src/lib/text_content.h +++ b/src/lib/caption_content.h @@ -18,8 +18,8 @@ */ -#ifndef DCPOMATIC_SUBTITLE_CONTENT_H -#define DCPOMATIC_SUBTITLE_CONTENT_H +#ifndef DCPOMATIC_CAPTION_CONTENT_H +#define DCPOMATIC_CAPTION_CONTENT_H #include "content_part.h" #include <libcxml/cxml.h> @@ -28,7 +28,7 @@ class Font; -class TextContentProperty +class CaptionContentProperty { public: static int const X_OFFSET; @@ -49,21 +49,21 @@ public: static int const TYPE; }; -/** @class TextContent +/** @class CaptionContent * @brief Description of how some text content should be presented. * * There are `bitmap' subtitles and `plain' subtitles (plain text), * and not all of the settings in this class correspond to both types. */ -class TextContent : public ContentPart +class CaptionContent : public ContentPart { public: - explicit TextContent (Content* parent); - TextContent (Content* parent, std::vector<boost::shared_ptr<Content> >); + explicit CaptionContent (Content* parent); + CaptionContent (Content* parent, std::vector<boost::shared_ptr<Content> >); void as_xml (xmlpp::Node *) const; std::string identifier () const; - void take_settings_from (boost::shared_ptr<const TextContent> c); + void take_settings_from (boost::shared_ptr<const CaptionContent> c); void add_font (boost::shared_ptr<Font> font); @@ -86,7 +86,7 @@ public: void set_fade_out (ContentTime); void set_outline_width (int); void unset_fade_out (); - void set_type (TextType type); + void set_type (CaptionType type); bool use () const { boost::mutex::scoped_lock lm (_mutex); @@ -163,12 +163,12 @@ public: return _outline_width; } - TextType type () const { + CaptionType type () const { boost::mutex::scoped_lock lm (_mutex); return _type; } - static boost::shared_ptr<TextContent> from_xml (Content* parent, cxml::ConstNodePtr, int version); + static boost::shared_ptr<CaptionContent> from_xml (Content* parent, cxml::ConstNodePtr, int version); protected: /** subtitle language (e.g. "German") or empty if it is not known */ @@ -177,7 +177,7 @@ protected: private: friend struct ffmpeg_pts_offset_test; - TextContent (Content* parent, cxml::ConstNodePtr, int version); + CaptionContent (Content* parent, cxml::ConstNodePtr, int version); void font_changed (); void connect_to_fonts (); @@ -206,7 +206,7 @@ private: boost::optional<ContentTime> _fade_in; boost::optional<ContentTime> _fade_out; int _outline_width; - TextType _type; + CaptionType _type; }; #endif diff --git a/src/lib/text_decoder.cc b/src/lib/caption_decoder.cc index 932a57564..1a2221024 100644 --- a/src/lib/text_decoder.cc +++ b/src/lib/caption_decoder.cc @@ -18,8 +18,8 @@ */ -#include "text_decoder.h" -#include "text_content.h" +#include "caption_decoder.h" +#include "caption_content.h" #include "util.h" #include "log.h" #include "compose.hpp" @@ -37,9 +37,9 @@ using boost::shared_ptr; using boost::optional; using boost::function; -TextDecoder::TextDecoder ( +CaptionDecoder::CaptionDecoder ( Decoder* parent, - shared_ptr<const TextContent> c, + shared_ptr<const CaptionContent> c, shared_ptr<Log> log, ContentTime first ) @@ -58,14 +58,14 @@ TextDecoder::TextDecoder ( * of the video frame) */ void -TextDecoder::emit_bitmap_start (ContentTime from, shared_ptr<Image> image, dcpomatic::Rect<double> rect) +CaptionDecoder::emit_bitmap_start (ContentTime from, shared_ptr<Image> image, dcpomatic::Rect<double> rect) { BitmapStart (ContentBitmapCaption (from, _content->type(), image, rect)); _position = from; } void -TextDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s) +CaptionDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s) { BOOST_FOREACH (dcp::SubtitleString& i, s) { /* We must escape < and > in strings, otherwise they might confuse our subtitle @@ -99,7 +99,7 @@ TextDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s) } void -TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle) +CaptionDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle) { /* See if our next subtitle needs to be vertically placed on screen by us */ bool needs_placement = false; @@ -231,27 +231,27 @@ TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle) } void -TextDecoder::emit_stop (ContentTime to) +CaptionDecoder::emit_stop (ContentTime to) { Stop (to, _content->type()); } void -TextDecoder::emit_plain (ContentTimePeriod period, list<dcp::SubtitleString> s) +CaptionDecoder::emit_plain (ContentTimePeriod period, list<dcp::SubtitleString> s) { emit_plain_start (period.from, s); emit_stop (period.to); } void -TextDecoder::emit_plain (ContentTimePeriod period, sub::Subtitle const & s) +CaptionDecoder::emit_plain (ContentTimePeriod period, sub::Subtitle const & s) { emit_plain_start (period.from, s); emit_stop (period.to); } void -TextDecoder::seek () +CaptionDecoder::seek () { _position = ContentTime (); } diff --git a/src/lib/text_decoder.h b/src/lib/caption_decoder.h index ed2763916..d555446c7 100644 --- a/src/lib/text_decoder.h +++ b/src/lib/caption_decoder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2017 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,13 +18,13 @@ */ -#ifndef DCPOMATIC_SUBTITLE_DECODER_H -#define DCPOMATIC_SUBTITLE_DECODER_H +#ifndef DCPOMATIC_CAPTION_DECODER_H +#define DCPOMATIC_CAPTION_DECODER_H #include "decoder.h" #include "rect.h" #include "types.h" -#include "content_text.h" +#include "content_caption.h" #include "decoder_part.h" #include <dcp/subtitle_string.h> #include <boost/signals2.hpp> @@ -35,12 +35,12 @@ namespace sub { class Image; -class TextDecoder : public DecoderPart +class CaptionDecoder : public DecoderPart { public: - TextDecoder ( + CaptionDecoder ( Decoder* parent, - boost::shared_ptr<const TextContent>, + boost::shared_ptr<const CaptionContent>, boost::shared_ptr<Log> log, ContentTime first ); @@ -58,16 +58,16 @@ public: void seek (); - boost::shared_ptr<const TextContent> content () const { + boost::shared_ptr<const CaptionContent> content () const { return _content; } boost::signals2::signal<void (ContentBitmapCaption)> BitmapStart; boost::signals2::signal<void (ContentTextCaption)> PlainStart; - boost::signals2::signal<void (ContentTime, TextType)> Stop; + boost::signals2::signal<void (ContentTime, CaptionType)> Stop; private: - boost::shared_ptr<const TextContent> _content; + boost::shared_ptr<const CaptionContent> _content; ContentTime _position; }; diff --git a/src/lib/content.cc b/src/lib/content.cc index 1a8bc9eb2..af4c6c701 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -27,7 +27,7 @@ #include "content_factory.h" #include "video_content.h" #include "audio_content.h" -#include "text_content.h" +#include "caption_content.h" #include "exceptions.h" #include "film.h" #include "job.h" @@ -436,7 +436,7 @@ Content::take_settings_from (shared_ptr<const Content> c) if (audio && c->audio) { audio->take_settings_from (c->audio); } - if (subtitle && c->subtitle) { - subtitle->take_settings_from (c->subtitle); + if (caption && c->caption) { + caption->take_settings_from (c->caption); } } diff --git a/src/lib/content.h b/src/lib/content.h index 63d03fd71..7ff20e96c 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -182,7 +182,7 @@ public: boost::shared_ptr<VideoContent> video; boost::shared_ptr<AudioContent> audio; - boost::shared_ptr<TextContent> subtitle; + boost::shared_ptr<CaptionContent> caption; void signal_changed (int); diff --git a/src/lib/content_text.h b/src/lib/content_caption.h index 1b550c96d..ad83fcb89 100644 --- a/src/lib/content_text.h +++ b/src/lib/content_caption.h @@ -24,16 +24,16 @@ #include "dcpomatic_time.h" #include "rect.h" #include "types.h" -#include "bitmap_text.h" +#include "bitmap_caption.h" #include <dcp/subtitle_string.h> #include <list> class Image; -class ContentText +class ContentCaption { public: - explicit ContentText (ContentTime f, TextType t) + explicit ContentCaption (ContentTime f, CaptionType t) : _from (f) , _type (t) {} @@ -42,36 +42,36 @@ public: return _from; } - TextType type () const { + CaptionType type () const { return _type; } private: ContentTime _from; - TextType _type; + CaptionType _type; }; -class ContentBitmapCaption : public ContentText +class ContentBitmapCaption : public ContentCaption { public: - ContentBitmapCaption (ContentTime f, TextType type, boost::shared_ptr<Image> im, dcpomatic::Rect<double> r) - : ContentText (f, type) + ContentBitmapCaption (ContentTime f, CaptionType type, boost::shared_ptr<Image> im, dcpomatic::Rect<double> r) + : ContentCaption (f, type) , sub (im, r) {} /* Our text, with its rectangle unmodified by any offsets or scales that the content specifies */ - BitmapText sub; + BitmapCaption sub; }; /** A text caption. We store the time period separately (as well as in the dcp::SubtitleStrings) * as the dcp::SubtitleString timings are sometimes quite heavily quantised and this causes problems * when we want to compare the quantised periods to the unquantised ones. */ -class ContentTextCaption : public ContentText +class ContentTextCaption : public ContentCaption { public: - ContentTextCaption (ContentTime f, TextType type, std::list<dcp::SubtitleString> s) - : ContentText (f, type) + ContentTextCaption (ContentTime f, CaptionType type, std::list<dcp::SubtitleString> s) + : ContentCaption (f, type) , subs (s) {} diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index 9429f1c46..8c473b7bc 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -28,7 +28,7 @@ #include "atmos_mxf_content.h" #include "text_caption_file_content.h" #include "dcp_content.h" -#include "dcp_text_content.h" +#include "dcp_subtitle_content.h" #include "util.h" #include "ffmpeg_audio_stream.h" #include "video_mxf_content.h" @@ -92,7 +92,7 @@ content_factory (shared_ptr<const Film> film, cxml::NodePtr node, int version, l } else if (type == "DCP") { content.reset (new DCPContent (film, node, version)); } else if (type == "DCPSubtitle") { - content.reset (new DCPTextContent (film, node, version)); + content.reset (new DCPSubtitleContent (film, node, version)); } else if (type == "VideoMXF") { content.reset (new VideoMXFContent (film, node, version)); } else if (type == "AtmosMXF") { @@ -217,9 +217,9 @@ content_factory (shared_ptr<const Film> film, boost::filesystem::path path) if (doc.root_name() == "DCinemaSecurityMessage") { throw KDMAsContentError (); } - single.reset (new DCPTextContent (film, path)); + single.reset (new DCPSubtitleContent (film, path)); } else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf (path)) { - single.reset (new DCPTextContent (film, path)); + single.reset (new DCPSubtitleContent (film, path)); } else if (ext == ".mxf" && VideoMXFContent::valid_mxf (path)) { single.reset (new VideoMXFContent (film, path)); } else if (ext == ".mxf" && AtmosMXFContent::valid_mxf (path)) { diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index d4891ad45..e02eb7bd9 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -28,7 +28,7 @@ #include "overlaps.h" #include "compose.hpp" #include "dcp_decoder.h" -#include "text_content.h" +#include "caption_content.h" #include <dcp/dcp.h> #include <dcp/raw_convert.h> #include <dcp/exceptions.h> @@ -81,7 +81,7 @@ DCPContent::DCPContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, in { video = VideoContent::from_xml (this, node, version); audio = AudioContent::from_xml (this, node, version); - subtitle = TextContent::from_xml (this, node, version); + caption = CaptionContent::from_xml (this, node, version); if (video && audio) { audio->set_stream ( @@ -143,7 +143,7 @@ DCPContent::examine (shared_ptr<Job> job) bool const needed_assets = needs_assets (); bool const needed_kdm = needs_kdm (); string const old_name = name (); - bool had_subtitles = static_cast<bool> (subtitle); + bool had_subtitles = static_cast<bool> (caption); if (job) { job->set_progress_unknown (); @@ -179,11 +179,11 @@ DCPContent::examine (shared_ptr<Job> job) boost::mutex::scoped_lock lm (_mutex); _name = examiner->name (); if (examiner->has_subtitles ()) { - subtitle.reset (new TextContent (this)); + caption.reset (new CaptionContent (this)); } else { - subtitle.reset (); + caption.reset (); } - has_subtitles = static_cast<bool> (subtitle); + has_subtitles = static_cast<bool> (caption); _encrypted = examiner->encrypted (); _needs_assets = examiner->needs_assets (); _kdm_valid = examiner->kdm_valid (); @@ -254,8 +254,8 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const audio->stream()->mapping().as_xml (node->add_child("AudioMapping")); } - if (subtitle) { - subtitle->as_xml (node); + if (caption) { + caption->as_xml (node); } boost::mutex::scoped_lock lm (_mutex); @@ -309,8 +309,8 @@ DCPContent::identifier () const s += video->identifier() + "_"; } - if (subtitle) { - s += subtitle->identifier () + " "; + if (caption) { + s += caption->identifier () + " "; } s += string (_reference_video ? "1" : "0") + string (_reference_subtitle ? "1" : "0"); @@ -584,7 +584,7 @@ DCPContent::can_reference_subtitle (string& why_not) const } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (bind (&Content::subtitle, _1), _("it overlaps other subtitle content; remove the other content."), why_not); + return can_reference (bind (&Content::caption, _1), _("it overlaps other caption content; remove the other content."), why_not); } void diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 6a9de841d..cc415629b 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -24,7 +24,7 @@ #include "video_decoder.h" #include "audio_decoder.h" #include "j2k_image_proxy.h" -#include "text_decoder.h" +#include "caption_decoder.h" #include "image.h" #include "config.h" #include <dcp/dcp.h> @@ -62,9 +62,9 @@ DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log, boo if (c->audio) { audio.reset (new AudioDecoder (this, c->audio, log, fast)); } - if (c->subtitle) { + if (c->caption) { /* XXX: this time here should be the time of the first subtitle, not 0 */ - subtitle.reset (new TextDecoder (this, c->subtitle, log, ContentTime())); + caption.reset (new CaptionDecoder (this, c->caption, log, ContentTime())); } list<shared_ptr<dcp::CPL> > cpl_list = cpls (); @@ -209,7 +209,7 @@ DCPDecoder::pass_subtitles (ContentTime next) if (is) { list<dcp::SubtitleString> s; s.push_back (*is); - subtitle->emit_plain ( + caption->emit_plain ( ContentTimePeriod ( ContentTime::from_frames (_offset - entry_point, vfr) + ContentTime::from_seconds (i->in().as_seconds ()), ContentTime::from_frames (_offset - entry_point, vfr) + ContentTime::from_seconds (i->out().as_seconds ()) diff --git a/src/lib/dcp_encoder.cc b/src/lib/dcp_encoder.cc index 9766aad33..541c23b6c 100644 --- a/src/lib/dcp_encoder.cc +++ b/src/lib/dcp_encoder.cc @@ -35,7 +35,7 @@ #include "writer.h" #include "compose.hpp" #include "referenced_reel_asset.h" -#include "text_content.h" +#include "caption_content.h" #include "player_video.h" #include <boost/signals2.hpp> #include <boost/foreach.hpp> @@ -61,10 +61,10 @@ DCPEncoder::DCPEncoder (shared_ptr<const Film> film, weak_ptr<Job> job) { _player_video_connection = _player->Video.connect (bind (&DCPEncoder::video, this, _1, _2)); _player_audio_connection = _player->Audio.connect (bind (&DCPEncoder::audio, this, _1, _2)); - _player_text_connection = _player->Text.connect (bind (&DCPEncoder::text, this, _1, _2, _3)); + _player_caption_connection = _player->Caption.connect (bind (&DCPEncoder::caption, this, _1, _2, _3)); BOOST_FOREACH (shared_ptr<const Content> c, film->content ()) { - if (c->subtitle && c->subtitle->use() && !c->subtitle->burn()) { + if (c->caption && c->caption->use() && !c->caption->burn()) { _non_burnt_subtitles = true; } } @@ -75,7 +75,7 @@ DCPEncoder::~DCPEncoder () /* We must stop receiving more video data before we die */ _player_video_connection.release (); _player_audio_connection.release (); - _player_text_connection.release (); + _player_caption_connection.release (); } void @@ -141,9 +141,9 @@ DCPEncoder::audio (shared_ptr<AudioBuffers> data, DCPTime time) } void -DCPEncoder::text (PlayerCaption data, TextType type, DCPTimePeriod period) +DCPEncoder::caption (PlayerCaption data, CaptionType type, DCPTimePeriod period) { - if (type == TEXT_CLOSED_CAPTION || _non_burnt_subtitles) { + if (type == CAPTION_CLOSED || _non_burnt_subtitles) { _writer->write (data, type, period); } } diff --git a/src/lib/dcp_encoder.h b/src/lib/dcp_encoder.h index 850ead656..9808987c3 100644 --- a/src/lib/dcp_encoder.h +++ b/src/lib/dcp_encoder.h @@ -52,7 +52,7 @@ private: void video (boost::shared_ptr<PlayerVideo>, DCPTime); void audio (boost::shared_ptr<AudioBuffers>, DCPTime); - void text (PlayerCaption, TextType, DCPTimePeriod); + void caption (PlayerCaption, CaptionType, DCPTimePeriod); boost::shared_ptr<Writer> _writer; boost::shared_ptr<J2KEncoder> _j2k_encoder; @@ -61,5 +61,5 @@ private: boost::signals2::scoped_connection _player_video_connection; boost::signals2::scoped_connection _player_audio_connection; - boost::signals2::scoped_connection _player_text_connection; + boost::signals2::scoped_connection _player_caption_connection; }; diff --git a/src/lib/dcp_text_content.cc b/src/lib/dcp_subtitle_content.cc index 9e7524be3..17477cfb8 100644 --- a/src/lib/dcp_text_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -19,9 +19,9 @@ */ #include "font.h" -#include "dcp_text_content.h" +#include "dcp_subtitle_content.h" #include "film.h" -#include "text_content.h" +#include "caption_content.h" #include <dcp/raw_convert.h> #include <dcp/interop_subtitle_asset.h> #include <dcp/smpte_subtitle_asset.h> @@ -37,21 +37,21 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using dcp::raw_convert; -DCPTextContent::DCPTextContent (shared_ptr<const Film> film, boost::filesystem::path path) +DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path) : Content (film, path) { - subtitle.reset (new TextContent (this)); + caption.reset (new CaptionContent (this)); } -DCPTextContent::DCPTextContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) +DCPSubtitleContent::DCPSubtitleContent (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); + caption = CaptionContent::from_xml (this, node, version); } void -DCPTextContent::examine (shared_ptr<Job> job) +DCPSubtitleContent::examine (shared_ptr<Job> job) { Content::examine (job); @@ -66,48 +66,48 @@ DCPTextContent::examine (shared_ptr<Job> job) boost::mutex::scoped_lock lm (_mutex); /* Default to turning these subtitles on */ - subtitle->set_use (true); + caption->set_use (true); if (iop) { - subtitle->set_language (iop->language ()); + caption->set_language (iop->language ()); } else if (smpte) { - subtitle->set_language (smpte->language().get_value_or ("")); + caption->set_language (smpte->language().get_value_or ("")); } _length = ContentTime::from_seconds (sc->latest_subtitle_out().as_seconds ()); BOOST_FOREACH (shared_ptr<dcp::LoadFontNode> i, sc->load_font_nodes ()) { - subtitle->add_font (shared_ptr<Font> (new Font (i->id))); + caption->add_font (shared_ptr<Font> (new Font (i->id))); } } DCPTime -DCPTextContent::full_length () const +DCPSubtitleContent::full_length () const { FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate()); return DCPTime (_length, frc); } string -DCPTextContent::summary () const +DCPSubtitleContent::summary () const { return path_summary() + " " + _("[subtitles]"); } string -DCPTextContent::technical_summary () const +DCPSubtitleContent::technical_summary () const { return Content::technical_summary() + " - " + _("DCP XML subtitles"); } void -DCPTextContent::as_xml (xmlpp::Node* node, bool with_paths) const +DCPSubtitleContent::as_xml (xmlpp::Node* node, bool with_paths) const { node->add_child("Type")->add_child_text ("DCPSubtitle"); Content::as_xml (node, with_paths); - if (subtitle) { - subtitle->as_xml (node); + if (caption) { + caption->as_xml (node); } node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ())); diff --git a/src/lib/dcp_text_content.h b/src/lib/dcp_subtitle_content.h index 894cc0384..36945adcd 100644 --- a/src/lib/dcp_text_content.h +++ b/src/lib/dcp_subtitle_content.h @@ -21,11 +21,11 @@ #include "dcp_subtitle.h" #include "content.h" -class DCPTextContent : public DCPSubtitle, public Content +class DCPSubtitleContent : public DCPSubtitle, public Content { public: - DCPTextContent (boost::shared_ptr<const Film>, boost::filesystem::path); - DCPTextContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int); + DCPSubtitleContent (boost::shared_ptr<const Film>, boost::filesystem::path); + DCPSubtitleContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int); void examine (boost::shared_ptr<Job>); std::string summary () const; diff --git a/src/lib/dcp_text_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 168bfa5cc..c7a9a863f 100644 --- a/src/lib/dcp_text_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -18,8 +18,8 @@ */ -#include "dcp_text_decoder.h" -#include "dcp_text_content.h" +#include "dcp_subtitle_decoder.h" +#include "dcp_subtitle_content.h" #include <dcp/interop_subtitle_asset.h> #include <iostream> @@ -29,7 +29,7 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using boost::bind; -DCPTextDecoder::DCPTextDecoder (shared_ptr<const DCPTextContent> content, shared_ptr<Log> log) +DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const DCPSubtitleContent> content, shared_ptr<Log> log) { shared_ptr<dcp::SubtitleAsset> c (load (content->path (0))); _subtitles = c->subtitles (); @@ -39,11 +39,11 @@ DCPTextDecoder::DCPTextDecoder (shared_ptr<const DCPTextContent> content, shared if (_next != _subtitles.end()) { first = content_time_period(*_next).from; } - subtitle.reset (new TextDecoder (this, content->subtitle, log, first)); + caption.reset (new CaptionDecoder (this, content->caption, log, first)); } void -DCPTextDecoder::seek (ContentTime time, bool accurate) +DCPSubtitleDecoder::seek (ContentTime time, bool accurate) { Decoder::seek (time, accurate); @@ -55,7 +55,7 @@ DCPTextDecoder::seek (ContentTime time, bool accurate) } bool -DCPTextDecoder::pass () +DCPSubtitleDecoder::pass () { if (_next == _subtitles.end ()) { return true; @@ -64,7 +64,7 @@ DCPTextDecoder::pass () /* Gather all subtitles with the same time period that are next on the list. We must emit all subtitles for the same time period with the same plain_text() call otherwise the - TextDecoder will assume there is nothing else at the + CaptionDecoder will assume there is nothing else at the time of emit the first. */ @@ -81,12 +81,12 @@ DCPTextDecoder::pass () /* XXX: image subtitles */ } - subtitle->emit_plain (p, s); + caption->emit_plain (p, s); return false; } ContentTimePeriod -DCPTextDecoder::content_time_period (shared_ptr<dcp::Subtitle> s) const +DCPSubtitleDecoder::content_time_period (shared_ptr<dcp::Subtitle> s) const { return ContentTimePeriod ( ContentTime::from_seconds (s->in().as_seconds ()), diff --git a/src/lib/dcp_text_decoder.h b/src/lib/dcp_subtitle_decoder.h index f1b51b823..ef4dad3f5 100644 --- a/src/lib/dcp_text_decoder.h +++ b/src/lib/dcp_subtitle_decoder.h @@ -18,15 +18,15 @@ */ -#include "text_decoder.h" +#include "caption_decoder.h" #include "dcp_subtitle.h" -class DCPTextContent; +class DCPSubtitleContent; -class DCPTextDecoder : public DCPSubtitle, public Decoder +class DCPSubtitleDecoder : public DCPSubtitle, public Decoder { public: - DCPTextDecoder (boost::shared_ptr<const DCPTextContent>, boost::shared_ptr<Log> log); + DCPSubtitleDecoder (boost::shared_ptr<const DCPSubtitleContent>, boost::shared_ptr<Log> log); bool pass (); void seek (ContentTime time, bool accurate); diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index e7e6b8620..70eb5b61a 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -21,7 +21,7 @@ #include "decoder.h" #include "video_decoder.h" #include "audio_decoder.h" -#include "text_decoder.h" +#include "caption_decoder.h" #include <boost/optional.hpp> #include <iostream> @@ -42,8 +42,8 @@ Decoder::position () const pos = audio->position(); } - if (subtitle && !subtitle->ignore() && (!pos || subtitle->position() < *pos)) { - pos = subtitle->position(); + if (caption && !caption->ignore() && (!pos || caption->position() < *pos)) { + pos = caption->position(); } return pos.get_value_or(ContentTime()); @@ -58,7 +58,7 @@ Decoder::seek (ContentTime, bool) if (audio) { audio->seek (); } - if (subtitle) { - subtitle->seek (); + if (caption) { + caption->seek (); } } diff --git a/src/lib/decoder.h b/src/lib/decoder.h index 27f0b1141..c3b330cfb 100644 --- a/src/lib/decoder.h +++ b/src/lib/decoder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -32,7 +32,7 @@ class Decoded; class VideoDecoder; class AudioDecoder; -class TextDecoder; +class CaptionDecoder; class DecoderPart; /** @class Decoder. @@ -45,7 +45,7 @@ public: boost::shared_ptr<VideoDecoder> video; boost::shared_ptr<AudioDecoder> audio; - boost::shared_ptr<TextDecoder> subtitle; + boost::shared_ptr<CaptionDecoder> caption; /** Do some decoding and perhaps emit video, audio or subtitle data. * @return true if this decoder will emit no more data unless a seek() happens. diff --git a/src/lib/decoder_factory.cc b/src/lib/decoder_factory.cc index 3d4ce8a7b..bb3bdb13e 100644 --- a/src/lib/decoder_factory.cc +++ b/src/lib/decoder_factory.cc @@ -26,8 +26,8 @@ #include "image_decoder.h" #include "text_caption_file_content.h" #include "text_caption_file_decoder.h" -#include "dcp_text_content.h" -#include "dcp_text_decoder.h" +#include "dcp_subtitle_content.h" +#include "dcp_subtitle_decoder.h" #include "video_mxf_content.h" #include "video_mxf_decoder.h" #include <boost/foreach.hpp> @@ -59,9 +59,9 @@ decoder_factory (shared_ptr<const Content> content, shared_ptr<Log> log, bool fa return shared_ptr<Decoder> (new TextCaptionFileDecoder (rc, log)); } - shared_ptr<const DCPTextContent> dsc = dynamic_pointer_cast<const DCPTextContent> (content); + shared_ptr<const DCPSubtitleContent> dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content); if (dsc) { - return shared_ptr<Decoder> (new DCPTextDecoder (dsc, log)); + return shared_ptr<Decoder> (new DCPSubtitleDecoder (dsc, log)); } shared_ptr<const VideoMXFContent> vmc = dynamic_pointer_cast<const VideoMXFContent> (content); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index e18977944..dd4ed7063 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -32,7 +32,7 @@ #include "log.h" #include "exceptions.h" #include "frame_rate_change.h" -#include "text_content.h" +#include "caption_content.h" #include <dcp/raw_convert.h> #include <libcxml/cxml.h> extern "C" { @@ -85,7 +85,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no { video = VideoContent::from_xml (this, node, version); audio = AudioContent::from_xml (this, node, version); - subtitle = TextContent::from_xml (this, node, version); + caption = CaptionContent::from_xml (this, node, version); list<cxml::NodePtr> c = node->node_children ("SubtitleStream"); for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) { @@ -135,12 +135,12 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Con bool need_video = false; bool need_audio = false; - bool need_subtitle = false; + bool need_caption = false; if (i != c.end ()) { need_video = static_cast<bool> ((*i)->video); need_audio = static_cast<bool> ((*i)->audio); - need_subtitle = static_cast<bool> ((*i)->subtitle); + need_caption = static_cast<bool> ((*i)->caption); } while (i != c.end ()) { @@ -150,8 +150,8 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Con if (need_audio != static_cast<bool> ((*i)->audio)) { throw JoinError (_("Content to be joined must all have or not have audio")); } - if (need_subtitle != static_cast<bool> ((*i)->subtitle)) { - throw JoinError (_("Content to be joined must all have or not have subtitles")); + if (need_caption != static_cast<bool> ((*i)->caption)) { + throw JoinError (_("Content to be joined must all have or not have captions")); } ++i; } @@ -162,8 +162,8 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Con if (need_audio) { audio.reset (new AudioContent (this, c)); } - if (need_subtitle) { - subtitle.reset (new TextContent (this, c)); + if (need_caption) { + caption.reset (new CaptionContent (this, c)); } shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]); @@ -171,7 +171,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Con for (size_t i = 0; i < c.size(); ++i) { shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c[i]); - if (fc->subtitle && fc->subtitle->use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { + if (fc->caption && fc->caption->use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { throw JoinError (_("Content to be joined must use the same subtitle stream.")); } } @@ -209,8 +209,8 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const } } - if (subtitle) { - subtitle->as_xml (node); + if (caption) { + caption->as_xml (node); } boost::mutex::scoped_lock lm (_mutex); @@ -303,7 +303,7 @@ FFmpegContent::examine (shared_ptr<Job> job) _subtitle_streams = examiner->subtitle_streams (); if (!_subtitle_streams.empty ()) { - subtitle.reset (new TextContent (this)); + caption.reset (new CaptionContent (this)); _subtitle_stream = _subtitle_streams.front (); } @@ -426,8 +426,8 @@ FFmpegContent::identifier () const s += "_" + video->identifier(); } - if (subtitle && subtitle->use() && subtitle->burn()) { - s += "_" + subtitle->identifier(); + if (caption && caption->use() && caption->burn()) { + s += "_" + caption->identifier(); } boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 909a9d443..9478d8816 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -28,7 +28,7 @@ #include "util.h" #include "log.h" #include "ffmpeg_decoder.h" -#include "text_decoder.h" +#include "caption_decoder.h" #include "ffmpeg_audio_stream.h" #include "ffmpeg_subtitle_stream.h" #include "video_filter_graph.h" @@ -39,7 +39,7 @@ #include "film.h" #include "audio_decoder.h" #include "compose.hpp" -#include "text_content.h" +#include "caption_content.h" #include "audio_content.h" #include <dcp/subtitle_string.h> #include <sub/ssa_reader.h> @@ -97,9 +97,9 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const FFmpegContent> c, shared_ptr<Log> audio.reset (new AudioDecoder (this, c->audio, log, fast)); } - if (c->subtitle) { + if (c->caption) { /* XXX: this time here should be the time of the first subtitle, not 0 */ - subtitle.reset (new TextDecoder (this, c->subtitle, log, ContentTime())); + caption.reset (new CaptionDecoder (this, c->caption, log, ContentTime())); } _next_time.resize (_format_context->nb_streams); @@ -184,7 +184,7 @@ FFmpegDecoder::pass () if (_video_stream && si == _video_stream.get() && !video->ignore()) { decode_video_packet (); - } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !subtitle->ignore()) { + } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !caption->ignore()) { decode_subtitle_packet (); } else { decode_audio_packet (); @@ -549,9 +549,9 @@ FFmpegDecoder::decode_subtitle_packet () /* Stop any current subtitle, either at the time it was supposed to stop, or now if now is sooner */ if (_have_current_subtitle) { if (_current_subtitle_to) { - subtitle->emit_stop (min(*_current_subtitle_to, subtitle_period(sub).from + _pts_offset)); + caption->emit_stop (min(*_current_subtitle_to, subtitle_period(sub).from + _pts_offset)); } else { - subtitle->emit_stop (subtitle_period(sub).from + _pts_offset); + caption->emit_stop (subtitle_period(sub).from + _pts_offset); } _have_current_subtitle = false; } @@ -593,7 +593,7 @@ FFmpegDecoder::decode_subtitle_packet () } if (_current_subtitle_to) { - subtitle->emit_stop (*_current_subtitle_to); + caption->emit_stop (*_current_subtitle_to); } avsubtitle_free (&sub); @@ -669,7 +669,7 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTime static_cast<double> (rect->h) / target_height ); - subtitle->emit_bitmap_start (from, image, scaled_rect); + caption->emit_bitmap_start (from, image, scaled_rect); } void @@ -702,6 +702,6 @@ FFmpegDecoder::decode_ass_subtitle (string ass, ContentTime from) ); BOOST_FOREACH (sub::Subtitle const & i, sub::collect<list<sub::Subtitle> > (raw)) { - subtitle->emit_plain_start (from, i); + caption->emit_plain_start (from, i); } } diff --git a/src/lib/film.cc b/src/lib/film.cc index 0be1ddd7b..f6941c1c7 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -46,7 +46,7 @@ #include "screen.h" #include "audio_content.h" #include "video_content.h" -#include "text_content.h" +#include "caption_content.h" #include "ffmpeg_content.h" #include "dcp_content.h" #include "screen_kdm.h" @@ -696,11 +696,11 @@ Film::isdcf_name (bool if_created_now) const bool burnt_in = true; BOOST_FOREACH (shared_ptr<Content> i, content ()) { - if (!i->subtitle) { + if (!i->caption) { continue; } - if (i->subtitle->use() && !i->subtitle->burn()) { + if (i->caption->use() && !i->caption->burn()) { burnt_in = false; } } @@ -1081,7 +1081,7 @@ Film::add_content (shared_ptr<Content> c) /* Add {video,subtitle} content after any existing {video,subtitle} content */ if (c->video) { c->set_position (_playlist->video_end ()); - } else if (c->subtitle) { + } else if (c->caption) { c->set_position (_playlist->subtitle_end ()); } @@ -1371,8 +1371,8 @@ Film::subtitle_language () const ContentList cl = content (); BOOST_FOREACH (shared_ptr<Content>& c, cl) { - if (c->subtitle) { - languages.insert (c->subtitle->language ()); + if (c->caption) { + languages.insert (c->caption->language ()); } } diff --git a/src/lib/hints.cc b/src/lib/hints.cc index d29002ad5..eb3ea1d02 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -23,7 +23,7 @@ #include "film.h" #include "content.h" #include "video_content.h" -#include "text_content.h" +#include "caption_content.h" #include "audio_processor.h" #include "font.h" #include "ratio.h" @@ -56,8 +56,8 @@ get_hints (shared_ptr<const Film> film) bool big_font_files = false; if (film->interop ()) { BOOST_FOREACH (shared_ptr<Content> i, content) { - if (i->subtitle) { - BOOST_FOREACH (shared_ptr<Font> j, i->subtitle->fonts ()) { + if (i->caption) { + BOOST_FOREACH (shared_ptr<Font> j, i->caption->fonts ()) { for (int k = 0; k < FontFiles::VARIANTS; ++k) { optional<boost::filesystem::path> const p = j->file (static_cast<FontFiles::Variant> (k)); if (p && boost::filesystem::file_size (p.get()) >= (640 * 1024)) { diff --git a/src/lib/player.cc b/src/lib/player.cc index a7cd0fd94..7040bd530 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -40,8 +40,8 @@ #include "decoder.h" #include "video_decoder.h" #include "audio_decoder.h" -#include "text_content.h" -#include "text_decoder.h" +#include "caption_content.h" +#include "caption_decoder.h" #include "ffmpeg_content.h" #include "audio_content.h" #include "dcp_decoder.h" @@ -137,8 +137,8 @@ Player::setup_pieces () decoder->video->set_ignore (true); } - if (decoder->subtitle && _ignore_subtitle) { - decoder->subtitle->set_ignore (true); + if (decoder->caption && _ignore_subtitle) { + decoder->caption->set_ignore (true); } shared_ptr<DCPDecoder> dcp = dynamic_pointer_cast<DCPDecoder> (decoder); @@ -165,10 +165,10 @@ Player::setup_pieces () decoder->audio->Data.connect (bind (&Player::audio, this, weak_ptr<Piece> (piece), _1, _2)); } - if (decoder->subtitle) { - decoder->subtitle->BitmapStart.connect (bind (&Player::bitmap_text_start, this, weak_ptr<Piece> (piece), _1)); - decoder->subtitle->PlainStart.connect (bind (&Player::plain_text_start, this, weak_ptr<Piece> (piece), _1)); - decoder->subtitle->Stop.connect (bind (&Player::subtitle_stop, this, weak_ptr<Piece> (piece), _1, _2)); + if (decoder->caption) { + decoder->caption->BitmapStart.connect (bind (&Player::bitmap_text_start, this, weak_ptr<Piece> (piece), _1)); + decoder->caption->PlainStart.connect (bind (&Player::plain_text_start, this, weak_ptr<Piece> (piece), _1)); + decoder->caption->Stop.connect (bind (&Player::subtitle_stop, this, weak_ptr<Piece> (piece), _1, _2)); } } @@ -209,9 +209,9 @@ Player::playlist_content_changed (weak_ptr<Content> w, int property, bool freque property == AudioContentProperty::STREAMS || property == DCPContentProperty::NEEDS_ASSETS || property == DCPContentProperty::NEEDS_KDM || - property == TextContentProperty::COLOUR || - property == TextContentProperty::EFFECT || - property == TextContentProperty::EFFECT_COLOUR || + property == CaptionContentProperty::COLOUR || + property == CaptionContentProperty::EFFECT || + property == CaptionContentProperty::EFFECT_COLOUR || property == FFmpegContentProperty::SUBTITLE_STREAM || property == FFmpegContentProperty::FILTERS ) { @@ -220,17 +220,17 @@ Player::playlist_content_changed (weak_ptr<Content> w, int property, bool freque Changed (property, frequent); } else if ( - property == TextContentProperty::LINE_SPACING || - property == TextContentProperty::OUTLINE_WIDTH || - property == TextContentProperty::Y_SCALE || - property == TextContentProperty::FADE_IN || - property == TextContentProperty::FADE_OUT || + property == CaptionContentProperty::LINE_SPACING || + property == CaptionContentProperty::OUTLINE_WIDTH || + property == CaptionContentProperty::Y_SCALE || + property == CaptionContentProperty::FADE_IN || + property == CaptionContentProperty::FADE_OUT || property == ContentProperty::VIDEO_FRAME_RATE || - property == TextContentProperty::USE || - property == TextContentProperty::X_OFFSET || - property == TextContentProperty::Y_OFFSET || - property == TextContentProperty::X_SCALE || - property == TextContentProperty::FONTS || + property == CaptionContentProperty::USE || + property == CaptionContentProperty::X_OFFSET || + property == CaptionContentProperty::Y_OFFSET || + property == CaptionContentProperty::X_SCALE || + property == CaptionContentProperty::FONTS || property == VideoContentProperty::CROP || property == VideoContentProperty::SCALE || property == VideoContentProperty::FADE_IN || @@ -289,11 +289,11 @@ Player::film_changed (Film::Property p) } list<PositionImage> -Player::transform_bitmap_texts (list<BitmapText> subs) const +Player::transform_bitmap_captions (list<BitmapCaption> subs) const { list<PositionImage> all; - for (list<BitmapText>::const_iterator i = subs.begin(); i != subs.end(); ++i) { + for (list<BitmapCaption>::const_iterator i = subs.begin(); i != subs.end(); ++i) { if (!i->image) { continue; } @@ -406,11 +406,11 @@ Player::get_subtitle_fonts () list<shared_ptr<Font> > fonts; BOOST_FOREACH (shared_ptr<Piece>& p, _pieces) { - if (p->content->subtitle) { + if (p->content->caption) { /* XXX: things may go wrong if there are duplicate font IDs with different font files. */ - list<shared_ptr<Font> > f = p->content->subtitle->fonts (); + list<shared_ptr<Font> > f = p->content->caption->fonts (); copy (f.begin(), f.end(), back_inserter (fonts)); } } @@ -553,7 +553,7 @@ Player::pass () /* Given two choices at the same time, pick the one with a subtitle so we see it before the video. */ - if (!earliest_time || t < *earliest_time || (t == *earliest_time && i->decoder->subtitle)) { + if (!earliest_time || t < *earliest_time || (t == *earliest_time && i->decoder->caption)) { earliest_time = t; earliest_content = i; } @@ -663,10 +663,10 @@ Player::subtitles_for_frame (DCPTime time) const int const vfr = _film->video_frame_rate(); - BOOST_FOREACH (PlayerCaption i, _active_text[TEXT_SUBTITLE].get_burnt (DCPTimePeriod(time, time + DCPTime::from_frames(1, vfr)), _always_burn_subtitles)) { + BOOST_FOREACH (PlayerCaption i, _active_captions[CAPTION_OPEN].get_burnt (DCPTimePeriod(time, time + DCPTime::from_frames(1, vfr)), _always_burn_subtitles)) { /* Image subtitles */ - list<PositionImage> c = transform_bitmap_texts (i.image); + list<PositionImage> c = transform_bitmap_captions (i.image); copy (c.begin(), c.end(), back_inserter (subtitles)); /* Text subtitles (rendered to an image) */ @@ -847,22 +847,22 @@ Player::bitmap_text_start (weak_ptr<Piece> wp, ContentBitmapCaption subtitle) } /* Apply content's subtitle offsets */ - subtitle.sub.rectangle.x += piece->content->subtitle->x_offset (); - subtitle.sub.rectangle.y += piece->content->subtitle->y_offset (); + subtitle.sub.rectangle.x += piece->content->caption->x_offset (); + subtitle.sub.rectangle.y += piece->content->caption->y_offset (); /* Apply a corrective translation to keep the subtitle centred after the scale that is coming up */ - subtitle.sub.rectangle.x -= subtitle.sub.rectangle.width * ((piece->content->subtitle->x_scale() - 1) / 2); - subtitle.sub.rectangle.y -= subtitle.sub.rectangle.height * ((piece->content->subtitle->y_scale() - 1) / 2); + subtitle.sub.rectangle.x -= subtitle.sub.rectangle.width * ((piece->content->caption->x_scale() - 1) / 2); + subtitle.sub.rectangle.y -= subtitle.sub.rectangle.height * ((piece->content->caption->y_scale() - 1) / 2); /* Apply content's subtitle scale */ - subtitle.sub.rectangle.width *= piece->content->subtitle->x_scale (); - subtitle.sub.rectangle.height *= piece->content->subtitle->y_scale (); + subtitle.sub.rectangle.width *= piece->content->caption->x_scale (); + subtitle.sub.rectangle.height *= piece->content->caption->y_scale (); PlayerCaption ps; ps.image.push_back (subtitle.sub); DCPTime from (content_time_to_dcp (piece, subtitle.from())); - _active_text[subtitle.type()].add_from (wp, ps, from); + _active_captions[subtitle.type()].add_from (wp, ps, from); } void @@ -881,10 +881,10 @@ Player::plain_text_start (weak_ptr<Piece> wp, ContentTextCaption subtitle) } BOOST_FOREACH (dcp::SubtitleString s, subtitle.subs) { - s.set_h_position (s.h_position() + piece->content->subtitle->x_offset ()); - s.set_v_position (s.v_position() + piece->content->subtitle->y_offset ()); - float const xs = piece->content->subtitle->x_scale(); - float const ys = piece->content->subtitle->y_scale(); + s.set_h_position (s.h_position() + piece->content->caption->x_offset ()); + s.set_v_position (s.v_position() + piece->content->caption->y_offset ()); + float const xs = piece->content->caption->x_scale(); + float const ys = piece->content->caption->y_scale(); float size = s.size(); /* Adjust size to express the common part of the scaling; @@ -901,17 +901,17 @@ Player::plain_text_start (weak_ptr<Piece> wp, ContentTextCaption subtitle) } s.set_in (dcp::Time(from.seconds(), 1000)); - ps.text.push_back (TextCaption (s, piece->content->subtitle->outline_width())); - ps.add_fonts (piece->content->subtitle->fonts ()); + ps.text.push_back (TextCaption (s, piece->content->caption->outline_width())); + ps.add_fonts (piece->content->caption->fonts ()); } - _active_text[subtitle.type()].add_from (wp, ps, from); + _active_captions[subtitle.type()].add_from (wp, ps, from); } void -Player::subtitle_stop (weak_ptr<Piece> wp, ContentTime to, TextType type) +Player::subtitle_stop (weak_ptr<Piece> wp, ContentTime to, CaptionType type) { - if (!_active_text[type].have (wp)) { + if (!_active_captions[type].have (wp)) { return; } @@ -926,10 +926,10 @@ Player::subtitle_stop (weak_ptr<Piece> wp, ContentTime to, TextType type) return; } - pair<PlayerCaption, DCPTime> from = _active_text[type].add_to (wp, dcp_to); + pair<PlayerCaption, DCPTime> from = _active_captions[type].add_to (wp, dcp_to); - if (piece->content->subtitle->use() && !_always_burn_subtitles && !piece->content->subtitle->burn()) { - Text (from.first, type, DCPTimePeriod (from.second, dcp_to)); + if (piece->content->caption->use() && !_always_burn_subtitles && !piece->content->caption->burn()) { + Caption (from.first, type, DCPTimePeriod (from.second, dcp_to)); } } @@ -951,8 +951,8 @@ Player::seek (DCPTime time, bool accurate) } _audio_merger.clear (); - for (int i = 0; i < TEXT_COUNT; ++i) { - _active_text[i].clear (); + for (int i = 0; i < CAPTION_COUNT; ++i) { + _active_captions[i].clear (); } BOOST_FOREACH (shared_ptr<Piece> i, _pieces) { @@ -1012,8 +1012,8 @@ void Player::do_emit_video (shared_ptr<PlayerVideo> pv, DCPTime time) { if (pv->eyes() == EYES_BOTH || pv->eyes() == EYES_RIGHT) { - for (int i = 0; i < TEXT_COUNT; ++i) { - _active_text[i].clear_before (time); + for (int i = 0; i < CAPTION_COUNT; ++i) { + _active_captions[i].clear_before (time); } } diff --git a/src/lib/player.h b/src/lib/player.h index 16e9d57a5..5b6a0b7b4 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -23,7 +23,7 @@ #include "player_caption.h" #include "active_captions.h" -#include "content_text.h" +#include "content_caption.h" #include "film.h" #include "content.h" #include "position_image.h" @@ -101,7 +101,7 @@ public: /** Emitted when a caption is ready. This signal may be emitted considerably * after the corresponding Video. */ - boost::signals2::signal<void (PlayerCaption, TextType, DCPTimePeriod)> Text; + boost::signals2::signal<void (PlayerCaption, CaptionType, DCPTimePeriod)> Caption; private: friend class PlayerWrapper; @@ -116,7 +116,7 @@ private: void film_changed (Film::Property); void playlist_changed (); void playlist_content_changed (boost::weak_ptr<Content>, int, bool); - std::list<PositionImage> transform_bitmap_texts (std::list<BitmapText>) const; + std::list<PositionImage> transform_bitmap_captions (std::list<BitmapCaption>) const; Frame dcp_to_content_video (boost::shared_ptr<const Piece> piece, DCPTime t) const; DCPTime content_video_to_dcp (boost::shared_ptr<const Piece> piece, Frame f) const; Frame dcp_to_resampled_audio (boost::shared_ptr<const Piece> piece, DCPTime t) const; @@ -128,7 +128,7 @@ private: void audio (boost::weak_ptr<Piece>, AudioStreamPtr, ContentAudio); void bitmap_text_start (boost::weak_ptr<Piece>, ContentBitmapCaption); void plain_text_start (boost::weak_ptr<Piece>, ContentTextCaption); - void subtitle_stop (boost::weak_ptr<Piece>, ContentTime, TextType); + void subtitle_stop (boost::weak_ptr<Piece>, ContentTime, CaptionType); DCPTime one_video_frame () const; void fill_audio (DCPTimePeriod period); std::pair<boost::shared_ptr<AudioBuffers>, DCPTime> discard_audio ( @@ -196,7 +196,7 @@ private: Empty _black; Empty _silent; - ActiveCaptions _active_text[TEXT_COUNT]; + ActiveCaptions _active_captions[CAPTION_COUNT]; boost::shared_ptr<AudioProcessor> _audio_processor; boost::signals2::scoped_connection _film_changed_connection; diff --git a/src/lib/player_caption.h b/src/lib/player_caption.h index 2875790df..2f7e909aa 100644 --- a/src/lib/player_caption.h +++ b/src/lib/player_caption.h @@ -18,10 +18,10 @@ */ -#ifndef DCPOMATIC_PLAYER_TEXT_H -#define DCPOMATIC_PLAYER_TEXT_H +#ifndef DCPOMATIC_PLAYER_CAPTION_H +#define DCPOMATIC_PLAYER_CAPTION_H -#include "bitmap_text.h" +#include "bitmap_caption.h" #include "dcpomatic_time.h" #include "text_caption.h" @@ -34,8 +34,8 @@ public: void add_fonts (std::list<boost::shared_ptr<Font> > fonts_); std::list<boost::shared_ptr<Font> > fonts; - /** BitmapTexts, with their rectangles transformed as specified by their content */ - std::list<BitmapText> image; + /** BitmapCaptions, with their rectangles transformed as specified by their content */ + std::list<BitmapCaption> image; std::list<TextCaption> text; }; diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 13b4d7337..a5451bafa 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -20,7 +20,7 @@ #include "playlist.h" #include "video_content.h" -#include "text_content.h" +#include "caption_content.h" #include "ffmpeg_decoder.h" #include "ffmpeg_content.h" #include "image_decoder.h" @@ -135,7 +135,7 @@ Playlist::maybe_sequence () DCPTime next; BOOST_FOREACH (shared_ptr<Content> i, _content) { - if (!i->subtitle || find (placed.begin(), placed.end(), i) != placed.end()) { + if (!i->caption || find (placed.begin(), placed.end(), i) != placed.end()) { continue; } @@ -155,7 +155,7 @@ Playlist::video_identifier () const string t; BOOST_FOREACH (shared_ptr<const Content> i, _content) { - if (i->video || (i->subtitle && i->subtitle->burn())) { + if (i->video || (i->caption && i->caption->burn())) { t += i->identifier (); } } @@ -366,7 +366,7 @@ Playlist::subtitle_end () const { DCPTime end; BOOST_FOREACH (shared_ptr<Content> i, _content) { - if (i->subtitle) { + if (i->caption) { end = max (end, i->end ()); } } diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 77d583353..8fb15c133 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -528,7 +528,7 @@ ReelWriter::write (shared_ptr<const AudioBuffers> audio) } void -ReelWriter::write (PlayerCaption subs, TextType type, DCPTimePeriod period) +ReelWriter::write (PlayerCaption subs, CaptionType type, DCPTimePeriod period) { /* XXX: we need separate libdcp asset types here and to know how different they are */ @@ -565,7 +565,7 @@ ReelWriter::write (PlayerCaption subs, TextType type, DCPTimePeriod period) _subtitle_asset->add (shared_ptr<dcp::Subtitle>(new dcp::SubtitleString(i))); } - BOOST_FOREACH (BitmapText i, subs.image) { + BOOST_FOREACH (BitmapCaption i, subs.image) { _subtitle_asset->add ( shared_ptr<dcp::Subtitle>( new dcp::SubtitleImage( diff --git a/src/lib/reel_writer.h b/src/lib/reel_writer.h index cd22fa775..06f19f15a 100644 --- a/src/lib/reel_writer.h +++ b/src/lib/reel_writer.h @@ -60,7 +60,7 @@ public: void fake_write (Frame frame, Eyes eyes, int size); void repeat_write (Frame frame, Eyes eyes); void write (boost::shared_ptr<const AudioBuffers> audio); - void write (PlayerCaption text, TextType type, DCPTimePeriod period); + void write (PlayerCaption text, CaptionType type, DCPTimePeriod period); void finish (); boost::shared_ptr<dcp::Reel> create_reel (std::list<ReferencedReelAsset> const & refs, std::list<boost::shared_ptr<Font> > const & fonts); diff --git a/src/lib/plain_text_file.cc b/src/lib/text_caption_file.cc index 666953c40..11d4517db 100644 --- a/src/lib/plain_text_file.cc +++ b/src/lib/text_caption_file.cc @@ -18,7 +18,7 @@ */ -#include "plain_text_file.h" +#include "text_caption_file.h" #include "cross.h" #include "exceptions.h" #include "text_caption_file_content.h" diff --git a/src/lib/plain_text_file.h b/src/lib/text_caption_file.h index 8c74d9e59..4a5657a08 100644 --- a/src/lib/plain_text_file.h +++ b/src/lib/text_caption_file.h @@ -18,8 +18,8 @@ */ -#ifndef DCPOMATIC_PLAIN_TEXT_FILE_H -#define DCPOMATIC_PLAIN_TEXT_FILE_H +#ifndef DCPOMATIC_TEXT_CAPTION_FILE_H +#define DCPOMATIC_TEXT_CAPTION_FILE_H #include "dcpomatic_time.h" #include <sub/subtitle.h> diff --git a/src/lib/text_caption_file_content.cc b/src/lib/text_caption_file_content.cc index df5de93ef..cb7d1511b 100644 --- a/src/lib/text_caption_file_content.cc +++ b/src/lib/text_caption_file_content.cc @@ -20,10 +20,10 @@ #include "text_caption_file_content.h" #include "util.h" -#include "plain_text_file.h" +#include "text_caption_file.h" #include "film.h" #include "font.h" -#include "text_content.h" +#include "caption_content.h" #include <dcp/raw_convert.h> #include <libxml++/libxml++.h> #include <iostream> @@ -38,14 +38,14 @@ using dcp::raw_convert; TextCaptionFileContent::TextCaptionFileContent (shared_ptr<const Film> film, boost::filesystem::path path) : Content (film, path) { - subtitle.reset (new TextContent (this)); + caption.reset (new CaptionContent (this)); } TextCaptionFileContent::TextCaptionFileContent (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); + caption = CaptionContent::from_xml (this, node, version); } void @@ -55,11 +55,11 @@ TextCaptionFileContent::examine (boost::shared_ptr<Job> job) TextCaptionFile s (shared_from_this ()); /* Default to turning these subtitles on */ - subtitle->set_use (true); + caption->set_use (true); boost::mutex::scoped_lock lm (_mutex); _length = s.length (); - subtitle->add_font (shared_ptr<Font> (new Font (TEXT_FONT_ID))); + caption->add_font (shared_ptr<Font> (new Font (TEXT_FONT_ID))); } string @@ -80,8 +80,8 @@ TextCaptionFileContent::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); + if (caption) { + caption->as_xml (node); } node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ())); diff --git a/src/lib/text_caption_file_decoder.cc b/src/lib/text_caption_file_decoder.cc index d1a72faeb..46217e49b 100644 --- a/src/lib/text_caption_file_decoder.cc +++ b/src/lib/text_caption_file_decoder.cc @@ -20,8 +20,8 @@ #include "text_caption_file_decoder.h" #include "text_caption_file_content.h" -#include "text_content.h" -#include "text_decoder.h" +#include "caption_content.h" +#include "caption_decoder.h" #include <dcp/subtitle_string.h> #include <boost/foreach.hpp> #include <iostream> @@ -43,7 +43,7 @@ TextCaptionFileDecoder::TextCaptionFileDecoder (shared_ptr<const TextCaptionFile if (!_subtitles.empty()) { first = content_time_period(_subtitles[0]).from; } - subtitle.reset (new TextDecoder (this, content->subtitle, log, first)); + caption.reset (new CaptionDecoder (this, content->caption, log, first)); } void @@ -73,7 +73,7 @@ TextCaptionFileDecoder::pass () } ContentTimePeriod const p = content_time_period (_subtitles[_next]); - subtitle->emit_plain (p, _subtitles[_next]); + caption->emit_plain (p, _subtitles[_next]); ++_next; return false; diff --git a/src/lib/text_caption_file_decoder.h b/src/lib/text_caption_file_decoder.h index 7f889e72d..769777571 100644 --- a/src/lib/text_caption_file_decoder.h +++ b/src/lib/text_caption_file_decoder.h @@ -18,10 +18,10 @@ */ -#ifndef DCPOMATIC_PLAIN_TEXT_FILE_DECODER_H -#define DCPOMATIC_PLAIN_TEXT_FILE_DECODER_H +#ifndef DCPOMATIC_TEXT_CAPTION_FILE_DECODER_H +#define DCPOMATIC_TEXT_CAPTION_FILE_DECODER_H -#include "plain_text_file.h" +#include "text_caption_file.h" #include "decoder.h" class TextCaptionFileContent; diff --git a/src/lib/types.cc b/src/lib/types.cc index 68e00c8d5..97373b24e 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -91,26 +91,26 @@ Crop::as_xml (xmlpp::Node* node) const node->add_child("BottomCrop")->add_child_text (raw_convert<string> (bottom)); } -TextType -string_to_text_type (string s) +CaptionType +string_to_caption_type (string s) { - if (s == "subtitle") { - return TEXT_SUBTITLE; - } else if (s == "ccap") { - return TEXT_CLOSED_CAPTION; + if (s == "open") { + return CAPTION_OPEN; + } else if (s == "closed") { + return CAPTION_CLOSED; } else { - throw MetadataError (String::compose ("Unknown text type %1", s)); + throw MetadataError (String::compose ("Unknown caption type %1", s)); } } string -text_type_to_string (TextType t) +caption_type_to_string (CaptionType t) { switch (t) { - case TEXT_SUBTITLE: - return "subtitle"; - case TEXT_CLOSED_CAPTION: - return "ccap"; + case CAPTION_OPEN: + return "open"; + case CAPTION_CLOSED: + return "closed"; default: DCPOMATIC_ASSERT (false); } diff --git a/src/lib/types.h b/src/lib/types.h index e52daca00..3337087eb 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -31,7 +31,7 @@ class Content; class VideoContent; class AudioContent; -class TextContent; +class CaptionContent; class FFmpegContent; namespace cxml { @@ -129,15 +129,15 @@ enum ReelType REELTYPE_BY_LENGTH }; -enum TextType +enum CaptionType { - TEXT_SUBTITLE, - TEXT_CLOSED_CAPTION, - TEXT_COUNT + CAPTION_OPEN, + CAPTION_CLOSED, + CAPTION_COUNT }; -extern std::string text_type_to_string (TextType t); -extern TextType string_to_text_type (std::string s); +extern std::string caption_type_to_string (CaptionType t); +extern CaptionType string_to_caption_type (std::string s); /** @struct Crop * @brief A description of the crop of an image or video. diff --git a/src/lib/writer.cc b/src/lib/writer.cc index ea4a6d29b..c0a774f03 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -95,8 +95,8 @@ Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j) and captions arrive to the Writer in sequence. This is not so for video. */ _audio_reel = _reels.begin (); - for (int i = 0; i < TEXT_COUNT; ++i) { - _text_reel[i] = _reels.begin (); + for (int i = 0; i < CAPTION_COUNT; ++i) { + _caption_reel[i] = _reels.begin (); } /* Check that the signer is OK if we need one */ @@ -665,16 +665,16 @@ Writer::can_fake_write (Frame frame) const } void -Writer::write (PlayerCaption text, TextType type, DCPTimePeriod period) +Writer::write (PlayerCaption text, CaptionType type, DCPTimePeriod period) { - while (_text_reel[type]->period().to <= period.from) { - ++_text_reel[type]; - DCPOMATIC_ASSERT (_text_reel[type] != _reels.end()); + while (_caption_reel[type]->period().to <= period.from) { + ++_caption_reel[type]; + DCPOMATIC_ASSERT (_caption_reel[type] != _reels.end()); } - DCPOMATIC_ASSERT (_text_reel[type] != _reels.end()); + DCPOMATIC_ASSERT (_caption_reel[type] != _reels.end()); - _text_reel[type]->write (text, type, period); + _caption_reel[type]->write (text, type, period); } void diff --git a/src/lib/writer.h b/src/lib/writer.h index a776e54c3..f67419072 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -104,7 +104,7 @@ public: bool can_repeat (Frame) const; void repeat (Frame, Eyes); void write (boost::shared_ptr<const AudioBuffers>, DCPTime time); - void write (PlayerCaption text, TextType type, DCPTimePeriod period); + void write (PlayerCaption text, CaptionType type, DCPTimePeriod period); void write (std::list<boost::shared_ptr<Font> > fonts); void write (ReferencedReelAsset asset); void finish (); @@ -124,7 +124,7 @@ private: boost::weak_ptr<Job> _job; std::vector<ReelWriter> _reels; std::vector<ReelWriter>::iterator _audio_reel; - std::vector<ReelWriter>::iterator _text_reel[TEXT_COUNT]; + std::vector<ReelWriter>::iterator _caption_reel[CAPTION_COUNT]; /** our thread, or 0 */ boost::thread* _thread; diff --git a/src/lib/wscript b/src/lib/wscript index 71c94c28b..a841e5b55 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -38,6 +38,8 @@ sources = """ audio_ring_buffers.cc audio_stream.cc butler.cc + caption_content.cc + caption_decoder.cc case_insensitive_sorter.cc cinema.cc cinema_kdms.cc @@ -55,8 +57,8 @@ sources = """ dcp_encoder.cc dcp_examiner.cc dcp_subtitle.cc - dcp_text_content.cc - dcp_text_decoder.cc + dcp_subtitle_content.cc + dcp_subtitle_decoder.cc dcp_video.cc dcpomatic_socket.cc dcpomatic_time.cc @@ -132,9 +134,7 @@ sources = """ server.cc shuffler.cc string_log_entry.cc - text_content.cc - text_decoder.cc - plain_text_file.cc + text_caption_file.cc text_caption_file_content.cc text_caption_file_decoder.cc timer.cc |
