From 910ea473219f2e7c672ad437d458316deca67025 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 11 Aug 2019 22:56:59 +0100 Subject: [PATCH] Allow specification of audio forensic marking (in KDMs) for some channels only. Default to enabling forensic marking for video and audio (up to and including channel 12). Fixes #1498. --- src/wx/kdm_advanced_dialog.cc | 48 +++++++++++++++++++++++++++++++++-- src/wx/kdm_advanced_dialog.h | 11 +++++++- src/wx/kdm_dialog.cc | 15 ++++++++--- src/wx/kdm_output_panel.cc | 8 +++--- src/wx/kdm_output_panel.h | 4 +++ 5 files changed, 77 insertions(+), 9 deletions(-) diff --git a/src/wx/kdm_advanced_dialog.cc b/src/wx/kdm_advanced_dialog.cc index 2027c0639..f5ed88b41 100644 --- a/src/wx/kdm_advanced_dialog.cc +++ b/src/wx/kdm_advanced_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Carl Hetherington + Copyright (C) 2018-2019 Carl Hetherington This file is part of DCP-o-matic. @@ -20,8 +20,12 @@ #include "kdm_advanced_dialog.h" #include "check_box.h" +#include "wx_util.h" +#include -KDMAdvancedDialog::KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio) +using boost::optional; + +KDMAdvancedDialog::KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio, optional forensic_mark_audio_up_to) : TableDialog (parent, _("Advanced KDM options"), 2, 1, false) { _forensic_mark_video = new CheckBox (this, _("Forensically mark video")); @@ -33,7 +37,29 @@ KDMAdvancedDialog::KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video add (_forensic_mark_audio); add_spacer (); + _forensic_mark_all_audio = new wxRadioButton (this, wxID_ANY, _("Mark all audio channels")); + _table->Add (_forensic_mark_all_audio, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP); + add_spacer (); + wxBoxSizer* hbox = new wxBoxSizer (wxHORIZONTAL); + _forensic_mark_some_audio = new wxRadioButton (this, wxID_ANY, _("Mark audio channels up to (and including)")); + hbox->Add (_forensic_mark_some_audio, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP); + _forensic_mark_audio_up_to = new wxSpinCtrl (this, wxID_ANY); + hbox->Add (_forensic_mark_audio_up_to, 0, wxRIGHT, DCPOMATIC_SIZER_X_GAP); + _table->Add (hbox, 0, wxLEFT, DCPOMATIC_SIZER_GAP); + add_spacer (); + + if (forensic_mark_audio_up_to) { + _forensic_mark_audio_up_to->SetValue (*forensic_mark_audio_up_to); + _forensic_mark_some_audio->SetValue (true); + } + layout (); + setup_sensitivity (); + + _forensic_mark_audio_up_to->SetRange (1, 15); + _forensic_mark_audio->Bind (wxEVT_CHECKBOX, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this)); + _forensic_mark_all_audio->Bind (wxEVT_RADIOBUTTON, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this)); + _forensic_mark_some_audio->Bind (wxEVT_RADIOBUTTON, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this)); } bool @@ -47,3 +73,21 @@ KDMAdvancedDialog::forensic_mark_audio () const { return _forensic_mark_audio->GetValue (); } + +optional +KDMAdvancedDialog::forensic_mark_audio_up_to () const +{ + if (!_forensic_mark_some_audio->GetValue()) { + return optional(); + } + + return _forensic_mark_audio_up_to->GetValue(); +} + +void +KDMAdvancedDialog::setup_sensitivity () +{ + _forensic_mark_all_audio->Enable (_forensic_mark_audio->GetValue()); + _forensic_mark_some_audio->Enable (_forensic_mark_audio->GetValue()); + _forensic_mark_audio_up_to->Enable (_forensic_mark_audio->GetValue() && _forensic_mark_some_audio->GetValue()); +} diff --git a/src/wx/kdm_advanced_dialog.h b/src/wx/kdm_advanced_dialog.h index 590c16137..25e47d05c 100644 --- a/src/wx/kdm_advanced_dialog.h +++ b/src/wx/kdm_advanced_dialog.h @@ -19,16 +19,25 @@ */ #include "table_dialog.h" +#include + +class wxSpinCtrl; class KDMAdvancedDialog : public TableDialog { public: - KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio); + KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio, boost::optional forensic_mark_audio_up_to); bool forensic_mark_video () const; bool forensic_mark_audio () const; + boost::optional forensic_mark_audio_up_to () const; private: + void setup_sensitivity (); + wxCheckBox* _forensic_mark_video; wxCheckBox* _forensic_mark_audio; + wxRadioButton* _forensic_mark_all_audio; + wxRadioButton* _forensic_mark_some_audio; + wxSpinCtrl* _forensic_mark_audio_up_to; }; diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 55b89a371..5a31501cf 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2018 Carl Hetherington + Copyright (C) 2012-2019 Carl Hetherington This file is part of DCP-o-matic. @@ -51,6 +51,7 @@ using std::make_pair; using std::runtime_error; using boost::shared_ptr; using boost::bind; +using boost::optional; KDMDialog::KDMDialog (wxWindow* parent, shared_ptr film) : wxDialog (parent, wxID_ANY, _("Make KDMs")) @@ -151,10 +152,18 @@ KDMDialog::make_clicked () list > screen_kdms; try { - + /* Start off by enabling forensic marking for all */ + optional for_audio; + if (!_output->forensic_mark_audio()) { + /* No forensic marking for audio */ + for_audio = 0; + } else if (_output->forensic_mark_audio_up_to()) { + /* Forensic mark up to this channel; disabled on channels greater than this */ + for_audio = _output->forensic_mark_audio_up_to(); + } screen_kdms = film->make_kdms ( _screens->screens(), _cpl->cpl(), _timing->from(), _timing->until(), _output->formulation(), - !_output->forensic_mark_video(), _output->forensic_mark_audio() ? boost::optional() : 0 + !_output->forensic_mark_video(), for_audio ); } catch (runtime_error& e) { diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc index 181ca74f4..d76a27359 100644 --- a/src/wx/kdm_output_panel.cc +++ b/src/wx/kdm_output_panel.cc @@ -49,8 +49,9 @@ using boost::function; KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop) : wxPanel (parent, wxID_ANY) - , _forensic_mark_video (false) - , _forensic_mark_audio (false) + , _forensic_mark_video (true) + , _forensic_mark_audio (true) + , _forensic_mark_audio_up_to (12) { wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0); @@ -160,10 +161,11 @@ KDMOutputPanel::setup_sensitivity () void KDMOutputPanel::advanced_clicked () { - KDMAdvancedDialog* d = new KDMAdvancedDialog (this, _forensic_mark_video, _forensic_mark_audio); + KDMAdvancedDialog* d = new KDMAdvancedDialog (this, _forensic_mark_video, _forensic_mark_audio, _forensic_mark_audio_up_to); d->ShowModal (); _forensic_mark_video = d->forensic_mark_video (); _forensic_mark_audio = d->forensic_mark_audio (); + _forensic_mark_audio_up_to = d->forensic_mark_audio_up_to (); d->Destroy (); } diff --git a/src/wx/kdm_output_panel.h b/src/wx/kdm_output_panel.h index c52fa7a15..7b9315071 100644 --- a/src/wx/kdm_output_panel.h +++ b/src/wx/kdm_output_panel.h @@ -47,6 +47,9 @@ public: bool forensic_mark_audio () const { return _forensic_mark_audio; } + boost::optional forensic_mark_audio_up_to () const { + return _forensic_mark_audio_up_to; + } std::pair, int> make ( std::list > screen_kdms, @@ -74,4 +77,5 @@ private: wxCheckBox* _email; bool _forensic_mark_video; bool _forensic_mark_audio; + boost::optional _forensic_mark_audio_up_to; }; -- 2.30.2