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>
34 using boost::shared_ptr;
37 copy_dcp_details_to_film (shared_ptr<const DCPContent> dcp, shared_ptr<Film> film)
39 string name = dcp->name ();
40 name = name.substr (0, name.find("_"));
41 film->set_name (name);
42 film->set_use_isdcf_name (true);
43 if (dcp->content_kind()) {
44 film->set_dcp_content_type (DCPContentType::from_libdcp_kind(dcp->content_kind().get()));
46 film->set_encrypted (dcp->encrypted());
47 film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
48 film->set_interop (dcp->standard() == dcp::INTEROP);
49 film->set_three_d (dcp->three_d());
52 film->set_container (Ratio::nearest_from_ratio(dcp->video->size().ratio()));
53 film->set_resolution (dcp->resolution());
54 DCPOMATIC_ASSERT (dcp->video_frame_rate());
55 film->set_video_frame_rate (*dcp->video_frame_rate());
59 film->set_audio_channels (dcp->audio->stream()->channels());
62 map<dcp::Marker, dcpomatic::ContentTime> dcp_markers;
63 map<dcp::Marker, dcpomatic::DCPTime> film_markers;
64 film->clear_markers ();
65 for (map<dcp::Marker, dcpomatic::ContentTime>::const_iterator i = dcp_markers.begin(); i != dcp_markers.end(); ++i) {
66 film->set_marker (i->first, dcpomatic::DCPTime(i->second.get()));
69 film->set_ratings (dcp->ratings());
70 film->set_content_version (dcp->content_version());