2 Copyright (C) 2015 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 #ifndef DCPOMATIC_JPEG2000_ENCODER_H
21 #define DCPOMATIC_JPEG2000_ENCODER_H
24 #include <dcp/types.h>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/optional.hpp>
38 virtual ~JPEG2000Encoder () {}
40 /** @return Internationalised descriptive name for this encoder */
41 virtual std::string name () const = 0;
42 /** @return Non-internationalised ID for this encoder */
43 virtual std::string id () const = 0;
45 /** @param input XYZ input frame.
46 * @param note_handler Handler for notes about the encode.
48 * @return Encoded JPEG2000 data.
50 boost::shared_ptr<EncodedData> encode (
51 boost::shared_ptr<const dcp::XYZImage> input,
52 dcp::NoteHandler note_handler,
55 Resolution resolution,
59 static void setup_encoders ();
60 /** @return Return all available JPEG2000 encoders in order of preference (best first) */
61 static std::vector<boost::shared_ptr<JPEG2000Encoder> > all ();
62 static boost::shared_ptr<JPEG2000Encoder> from_id (std::string id);
66 virtual boost::shared_ptr<EncodedData> do_encode (
67 boost::shared_ptr<const dcp::XYZImage> input,
68 dcp::NoteHandler note_handler
71 virtual void set_bandwidth (int bandwidth) = 0;
72 virtual void set_frame_rate (int frame_rate) = 0;
73 virtual void set_resolution (Resolution resolution) = 0;
74 virtual void set_threed (bool threed) = 0;
76 boost::optional<int> _last_bandwidth;
77 boost::optional<int> _last_frame_rate;
78 boost::optional<Resolution> _last_resolution;
79 boost::optional<bool> _last_threed;
81 static std::vector<boost::shared_ptr<JPEG2000Encoder> > _encoders;