X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ftext_content.h;h=d3e9b564b389fcb8787397ff43cefd6660ae1382;hb=0330b684fe616b465e65b67f7d995e659fa83fca;hp=21d09ad12b7329e146b5a1169a5ea934cd26dc16;hpb=dd9be86db6cde0afa5da0d1d1ac43b42e05dca26;p=dcpomatic.git diff --git a/src/lib/text_content.h b/src/lib/text_content.h index 21d09ad12..d3e9b564b 100644 --- a/src/lib/text_content.h +++ b/src/lib/text_content.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2020 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; } @@ -50,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. * @@ -62,7 +69,8 @@ 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; @@ -91,6 +99,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); @@ -177,12 +187,21 @@ 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; + } + + 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 (); @@ -219,6 +238,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