X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fsubtitle_asset.h;h=8ec57fce99258acbf3dbc0f3b9c8cffebca23378;hb=dd672d926e3b88cbe42b0778fda397d9e858b592;hp=1108514a3e67bbd66edbebda2198ec770b56ce1e;hpb=ba5915461f1622715a69fa25579e5e27e64fb079;p=libdcp.git diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 1108514a..8ec57fce 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,43 +31,57 @@ 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_string.h" -#include "data.h" #include #include #include + namespace xmlpp { 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; 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. @@ -81,26 +95,38 @@ 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; + } protected: friend struct ::interop_dcp_font_test; @@ -125,18 +151,25 @@ protected: boost::optional