/* DKDMs are not considered a thing to reset on set_defaults() */
: _dkdms (new DKDMGroup ("root"))
, _default_kdm_duration (1, RoughDuration::Unit::WEEKS)
+ , _export(this)
{
set_defaults ();
}
set_kdm_email_to_default ();
set_notification_email_to_default ();
set_cover_sheet_to_default ();
+
+ _export.set_defaults();
}
void
}
_auto_crop_threshold = f.optional_number_child<double>("AutoCropThreshold").get_value_or(0.1);
+ _export.read(f.optional_node_child("Export"));
+
if (boost::filesystem::exists (_cinemas_file)) {
cxml::Document f ("Cinemas");
f.read_file (_cinemas_file);
root->add_child("DefaultKDMType")->add_child_text(dcp::formulation_to_string(_default_kdm_type));
root->add_child("AutoCropThreshold")->add_child_text(raw_convert<string>(_auto_crop_threshold));
+ _export.write(root->add_child("Export"));
+
auto target = config_write_file();
try {
#include "audio_mapping.h"
+#include "export_config.h"
#include "rough_duration.h"
#include "state.h"
#include "types.h"
maybe_set (_auto_crop_threshold, threshold, AUTO_CROP_THRESHOLD);
}
+ ExportConfig& export_config() {
+ return _export;
+ }
+
void changed (Property p = OTHER);
boost::signals2::signal<void (Property)> Changed;
/** Emitted if read() failed on an existing Config file. There is nothing
static boost::filesystem::path config_read_file ();
static boost::filesystem::path config_write_file ();
-private:
- Config ();
- void read () override;
- void set_defaults ();
- void set_kdm_email_to_default ();
- void set_notification_email_to_default ();
- void set_cover_sheet_to_default ();
- void read_cinemas (cxml::Document const & f);
- void read_dkdm_recipients (cxml::Document const & f);
- std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
- boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
- void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
- void clean_history_internal (std::vector<boost::filesystem::path>& h);
- void backup ();
-
template <class T>
void maybe_set (T& member, T new_value, Property prop = OTHER) {
if (member == new_value) {
changed (prop);
}
+private:
+ Config ();
+ void read () override;
+ void set_defaults ();
+ void set_kdm_email_to_default ();
+ void set_notification_email_to_default ();
+ void set_cover_sheet_to_default ();
+ void read_cinemas (cxml::Document const & f);
+ void read_dkdm_recipients (cxml::Document const & f);
+ std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
+ boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
+ void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
+ void clean_history_internal (std::vector<boost::filesystem::path>& h);
+ void backup ();
+
/** number of threads which a master DoM should use for J2K encoding on the local machine */
int _master_encoding_threads;
/** number of threads which a server should use for J2K encoding on the local machine */
RoughDuration _default_kdm_duration;
double _auto_crop_threshold;
+ ExportConfig _export;
+
static int const _current_version;
/** Singleton instance, or 0 */
static Config* _instance;
};
+
#endif
--- /dev/null
+/*
+ Copyright (C) 2022 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "config.h"
+#include "export_config.h"
+#include <dcp/raw_convert.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
+#include <libxml++/libxml++.h>
+LIBDCP_ENABLE_WARNINGS
+
+
+using std::string;
+
+
+ExportConfig::ExportConfig(Config* parent)
+ : _config(parent)
+{
+
+}
+
+
+void
+ExportConfig::set_defaults()
+{
+ _format = ExportFormat::PRORES;
+ _mixdown_to_stereo = false;
+ _split_reels = false;
+ _split_streams = false;
+ _x264_crf = 23;
+}
+
+
+void
+ExportConfig::read(cxml::ConstNodePtr node)
+{
+ if (!node) {
+ set_defaults();
+ return;
+ }
+
+ auto const format = node->string_child("Format");
+
+ if (format == "subtitles-dcp") {
+ _format = ExportFormat::SUBTITLES_DCP;
+ } else if (format == "h264-aac") {
+ _format = ExportFormat::H264_AAC;
+ } else {
+ _format = ExportFormat::PRORES;
+ }
+
+ _mixdown_to_stereo = node->bool_child("MixdownToStereo");
+ _split_reels = node->bool_child("SplitReels");
+ _split_streams = node->bool_child("SplitStreams");
+ _x264_crf = node->number_child<int>("X264CRF");
+}
+
+
+void
+ExportConfig::write(xmlpp::Element* node) const
+{
+ string name;
+
+ switch (_format) {
+ case ExportFormat::PRORES:
+ name = "prores";
+ break;
+ case ExportFormat::H264_AAC:
+ name = "h264-aac";
+ break;
+ case ExportFormat::SUBTITLES_DCP:
+ name = "subtitles-dcp";
+ break;
+ }
+
+ node->add_child("Format")->add_child_text(name);
+ node->add_child("MixdownToStereo")->add_child_text(_mixdown_to_stereo ? "1" : "0");
+ node->add_child("SplitReels")->add_child_text(_split_reels ? "1" : "0");
+ node->add_child("SplitStreams")->add_child_text(_split_streams ? "1" : "0");
+ node->add_child("X264CRF")->add_child_text(dcp::raw_convert<string>(_x264_crf));
+}
+
+
+void
+ExportConfig::set_format(ExportFormat format)
+{
+ _config->maybe_set(_format, format);
+}
+
+
+void
+ExportConfig::set_mixdown_to_stereo(bool mixdown)
+{
+ _config->maybe_set(_mixdown_to_stereo, mixdown);
+}
+
+
+void
+ExportConfig::set_split_reels(bool split)
+{
+ _config->maybe_set(_split_reels, split);
+}
+
+
+void
+ExportConfig::set_split_streams(bool split)
+{
+ _config->maybe_set(_split_streams, split);
+}
+
+
+void
+ExportConfig::set_x264_crf(int crf)
+{
+ _config->maybe_set(_x264_crf, crf);
+}
+
--- /dev/null
+/*
+ Copyright (C) 2022 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef DCPOMATIC_EXPORT_CONFIG_H
+#define DCPOMATIC_EXPORT_CONFIG_H
+
+
+#include "types.h"
+#include <libcxml/cxml.h>
+
+
+class Config;
+
+
+class ExportConfig
+{
+public:
+ ExportConfig(Config* parent);
+
+ void set_defaults();
+ void read(cxml::ConstNodePtr node);
+ void write(xmlpp::Element* node) const;
+
+ ExportFormat format() const {
+ return _format;
+ }
+
+ bool mixdown_to_stereo() const {
+ return _mixdown_to_stereo;
+ }
+
+ bool split_reels() const {
+ return _split_reels;
+ }
+
+ bool split_streams() const {
+ return _split_streams;
+ }
+
+ int x264_crf() const {
+ return _x264_crf;
+ }
+
+ void set_format(ExportFormat format);
+ void set_mixdown_to_stereo(bool mixdown);
+ void set_split_reels(bool split);
+ void set_split_streams(bool split);
+ void set_x264_crf(int crf);
+
+private:
+ Config* _config;
+ ExportFormat _format;
+ bool _mixdown_to_stereo;
+ bool _split_reels;
+ bool _split_streams;
+ int _x264_crf;
+};
+
+
+#endif
+
examine_content_job.cc
examine_ffmpeg_subtitles_job.cc
exceptions.cc
+ export_config.cc
file_group.cc
file_log.cc
filter_graph.cc
#include "export_video_file_dialog.h"
#include "file_picker_ctrl.h"
#include "wx_util.h"
+#include "lib/config.h"
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/filepicker.h>
: TableDialog (parent, _("Export video file"), 2, 1, true)
, _initial_name (name)
{
+ auto& config = Config::instance()->export_config();
+
add (_("Format"), true);
_format = new wxChoice (this, wxID_ANY);
add (_format);
_split_streams = new CheckBox (this, _("Write each audio channel to its own stream"));
add (_split_streams, false);
_x264_crf_label[0] = add (_("Quality"), true);
- _x264_crf = new wxSlider (this, wxID_ANY, 23, 0, 51, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
+ _x264_crf = new wxSlider (this, wxID_ANY, config.x264_crf(), 0, 51, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
add (_x264_crf, false);
add_spacer ();
_x264_crf_label[1] = add (_("0 is best, 51 is worst"), false);
for (int i = 0; i < FORMATS; ++i) {
_format->Append (format_names[i]);
}
- _format->SetSelection (0);
+ for (int i = 0; i < FORMATS; ++i) {
+ if (config.format() == formats[i]) {
+ _format->SetSelection(i);
+ }
+ }
+
+ _mixdown->SetValue(config.mixdown_to_stereo());
+ _split_reels->SetValue(config.split_reels());
+ _split_streams->SetValue(config.split_streams());
_x264_crf->Enable (false);
for (int i = 0; i < 2; ++i) {
_x264_crf_label[i]->Enable (false);
}
+ _mixdown->Bind (wxEVT_CHECKBOX, bind(&ExportVideoFileDialog::mixdown_changed, this));
+ _split_reels->Bind (wxEVT_CHECKBOX, bind(&ExportVideoFileDialog::split_reels_changed, this));
+ _split_streams->Bind (wxEVT_CHECKBOX, bind(&ExportVideoFileDialog::split_streams_changed, this));
+ _x264_crf->Bind (wxEVT_SLIDER, bind(&ExportVideoFileDialog::x264_crf_changed, this));
_format->Bind (wxEVT_CHOICE, bind (&ExportVideoFileDialog::format_changed, this));
_file->Bind (wxEVT_FILEPICKER_CHANGED, bind (&ExportVideoFileDialog::file_changed, this));
+ format_changed ();
+
layout ();
auto ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
ok->Enable (false);
}
+
+void
+ExportVideoFileDialog::mixdown_changed()
+{
+ Config::instance()->export_config().set_mixdown_to_stereo(_mixdown->GetValue());
+}
+
+
+void
+ExportVideoFileDialog::split_reels_changed()
+{
+ Config::instance()->export_config().set_split_reels(_split_reels->GetValue());
+}
+
+
+void
+ExportVideoFileDialog::split_streams_changed()
+{
+ Config::instance()->export_config().set_split_streams(_split_streams->GetValue());
+}
+
+
+void
+ExportVideoFileDialog::x264_crf_changed()
+{
+ Config::instance()->export_config().set_x264_crf(_x264_crf->GetValue());
+}
+
+
void
ExportVideoFileDialog::format_changed ()
{
- DCPOMATIC_ASSERT (_format->GetSelection() >= 0 && _format->GetSelection() < FORMATS);
- _file->SetWildcard (format_filters[_format->GetSelection()]);
+ auto const selection = _format->GetSelection();
+ DCPOMATIC_ASSERT (selection >= 0 && selection < FORMATS);
+ _file->SetWildcard (format_filters[selection]);
_file->SetPath (_initial_name);
- _x264_crf->Enable (_format->GetSelection() == 1);
+ _x264_crf->Enable (selection == 1);
for (int i = 0; i < 2; ++i) {
- _x264_crf_label[i]->Enable (_format->GetSelection() == 1);
+ _x264_crf_label[i]->Enable (selection == 1);
}
- _mixdown->Enable (_format->GetSelection() != 2);
+ _mixdown->Enable (selection != 2);
+
+ Config::instance()->export_config().set_format(formats[selection]);
}
boost::filesystem::path
private:
void format_changed ();
+ void mixdown_changed ();
+ void split_reels_changed ();
+ void split_streams_changed ();
+ void x264_crf_changed ();
void file_changed ();
std::string _initial_name;
-Subproject commit 6e7c48f621574698db4dcf8021ab137c1f7eee2c
+Subproject commit a89a381e341c161ea636c1018a8f5768b629d87e