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 /** @file src/picture_asset.h
21 * @brief An asset made up of JPEG2000 files
25 #include "mxf_asset.h"
31 class MonoPictureFrame;
32 class StereoPictureFrame;
34 /** @brief An asset made up of JPEG2000 files */
35 class PictureAsset : public MXFAsset
38 PictureAsset (std::string directory, std::string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int intrinsic_duration);
40 /** Write details of this asset to a CPL stream.
43 void write_to_cpl (std::ostream& s) const;
45 bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) const;
53 bool frame_buffer_equals (
54 int frame, EqualityOptions opt, std::list<std::string>& notes,
55 uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B
58 /** picture size in pixels */
62 /** A 2D (monoscopic) picture asset */
63 class MonoPictureAsset : public PictureAsset
66 /** Construct a PictureAsset, generating the MXF from the JPEG2000 files.
67 * This may take some time; progress is indicated by emission of the Progress signal.
68 * @param files Pathnames of JPEG2000 files, in frame order.
69 * @param directory Directory in which to create MXF file.
70 * @param mxf_name Name of MXF file to create.
71 * @param progress Signal to inform of progress.
72 * @param fps Frames per second.
73 * @param intrinsic_duration Length of the whole asset in frames.
74 * @param size Size of images in pixels.
77 std::vector<std::string> const & files,
78 std::string directory,
80 boost::signals2::signal<void (float)>* progress,
82 int intrinsic_duration,
86 /** Construct a PictureAsset, generating the MXF from the JPEG2000 files.
87 * This may take some time; progress is indicated by emission of the Progress signal.
88 * @param get_path Functor which returns a JPEG2000 file path for a given frame (frames counted from 0).
89 * @param directory Directory in which to create MXF file.
90 * @param mxf_name Name of MXF file to create.
91 * @param progress Signal to inform of progress.
92 * @param fps Frames per second.
93 * @param intrinsic_duration Length of the whole asset in frames.
94 * @param size Size of images in pixels.
97 boost::function<std::string (int)> get_path,
98 std::string directory,
100 boost::signals2::signal<void (float)>* progress,
102 int intrinsic_duration,
106 MonoPictureAsset (std::string directory, std::string mxf_name, int fps, int intrinsic_duration);
108 boost::shared_ptr<const MonoPictureFrame> get_frame (int n) const;
109 bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) const;
112 std::string path_from_list (int f, std::vector<std::string> const & files) const;
113 void construct (boost::function<std::string (int)>);
116 /** A 3D (stereoscopic) picture asset */
117 class StereoPictureAsset : public PictureAsset
120 StereoPictureAsset (std::string directory, std::string mxf_name, int fps, int intrinsic_duration);
122 boost::shared_ptr<const StereoPictureFrame> get_frame (int n) const;
123 bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) const;