2 Copyright (C) 2022 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/>.
23 #include "export_config.h"
24 #include <dcp/raw_convert.h>
25 #include <dcp/warnings.h>
26 LIBDCP_DISABLE_WARNINGS
27 #include <libxml++/libxml++.h>
28 LIBDCP_ENABLE_WARNINGS
34 ExportConfig::ExportConfig(Config* parent)
42 ExportConfig::set_defaults()
44 _format = ExportFormat::PRORES_HQ;
45 _mixdown_to_stereo = false;
47 _split_streams = false;
53 ExportConfig::read(cxml::ConstNodePtr node)
60 auto const format = node->string_child("Format");
62 if (format == "subtitles-dcp") {
63 _format = ExportFormat::SUBTITLES_DCP;
64 } else if (format == "h264-aac") {
65 _format = ExportFormat::H264_AAC;
66 } else if (format == "prores-4444") {
67 _format = ExportFormat::PRORES_4444;
69 _format = ExportFormat::PRORES_HQ;
72 _mixdown_to_stereo = node->bool_child("MixdownToStereo");
73 _split_reels = node->bool_child("SplitReels");
74 _split_streams = node->bool_child("SplitStreams");
75 _x264_crf = node->number_child<int>("X264CRF");
80 ExportConfig::write(xmlpp::Element* node) const
85 case ExportFormat::PRORES_4444:
88 case ExportFormat::PRORES_HQ:
89 /* Write this but we also accept 'prores' for backwards compatibility */
92 case ExportFormat::H264_AAC:
95 case ExportFormat::SUBTITLES_DCP:
96 name = "subtitles-dcp";
100 node->add_child("Format")->add_child_text(name);
101 node->add_child("MixdownToStereo")->add_child_text(_mixdown_to_stereo ? "1" : "0");
102 node->add_child("SplitReels")->add_child_text(_split_reels ? "1" : "0");
103 node->add_child("SplitStreams")->add_child_text(_split_streams ? "1" : "0");
104 node->add_child("X264CRF")->add_child_text(dcp::raw_convert<string>(_x264_crf));
109 ExportConfig::set_format(ExportFormat format)
111 _config->maybe_set(_format, format);
116 ExportConfig::set_mixdown_to_stereo(bool mixdown)
118 _config->maybe_set(_mixdown_to_stereo, mixdown);
123 ExportConfig::set_split_reels(bool split)
125 _config->maybe_set(_split_reels, split);
130 ExportConfig::set_split_streams(bool split)
132 _config->maybe_set(_split_streams, split);
137 ExportConfig::set_x264_crf(int crf)
139 _config->maybe_set(_x264_crf, crf);