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