X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fsubtitle_asset.h;h=012050b1854ceca70c1d6149e1fc644626f16abb;hb=2da55dbe6da21975612584365db17db2ae9935b8;hp=b66e88b10706379f1fe84cfe47e3687c3bba5c56;hpb=02d5b8c73ca3d8d18397658425b0e8f2d5e4e90a;p=libdcp.git diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index b66e88b1..012050b1 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of libdcp. @@ -31,29 +31,44 @@ files in the program, then also delete it here. */ + +/** @file src/subtitle_asset.h + * @brief SubtitleAsset class + */ + + #ifndef LIBDCP_SUBTITLE_ASSET_H #define LIBDCP_SUBTITLE_ASSET_H + +#include "array_data.h" #include "asset.h" #include "dcp_time.h" +#include "subtitle_standard.h" #include "subtitle_string.h" -#include "data.h" #include #include #include +#include +#include +#include + namespace xmlpp { + class Document; class Element; } + struct interop_dcp_font_test; struct smpte_dcp_font_test; struct pull_fonts_test1; struct pull_fonts_test2; struct pull_fonts_test3; -namespace dcp -{ + +namespace dcp { + class SubtitleString; class SubtitleImage; @@ -61,14 +76,17 @@ class FontNode; class TextNode; class SubtitleNode; class LoadFontNode; +class ReelAsset; + namespace order { class Part; struct Context; } + /** @class SubtitleAsset - * @brief A parent for classes representing a file containing subtitles. + * @brief A parent for classes representing a file containing subtitles * * This class holds a list of Subtitle objects which it can extract * from the appropriate part of either an Interop or SMPTE XML file. @@ -82,19 +100,18 @@ public: explicit SubtitleAsset (boost::filesystem::path file); bool equals ( - boost::shared_ptr, + std::shared_ptr, EqualityOptions, NoteHandler note - ) const; + ) const override; - std::list > subtitles_during (Time from, Time to, bool starting) const; - std::list > const & subtitles () const { - return _subtitles; - } + std::vector> subtitles_during (Time from, Time to, bool starting) const; + std::vector> subtitles_in_reel(std::shared_ptr asset) const; + std::vector> subtitles () const; - virtual void add (boost::shared_ptr); - virtual void add_font (std::string id, boost::filesystem::path file) = 0; - std::map font_data () const; + virtual void add (std::shared_ptr); + virtual void add_font (std::string id, dcp::ArrayData data) = 0; + std::map font_data () const; std::map font_filenames () const; virtual void write (boost::filesystem::path) const = 0; @@ -104,12 +121,22 @@ public: void fix_empty_font_ids (); - virtual std::list > load_font_nodes () const = 0; + virtual std::vector> load_font_nodes () const = 0; + + virtual int time_code_rate () const = 0; - std::string raw_xml () const { + /** @return Raw XML loaded from, or written to, an on-disk asset, or boost::none if + * - this object was not created from an existing on-disk asset and has not been written to one, or + * - this asset is encrypted and no key is available. + */ + virtual boost::optional raw_xml () const { return _raw_xml; } + virtual SubtitleStandard subtitle_standard() const = 0; + + static std::string format_xml (xmlpp::Document const& document, std::vector> const& namespaces); + protected: friend struct ::interop_dcp_font_test; friend struct ::smpte_dcp_font_test; @@ -128,19 +155,21 @@ protected: boost::optional h_align; boost::optional v_position; boost::optional v_align; + boost::optional z_position; boost::optional direction; boost::optional