X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Ftext_content.h;h=7c060cd482afb76fa3bdd152bb8dd178c4d2350f;hb=c8bd4ead4c9e757d88136a7fdd556272f36be793;hp=5eda8764ffeaa91ea5c20758fb46c2cad71e1844;hpb=f41818f14369f170475b7f2bde1a2dd856517b14;p=dcpomatic.git diff --git a/src/lib/text_content.h b/src/lib/text_content.h index 5eda8764f..7c060cd48 100644 --- a/src/lib/text_content.h +++ b/src/lib/text_content.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2019 Carl Hetherington + Copyright (C) 2013-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,15 +18,19 @@ */ + #ifndef DCPOMATIC_CAPTION_CONTENT_H #define DCPOMATIC_CAPTION_CONTENT_H + #include "content_part.h" #include "dcp_text_track.h" #include +#include #include #include + namespace dcpomatic { class Font; } @@ -40,7 +44,6 @@ public: static int const Y_SCALE; static int const USE; static int const BURN; - static int const LANGUAGE; static int const FONTS; static int const COLOUR; static int const EFFECT; @@ -51,8 +54,11 @@ public: 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. * @@ -63,13 +69,16 @@ 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 clear_fonts (); + void add_font (std::shared_ptr font); + std::shared_ptr get_font(std::string id) const; void set_use (bool); void set_burn (bool); @@ -77,7 +86,6 @@ public: void set_y_offset (double); void set_x_scale (double); void set_y_scale (double); - void set_language (std::string language); void set_colour (dcp::Colour); void unset_colour (); void set_effect (dcp::Effect); @@ -93,6 +101,8 @@ public: 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); @@ -124,16 +134,11 @@ public: return _y_scale; } - std::list > fonts () const { + std::list> fonts () const { boost::mutex::scoped_lock lm (_mutex); return _fonts; } - std::string language () const { - boost::mutex::scoped_lock lm (_mutex); - return _language; - } - boost::optional colour () const { boost::mutex::scoped_lock lm (_mutex); return _colour; @@ -184,18 +189,24 @@ public: return _dcp_track; } - static std::list > from_xml (Content* parent, cxml::ConstNodePtr, int version); + 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: - /** 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 (); + std::shared_ptr get_font_unlocked(std::string id) const; std::list _font_connections; @@ -213,7 +224,7 @@ 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; @@ -230,6 +241,8 @@ private: 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