Merge branch '2.0' of git.carlh.net:git/dcpomatic into 2.0
[dcpomatic.git] / src / lib / dcp_video.h
1 /*
2     Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
3     Taken from code Copyright (C) 2010-2011 Terrence Meiczinger
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #include "util.h"
22 #include <dcp/picture_mxf_writer.h>
23 #include <libcxml/cxml.h>
24
25 /** @file  src/dcp_video_frame.h
26  *  @brief A single frame of video destined for a DCP.
27  */
28
29 class ServerDescription;
30 class Scaler;
31 class Image;
32 class Log;
33 class Subtitle;
34 class PlayerVideo;
35 class EncodedData;
36
37 /** @class DCPVideo
38  *  @brief A single frame of video destined for a DCP.
39  *
40  *  Given an Image and some settings, this class knows how to encode
41  *  the image to J2K either on the local host or on a remote server.
42  *
43  *  Objects of this class are used for the queue that we keep
44  *  of images that require encoding.
45  */
46 class DCPVideo : public boost::noncopyable
47 {
48 public:
49         DCPVideo (boost::shared_ptr<const PlayerVideo>, int, int, int, Resolution, bool b, boost::shared_ptr<Log>);
50         DCPVideo (boost::shared_ptr<const PlayerVideo>, cxml::ConstNodePtr, boost::shared_ptr<Log>);
51
52         boost::shared_ptr<EncodedData> encode_locally (dcp::NoteHandler note);
53         boost::shared_ptr<EncodedData> encode_remotely (ServerDescription);
54
55         int index () const {
56                 return _index;
57         }
58
59         Eyes eyes () const;
60
61         bool same (boost::shared_ptr<const DCPVideo> other) const;
62         
63 private:
64
65         void add_metadata (xmlpp::Element *) const;
66         
67         boost::shared_ptr<const PlayerVideo> _frame;
68         int _index;                      ///< frame index within the DCP's intrinsic duration
69         int _frames_per_second;          ///< Frames per second that we will use for the DCP
70         int _j2k_bandwidth;              ///< J2K bandwidth to use
71         Resolution _resolution;          ///< Resolution (2K or 4K)
72         bool _burn_subtitles;            ///< true to burn subtitles into the image
73
74         boost::shared_ptr<Log> _log; ///< log
75 };