2 Copyright (C) 2020 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 #include "copy_dcp_details_to_film.h"
22 #include "dcp_content.h"
25 #include "video_content.h"
26 #include "audio_content.h"
28 #include "dcp_content_type.h"
29 #include <boost/shared_ptr.hpp>
36 using boost::shared_ptr;
40 copy_dcp_details_to_film (shared_ptr<const DCPContent> dcp, shared_ptr<Film> film)
42 string name = dcp->name ();
43 name = name.substr (0, name.find("_"));
44 film->set_name (name);
45 film->set_use_isdcf_name (true);
46 if (dcp->content_kind()) {
47 film->set_dcp_content_type (DCPContentType::from_libdcp_kind(dcp->content_kind().get()));
49 film->set_encrypted (dcp->encrypted());
50 film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
51 film->set_interop (dcp->standard() == dcp::INTEROP);
52 film->set_three_d (dcp->three_d());
55 film->set_container (Ratio::nearest_from_ratio(dcp->video->size().ratio()));
56 film->set_resolution (dcp->resolution());
57 DCPOMATIC_ASSERT (dcp->video_frame_rate());
58 film->set_video_frame_rate (*dcp->video_frame_rate());
62 film->set_audio_channels (dcp->audio->stream()->channels());
65 map<dcp::Marker, dcpomatic::ContentTime> dcp_markers;
66 map<dcp::Marker, dcpomatic::DCPTime> film_markers;
67 film->clear_markers ();
68 for (map<dcp::Marker, dcpomatic::ContentTime>::const_iterator i = dcp_markers.begin(); i != dcp_markers.end(); ++i) {
69 film->set_marker (i->first, dcpomatic::DCPTime(i->second.get()));
72 film->set_ratings (dcp->ratings());
75 cv.push_back (dcp->content_version());
76 film->set_content_versions (cv);