diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-06-09 18:53:04 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-06-09 19:56:23 +0200 |
| commit | 76c2bbd1893037879ce78114fdbecad428849248 (patch) | |
| tree | 28e56bc8692e8c3d931ee280594e36bdccc8e6c6 /src | |
| parent | 4e205f8eeb63647b6d33d6a0426ee11c4a391b5f (diff) | |
Add type field (open/closed) to caption and subtitle.
Diffstat (limited to 'src')
| -rw-r--r-- | src/reel_caption_asset.cc | 3 | ||||
| -rw-r--r-- | src/reel_caption_asset.h | 8 | ||||
| -rw-r--r-- | src/reel_interop_caption_asset.cc | 1 | ||||
| -rw-r--r-- | src/reel_smpte_caption_asset.cc | 4 | ||||
| -rw-r--r-- | src/reel_smpte_caption_asset.h | 2 | ||||
| -rw-r--r-- | src/reel_smpte_subtitle_asset.cc | 4 | ||||
| -rw-r--r-- | src/reel_smpte_subtitle_asset.h | 2 | ||||
| -rw-r--r-- | src/reel_subtitle_asset.cc | 3 | ||||
| -rw-r--r-- | src/reel_subtitle_asset.h | 8 | ||||
| -rw-r--r-- | src/text_type.h | 53 | ||||
| -rw-r--r-- | src/wscript | 1 |
11 files changed, 78 insertions, 11 deletions
diff --git a/src/reel_caption_asset.cc b/src/reel_caption_asset.cc index 8e2be16b..2c0fbca9 100644 --- a/src/reel_caption_asset.cc +++ b/src/reel_caption_asset.cc @@ -53,7 +53,7 @@ using std::string; using namespace dcp; -ReelCaptionAsset::ReelCaptionAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) +ReelCaptionAsset::ReelCaptionAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point, TextType type) : ReelFileAsset ( asset, dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : boost::none, @@ -62,6 +62,7 @@ ReelCaptionAsset::ReelCaptionAsset(std::shared_ptr<SubtitleAsset> asset, Fractio intrinsic_duration, entry_point ) + , _type(type) { } diff --git a/src/reel_caption_asset.h b/src/reel_caption_asset.h index ea121430..cf4850c5 100644 --- a/src/reel_caption_asset.h +++ b/src/reel_caption_asset.h @@ -45,6 +45,7 @@ #include "reel_asset.h" #include "reel_file_asset.h" #include "subtitle_asset.h" +#include "text_type.h" struct verify_invalid_language2; @@ -59,7 +60,7 @@ namespace dcp { class ReelCaptionAsset : public ReelFileAsset { public: - ReelCaptionAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); + ReelCaptionAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point, TextType type = TextType::CLOSED); explicit ReelCaptionAsset(std::shared_ptr<const cxml::Node>); std::shared_ptr<const SubtitleAsset> asset() const { @@ -84,10 +85,15 @@ public: return _language; } + TextType type() const { + return _type; + } + protected: friend struct ::verify_invalid_language2; boost::optional<std::string> _language; + TextType _type = TextType::CLOSED; }; diff --git a/src/reel_interop_caption_asset.cc b/src/reel_interop_caption_asset.cc index 7bc7901d..7b7d9ed7 100644 --- a/src/reel_interop_caption_asset.cc +++ b/src/reel_interop_caption_asset.cc @@ -53,7 +53,6 @@ ReelInteropCaptionAsset::ReelInteropCaptionAsset(shared_ptr<InteropSubtitleAsset } - ReelInteropCaptionAsset::ReelInteropCaptionAsset(shared_ptr<const cxml::Node> node) : ReelCaptionAsset(node) { diff --git a/src/reel_smpte_caption_asset.cc b/src/reel_smpte_caption_asset.cc index b4d37584..eeebf844 100644 --- a/src/reel_smpte_caption_asset.cc +++ b/src/reel_smpte_caption_asset.cc @@ -51,8 +51,8 @@ using std::string; using namespace dcp; -ReelSMPTECaptionAsset::ReelSMPTECaptionAsset(shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) - : ReelCaptionAsset(asset, edit_rate, intrinsic_duration, entry_point) +ReelSMPTECaptionAsset::ReelSMPTECaptionAsset(shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point, TextType type) + : ReelCaptionAsset(asset, edit_rate, intrinsic_duration, entry_point, type) { } diff --git a/src/reel_smpte_caption_asset.h b/src/reel_smpte_caption_asset.h index 55de75e3..91eb460a 100644 --- a/src/reel_smpte_caption_asset.h +++ b/src/reel_smpte_caption_asset.h @@ -52,7 +52,7 @@ namespace dcp { class ReelSMPTECaptionAsset : public ReelCaptionAsset { public: - ReelSMPTECaptionAsset(std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); + ReelSMPTECaptionAsset(std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point, TextType type = TextType::CLOSED); explicit ReelSMPTECaptionAsset(std::shared_ptr<const cxml::Node>); std::shared_ptr<SMPTESubtitleAsset> smpte_asset () { diff --git a/src/reel_smpte_subtitle_asset.cc b/src/reel_smpte_subtitle_asset.cc index 64440547..025ab25c 100644 --- a/src/reel_smpte_subtitle_asset.cc +++ b/src/reel_smpte_subtitle_asset.cc @@ -51,8 +51,8 @@ using boost::optional; using namespace dcp; -ReelSMPTESubtitleAsset::ReelSMPTESubtitleAsset (shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) - : ReelSubtitleAsset (asset, edit_rate, intrinsic_duration, entry_point) +ReelSMPTESubtitleAsset::ReelSMPTESubtitleAsset (shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point, TextType type) + : ReelSubtitleAsset (asset, edit_rate, intrinsic_duration, entry_point, type) { } diff --git a/src/reel_smpte_subtitle_asset.h b/src/reel_smpte_subtitle_asset.h index 49b6000b..aee63c74 100644 --- a/src/reel_smpte_subtitle_asset.h +++ b/src/reel_smpte_subtitle_asset.h @@ -53,7 +53,7 @@ class SMPTESubtitleAsset; class ReelSMPTESubtitleAsset : public ReelSubtitleAsset { public: - ReelSMPTESubtitleAsset (std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); + ReelSMPTESubtitleAsset (std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point, TextType type = TextType::OPEN); explicit ReelSMPTESubtitleAsset (std::shared_ptr<const cxml::Node>); std::shared_ptr<const SMPTESubtitleAsset> smpte_asset () const { diff --git a/src/reel_subtitle_asset.cc b/src/reel_subtitle_asset.cc index 436aa69f..b4bddfac 100644 --- a/src/reel_subtitle_asset.cc +++ b/src/reel_subtitle_asset.cc @@ -54,7 +54,7 @@ using boost::optional; using namespace dcp; -ReelSubtitleAsset::ReelSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) +ReelSubtitleAsset::ReelSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point, TextType type) : ReelFileAsset ( asset, dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : boost::none, @@ -63,6 +63,7 @@ ReelSubtitleAsset::ReelSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Frac intrinsic_duration, entry_point ) + , _type(type) { } diff --git a/src/reel_subtitle_asset.h b/src/reel_subtitle_asset.h index 1aa843d1..e56e8581 100644 --- a/src/reel_subtitle_asset.h +++ b/src/reel_subtitle_asset.h @@ -45,6 +45,7 @@ #include "reel_asset.h" #include "reel_file_asset.h" #include "subtitle_asset.h" +#include "text_type.h" struct verify_invalid_language1; @@ -62,7 +63,7 @@ class SubtitleAsset; class ReelSubtitleAsset : public ReelFileAsset { public: - ReelSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); + ReelSubtitleAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point, TextType type = TextType::OPEN); explicit ReelSubtitleAsset(std::shared_ptr<const cxml::Node>); std::shared_ptr<const SubtitleAsset> asset() const { @@ -83,12 +84,17 @@ public: return _language; } + TextType type() const { + return _type; + } + protected: /** As in other places, this is stored and returned as a string so that * we can tolerate non-RFC-5646 strings, but must be set as a dcp::LanguageTag * to try to ensure that we create compliant output. */ boost::optional<std::string> _language; + TextType _type = TextType::OPEN; private: friend struct ::verify_invalid_language1; diff --git a/src/text_type.h b/src/text_type.h new file mode 100644 index 00000000..4d33d0d3 --- /dev/null +++ b/src/text_type.h @@ -0,0 +1,53 @@ +/* + Copyright (C) 2024 Carl Hetherington <cth@carlh.net> + + This file is part of libdcp. + + libdcp is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + libdcp is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with libdcp. If not, see <http://www.gnu.org/licenses/>. + + In addition, as a special exception, the copyright holders give + permission to link the code of portions of this program with the + OpenSSL library under certain conditions as described in each + individual source file, and distribute linked combinations + including the two. + + You must obey the GNU General Public License in all respects + for all of the code used other than OpenSSL. If you modify + file(s) with this exception, you may extend this exception to your + version of the file(s), but you are not obligated to do so. If you + do not wish to do so, delete this exception statement from your + version. If you delete this exception statement from all source + files in the program, then also delete it here. +*/ + + +#ifndef LIBDCP_TEXT_TYPE_H +#define LIBDCP_TEXT_TYPE_H + + +namespace dcp { + + +enum class TextType +{ + OPEN, ///< to be displayed on-screen (visible to everyone) + CLOSED ///< to be displayed via some personal device (visible to part of the audience) +}; + + +} + + +#endif + diff --git a/src/wscript b/src/wscript index 452e5ff4..5e916e7e 100644 --- a/src/wscript +++ b/src/wscript @@ -245,6 +245,7 @@ def build(bld): subtitle_image.h subtitle_standard.h subtitle_string.h + text_type.h transfer_function.h types.h utc_offset.h |
