2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef LIBDCP_PICTURE_ASSET_H
21 #define LIBDCP_PICTURE_ASSET_H
23 /** @file src/picture_asset.h
24 * @brief An asset made up of JPEG2000 data
28 #include "mxf_asset.h"
34 class PictureDescriptor;
41 class MonoPictureFrame;
42 class StereoPictureFrame;
43 class PictureAssetWriter;
45 /** @brief An asset made up of JPEG2000 data */
46 class PictureAsset : public MXFAsset
49 /** Construct a PictureAsset.
51 * @param directory Directory where MXF file is.
52 * @param mxf_name Name of MXF file.
54 PictureAsset (boost::filesystem::path directory, boost::filesystem::path mxf_name);
56 /** Start a progressive write to this asset.
57 * The following parameters must be set up (if required) before calling this:
58 * Interop mode (set_interop)
59 * Edit rate (set_edit_rate)
60 * MXF Metadata (set_metadata)
62 * @param overwrite true to overwrite an existing MXF file; in this mode, writing can be resumed to a partially-written MXF; false if the
63 * MXF file does not exist.
65 virtual boost::shared_ptr<PictureAssetWriter> start_write (bool overwrite) = 0;
67 virtual void read () = 0;
68 virtual void create (std::vector<boost::filesystem::path> const &) {}
69 virtual void create (boost::function<boost::filesystem::path (int)>) {}
75 void set_size (Size s) {
79 void write_to_cpl (xmlpp::Element *, bool) const;
83 bool frame_buffer_equals (
84 int frame, EqualityOptions opt, boost::function<void (NoteType, std::string)> note,
85 uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B
88 bool descriptor_equals (
89 ASDCP::JP2K::PictureDescriptor const & a, ASDCP::JP2K::PictureDescriptor const & b, boost::function<void (NoteType, std::string)>
92 /** picture size in pixels */
96 std::string key_type () const;
97 virtual int edit_rate_factor () const = 0;