X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsubtitle_asset.h;h=012050b1854ceca70c1d6149e1fc644626f16abb;hb=2da55dbe6da21975612584365db17db2ae9935b8;hp=59ed1165475a41d5ca7957f9428ced598c2508b5;hpb=3a69e2805f4b2119194ba2357fa9895bf1ae147f;p=libdcp.git diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 59ed1165..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; - class Context; + 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,26 +100,42 @@ 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 fonts_with_load_ids () 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; virtual std::string xml_as_string () const = 0; Time latest_subtitle_out () const; - virtual std::list > load_font_nodes () const = 0; + void fix_empty_font_ids (); + + virtual std::vector> load_font_nodes () const = 0; + + virtual int time_code_rate () const = 0; + + /** @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; @@ -121,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