Build fix.
[libdcp.git] / src / picture_asset.h
1 /*
2     Copyright (C) 2012-2014 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_ASSET_H
21 #define LIBDCP_PICTURE_ASSET_H
22
23 /** @file  src/picture_asset.h
24  *  @brief PictureAsset class.
25  */
26
27 #include "mxf.h"
28 #include "util.h"
29 #include "metadata.h"
30 #include <openjpeg.h>
31
32 namespace ASDCP {
33         namespace JP2K {
34                 struct PictureDescriptor;
35         }
36 }
37
38 namespace dcp
39 {
40
41 class MonoPictureFrame;
42 class StereoPictureFrame;
43 class PictureAssetWriter;
44
45 /** @class PictureAsset
46  *  @brief An asset made up of JPEG2000 data.
47  */
48 class PictureAsset : public Asset, public MXF
49 {
50 public:
51         PictureAsset (boost::filesystem::path file);
52         PictureAsset (Fraction edit_rate);
53
54         virtual boost::shared_ptr<PictureAssetWriter> start_write (
55                 boost::filesystem::path file,
56                 Standard standard,
57                 bool overwrite
58                 ) = 0;
59
60         Size size () const {
61                 return _size;
62         }
63
64         void set_size (Size s) {
65                 _size = s;
66         }
67
68         Fraction frame_rate () const {
69                 return _frame_rate;
70         }
71
72         void set_frame_rate (Fraction r) {
73                 _frame_rate = r;
74         }
75
76         Fraction screen_aspect_ratio () const {
77                 return _screen_aspect_ratio;
78         }
79
80         void set_screen_aspect_ratio (Fraction r) {
81                 _screen_aspect_ratio = r;
82         }
83
84         Fraction edit_rate () const {
85                 return _edit_rate;
86         }
87
88         int64_t intrinsic_duration () const {
89                 return _intrinsic_duration;
90         }
91
92 protected:
93         friend class MonoPictureAssetWriter;
94         friend class StereoPictureAssetWriter;
95
96         bool frame_buffer_equals (
97                 int frame, EqualityOptions opt, NoteHandler note,
98                 uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B
99                 ) const;
100
101         bool descriptor_equals (
102                 ASDCP::JP2K::PictureDescriptor const & a,
103                 ASDCP::JP2K::PictureDescriptor const & b,
104                 NoteHandler note
105                 ) const;
106
107         void read_picture_descriptor (ASDCP::JP2K::PictureDescriptor const &);
108
109         Fraction _edit_rate;
110         /** The total length of this content in video frames.  The amount of
111          *  content presented may be less than this.
112          */
113         int64_t _intrinsic_duration;
114         /** picture size in pixels */
115         Size _size;
116         Fraction _frame_rate;
117         Fraction _screen_aspect_ratio;
118
119 private:
120         std::string pkl_type (Standard standard) const;
121 };
122
123
124 }
125
126 #endif