X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ftext_content.h;h=d3e9b564b389fcb8787397ff43cefd6660ae1382;hb=687ade428fb7ad6d0949f12aa5a7f5b643434489;hp=0327d4a97bbbad9ab7beac32be84a2af65486314;hpb=2571104b6a208fa00b2c98d50f97849c3e7fa6c9;p=dcpomatic.git diff --git a/src/lib/text_content.h b/src/lib/text_content.h index 0327d4a97..d3e9b564b 100644 --- a/src/lib/text_content.h +++ b/src/lib/text_content.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018 Carl Hetherington + Copyright (C) 2013-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,15 +18,22 @@ */ + #ifndef DCPOMATIC_CAPTION_CONTENT_H #define DCPOMATIC_CAPTION_CONTENT_H + #include "content_part.h" +#include "dcp_text_track.h" #include +#include #include #include -class Font; + +namespace dcpomatic { + class Font; +} class TextContentProperty { @@ -37,8 +44,6 @@ public: static int const Y_SCALE; static int const USE; static int const BURN; - static int const NAME; - static int const LANGUAGE; static int const FONTS; static int const COLOUR; static int const EFFECT; @@ -48,8 +53,12 @@ public: static int const FADE_OUT; static int const OUTLINE_WIDTH; static int const TYPE; + static int const DCP_TRACK; + static int const LANGUAGE; + static int const LANGUAGE_IS_ADDITIONAL; }; + /** @class TextContent * @brief Description of how some text content should be presented. * @@ -60,13 +69,14 @@ class TextContent : public ContentPart { public: TextContent (Content* parent, TextType type, TextType original_type); - TextContent (Content* parent, std::vector >); + TextContent (Content* parent, std::vector>); + TextContent (Content* parent, cxml::ConstNodePtr, int version, std::list& notes); void as_xml (xmlpp::Node *) const; std::string identifier () const; - void take_settings_from (boost::shared_ptr c); + void take_settings_from (std::shared_ptr c); - void add_font (boost::shared_ptr font); + void add_font (std::shared_ptr font); void set_use (bool); void set_burn (bool); @@ -74,8 +84,6 @@ public: void set_y_offset (double); void set_x_scale (double); void set_y_scale (double); - void set_name (std::string name); - void set_language (std::string language); void set_colour (dcp::Colour); void unset_colour (); void set_effect (dcp::Effect); @@ -83,12 +91,16 @@ public: void set_effect_colour (dcp::Colour); void unset_effect_colour (); void set_line_spacing (double s); - void set_fade_in (ContentTime); + void set_fade_in (dcpomatic::ContentTime); void unset_fade_in (); - void set_fade_out (ContentTime); + void set_fade_out (dcpomatic::ContentTime); void set_outline_width (int); void unset_fade_out (); void set_type (TextType type); + void set_dcp_track (DCPTextTrack track); + void unset_dcp_track (); + void set_language (boost::optional language = boost::none); + void set_language_is_additional (bool additional); bool use () const { boost::mutex::scoped_lock lm (_mutex); @@ -120,21 +132,11 @@ public: return _y_scale; } - std::list > fonts () const { + std::list > fonts () const { boost::mutex::scoped_lock lm (_mutex); return _fonts; } - std::string name () const { - boost::mutex::scoped_lock lm (_mutex); - return _name; - } - - std::string language () const { - boost::mutex::scoped_lock lm (_mutex); - return _language; - } - boost::optional colour () const { boost::mutex::scoped_lock lm (_mutex); return _colour; @@ -155,12 +157,12 @@ public: return _line_spacing; } - boost::optional fade_in () const { + boost::optional fade_in () const { boost::mutex::scoped_lock lm (_mutex); return _fade_in; } - boost::optional fade_out () const { + boost::optional fade_out () const { boost::mutex::scoped_lock lm (_mutex); return _fade_out; } @@ -180,18 +182,26 @@ public: return _original_type; } - static std::list > from_xml (Content* parent, cxml::ConstNodePtr, int version); + boost::optional dcp_track () const { + boost::mutex::scoped_lock lm (_mutex); + return _dcp_track; + } + + boost::optional language () const { + boost::mutex::scoped_lock lm (_mutex); + return _language; + } + + bool language_is_additional () const { + boost::mutex::scoped_lock lm (_mutex); + return _language_is_additional; + } -protected: - /** Name (annotation text) for this subtitle */ - std::string _name; - /** subtitle language (e.g. "German") or empty if it is not known */ - std::string _language; + static std::list> from_xml (Content* parent, cxml::ConstNodePtr, int version, std::list& notes); private: friend struct ffmpeg_pts_offset_test; - TextContent (Content* parent, cxml::ConstNodePtr, int version); void font_changed (); void connect_to_fonts (); @@ -211,14 +221,14 @@ private: double _x_scale; /** y scale factor to apply to subtitles */ double _y_scale; - std::list > _fonts; + std::list > _fonts; boost::optional _colour; boost::optional _effect; boost::optional _effect_colour; /** scaling factor for line spacing; 1 is "standard", < 1 is closer together, > 1 is further apart */ double _line_spacing; - boost::optional _fade_in; - boost::optional _fade_out; + boost::optional _fade_in; + boost::optional _fade_out; int _outline_width; /** what these captions will be used for in the output DCP (not necessarily what * they were originally). @@ -226,6 +236,10 @@ private: TextType _type; /** the original type of these captions in their content */ TextType _original_type; + /** the track of closed captions that this content should be put in, or empty to put in the default (only) track */ + boost::optional _dcp_track; + boost::optional _language; + bool _language_is_additional = false; }; #endif