2 Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef DCPOMATIC_VIDEO_CONTENT_SCALE_H
22 #define DCPOMATIC_VIDEO_CONTENT_SCALE_H
25 #include <boost/shared_ptr.hpp>
39 class VideoContentScale
43 explicit VideoContentScale (Ratio const *);
44 explicit VideoContentScale (bool);
45 explicit VideoContentScale (boost::shared_ptr<cxml::Node>);
47 dcp::Size size (boost::shared_ptr<const VideoContent>, dcp::Size display_container, dcp::Size film_container) const;
48 std::string id () const;
49 std::string name () const;
50 void as_xml (xmlpp::Node *) const;
52 Ratio const * ratio () const {
60 static void setup_scales ();
61 static std::vector<VideoContentScale> all () {
64 static VideoContentScale from_id (std::string id);
67 /** a ratio to stretch the content to, or 0 for no stretch */
69 /** true if we want to change the size of the content in any way */
72 /* If _ratio is 0 and _scale is false there is no scale at all (i.e.
73 the content is used at its original size)
76 static std::vector<VideoContentScale> _scales;
79 bool operator== (VideoContentScale const & a, VideoContentScale const & b);
80 bool operator!= (VideoContentScale const & a, VideoContentScale const & b);