Missing finalize() in dcpdecryptmxf.
[libdcp.git] / src / subtitle_image.h
index c398ef78213f931b321ee307ad3274d9d1725a44..595320f79303b092ade88ba2d16b54c9f7b7e009 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
 /** @file  src/subtitle_image.h
- *  @brief SubtitleImage class.
+ *  @brief SubtitleImage class
  */
 
+
 #ifndef LIBDCP_SUBTITLE_IMAGE_H
 #define LIBDCP_SUBTITLE_IMAGE_H
 
+
+#include "array_data.h"
 #include "types.h"
 #include "subtitle.h"
-#include "data.h"
 #include "dcp_time.h"
 #include <boost/optional.hpp>
 #include <string>
 
+
 namespace dcp {
 
+
 /** @class SubtitleImage
- *  @brief A bitmap subtitle with all the associated attributes.
+ *  @brief A bitmap subtitle with all the associated attributes
  */
 class SubtitleImage : public Subtitle
 {
 public:
        SubtitleImage (
-               Data png_image,
+               ArrayData png_image,
                Time in,
                Time out,
                float h_position,
@@ -66,7 +71,7 @@ public:
                );
 
        SubtitleImage (
-               Data png_image,
+               ArrayData png_image,
                std::string id,
                Time in,
                Time out,
@@ -78,23 +83,41 @@ public:
                Time fade_down_time
                );
 
-       Data png_image () const {
+       ArrayData png_image () const {
                return _png_image;
        }
 
+       void set_png_image (ArrayData png) {
+               _png_image = png;
+       }
+
+       void read_png_file (boost::filesystem::path file);
+       void write_png_file (boost::filesystem::path file) const;
+
        std::string id () const {
                return _id;
        }
 
+       /** @return the most recent disk file used to read or write this asset, if there is one */
+       boost::optional<boost::filesystem::path> file () const {
+               return _file;
+       }
+
+       bool equals (std::shared_ptr<dcp::SubtitleImage> other, EqualityOptions options, NoteHandler note);
+
 private:
-       Data _png_image;
+       ArrayData _png_image;
        std::string _id;
+       mutable boost::optional<boost::filesystem::path> _file;
 };
 
+
 bool operator== (SubtitleImage const & a, SubtitleImage const & b);
 bool operator!= (SubtitleImage const & a, SubtitleImage const & b);
 std::ostream& operator<< (std::ostream& s, SubtitleImage const & sub);
 
+
 }
 
+
 #endif