In-line run of subs_in_out so that it gets the environment more easily.
[libdcp.git] / src / interop_subtitle_asset.h
index 7ce7d175d5cb176fa1b786c07c0470365e22d6e6..f63740d54fcbd4c793071f0ed68722b407bbcc63 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
 /** @file  src/interop_subtitle_asset.h
- *  @brief InteropSubtitleAsset class.
+ *  @brief InteropSubtitleAsset class
  */
 
+
+#ifndef DCP_INTEROP_SUBTITLE_ASSET_H
+#define DCP_INTEROP_SUBTITLE_ASSET_H
+
+
 #include "subtitle_asset.h"
+#include "subtitle_standard.h"
 #include <boost/filesystem.hpp>
 
+
 namespace dcp {
 
+
 class InteropLoadFontNode;
 
+
 /** @class InteropSubtitleAsset
- *  @brief A set of subtitles to be read and/or written in the Inter-Op format.
+ *  @brief A set of subtitles to be read and/or written in the Inter-Op format
  *
  *  Inter-Op subtitles are sometimes known as CineCanvas.
  */
@@ -55,22 +65,32 @@ public:
 
        bool equals (
                std::shared_ptr<const Asset>,
-               EqualityOptions,
+               EqualityOptions const&,
                NoteHandler note
-               ) const;
+               ) const override;
+
+       void add_to_assetmap (AssetMap& asset_map, boost::filesystem::path root) const override;
+       void add_to_pkl (std::shared_ptr<PKL> pkl, boost::filesystem::path root) const override;
 
-       void write_to_assetmap (xmlpp::Node* node, boost::filesystem::path root) const;
-       void add_to_pkl (std::shared_ptr<PKL> pkl, boost::filesystem::path root) const;
+       std::vector<std::shared_ptr<LoadFontNode>> load_font_nodes () const override;
 
-       std::list<std::shared_ptr<LoadFontNode> > load_font_nodes () const;
+       void add_font (std::string load_id, dcp::ArrayData data) override;
 
-       void add_font (std::string load_id, dcp::ArrayData data);
+       std::string xml_as_string () const override;
 
-       std::string xml_as_string () const;
-       void write (boost::filesystem::path path) const;
-       void resolve_fonts (std::list<std::shared_ptr<Asset> > assets);
-       void add_font_assets (std::list<std::shared_ptr<Asset> >& assets);
+       /** Write this content to an XML file with its fonts alongside */
+       void write (boost::filesystem::path path) const override;
+
+       void resolve_fonts (std::vector<std::shared_ptr<Asset>> assets);
        void set_font_file (std::string load_id, boost::filesystem::path file);
+       std::vector<std::shared_ptr<Asset>> font_assets();
+       std::vector<std::shared_ptr<const Asset>> font_assets() const;
+
+       /** @return the <LoadFont> IDs of fonts for which we have not (yet) found a font asset.
+        *  This could be because resolve_fonts() has not yet been called, or because there is
+        *  a missing font file.
+        */
+       std::vector<std::string> unresolved_fonts() const;
 
        /** Set the reel number or sub-element identifier
         *  of these subtitles.
@@ -109,13 +129,22 @@ public:
                return _movie_title;
        }
 
+       int time_code_rate () const override {
+               /* Interop can use either; just pick one */
+               return 1000;
+       }
+
+       SubtitleStandard subtitle_standard() const override {
+               return SubtitleStandard::INTEROP;
+       }
+
        static std::string static_pkl_type (Standard) {
                return "text/xml;asdcpKind=Subtitle";
        }
 
 protected:
 
-       std::string pkl_type (Standard s) const {
+       std::string pkl_type (Standard s) const override {
                return static_pkl_type (s);
        }
 
@@ -123,7 +152,12 @@ private:
        std::string _reel_number;
        std::string _language;
        std::string _movie_title;
-       std::list<std::shared_ptr<InteropLoadFontNode> > _load_font_nodes;
+       std::vector<std::shared_ptr<InteropLoadFontNode>> _load_font_nodes;
 };
 
+
 }
+
+
+#endif
+