2 Copyright (C) 2013-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_VIDEO_CONTENT_SCALE_H
21 #define DCPOMATIC_VIDEO_CONTENT_SCALE_H
24 #include <boost/shared_ptr.hpp>
38 class VideoContentScale
42 VideoContentScale (Ratio const *);
43 VideoContentScale (bool);
44 VideoContentScale (boost::shared_ptr<cxml::Node>);
46 dcp::Size size (boost::shared_ptr<const VideoContent>, dcp::Size display_container, dcp::Size film_container) const;
47 std::string id () const;
48 std::string name () const;
49 void as_xml (xmlpp::Node *) const;
51 Ratio const * ratio () const {
59 static void setup_scales ();
60 static std::vector<VideoContentScale> all () {
63 static VideoContentScale from_id (std::string id);
66 /** a ratio to stretch the content to, or 0 for no stretch */
68 /** true if we want to change the size of the content in any way */
71 /* If _ratio is 0 and _scale is false there is no scale at all (i.e.
72 the content is used at its original size)
75 static std::vector<VideoContentScale> _scales;
78 bool operator== (VideoContentScale const & a, VideoContentScale const & b);
79 bool operator!= (VideoContentScale const & a, VideoContentScale const & b);