It builds again.
[libdcp.git] / src / picture_mxf.h
1 /*
2     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef LIBDCP_PICTURE_MXF_H
21 #define LIBDCP_PICTURE_MXF_H
22
23 /** @file  src/picture_asset.h
24  *  @brief An asset made up of JPEG2000 data
25  */
26
27 #include <openjpeg.h>
28 #include "mxf.h"
29 #include "util.h"
30 #include "metadata.h"
31
32 namespace ASDCP {
33         namespace JP2K {
34                 class PictureDescriptor;
35         }
36 }
37
38 namespace dcp
39 {
40
41 class MonoPictureFrame; 
42 class StereoPictureFrame;
43 class PictureMXFWriter;
44
45 /** @brief An asset made up of JPEG2000 data */
46 class PictureMXF : public MXF
47 {
48 public:
49         PictureMXF (boost::filesystem::path file);
50         PictureMXF (Fraction edit_rate);
51
52         virtual boost::shared_ptr<PictureMXFWriter> start_write (boost::filesystem::path file, Standard standard, bool overwrite) = 0;
53
54         void write_to_pkl (xmlpp::Node* node) const;
55
56         Size size () const {
57                 return _size;
58         }
59
60         Fraction frame_rate () const {
61                 return _frame_rate;
62         }
63
64         Fraction screen_aspect_ratio () const {
65                 return _screen_aspect_ratio;
66         }
67
68         Fraction edit_rate () const {
69                 return _edit_rate;
70         }
71
72 protected:      
73
74         bool frame_buffer_equals (
75                 int frame, EqualityOptions opt, boost::function<void (NoteType, std::string)> note,
76                 uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B
77                 ) const;
78
79         bool descriptor_equals (
80                 ASDCP::JP2K::PictureDescriptor const & a, ASDCP::JP2K::PictureDescriptor const & b, boost::function<void (NoteType, std::string)>
81                 ) const;
82
83         void read_picture_descriptor (ASDCP::JP2K::PictureDescriptor const &);
84
85         /** picture size in pixels */
86         Size _size;
87         Fraction _frame_rate;
88         Fraction _screen_aspect_ratio;
89
90 private:
91         std::string key_type () const;
92         virtual int edit_rate_factor () const = 0;
93 };
94         
95
96 }
97
98 #endif