Allow specification of audio forensic marking (in KDMs) for some channels only. ... v2.15.x
authorCarl Hetherington <cth@carlh.net>
Sun, 11 Aug 2019 21:56:59 +0000 (22:56 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 11 Aug 2019 21:56:59 +0000 (22:56 +0100)
src/wx/kdm_advanced_dialog.cc
src/wx/kdm_advanced_dialog.h
src/wx/kdm_dialog.cc
src/wx/kdm_output_panel.cc
src/wx/kdm_output_panel.h

index 2027c06..f5ed88b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2019 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 #include "kdm_advanced_dialog.h"
 #include "check_box.h"
+#include "wx_util.h"
+#include <wx/spinctrl.h>
 
-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<int> 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<int>
+KDMAdvancedDialog::forensic_mark_audio_up_to () const
+{
+       if (!_forensic_mark_some_audio->GetValue()) {
+               return optional<int>();
+       }
+
+       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());
+}
index 590c161..25e47d0 100644 (file)
 */
 
 #include "table_dialog.h"
+#include <boost/optional.hpp>
+
+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<int> forensic_mark_audio_up_to);
 
        bool forensic_mark_video () const;
        bool forensic_mark_audio () const;
+       boost::optional<int> 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;
 };
index 55b89a3..5a31501 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
 
     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<const Film> film)
        : wxDialog (parent, wxID_ANY, _("Make KDMs"))
@@ -151,10 +152,18 @@ KDMDialog::make_clicked ()
 
        list<shared_ptr<ScreenKDM> > screen_kdms;
        try {
-
+               /* Start off by enabling forensic marking for all */
+               optional<int> 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<int>() : 0
+                       !_output->forensic_mark_video(), for_audio
                        );
 
        } catch (runtime_error& e) {
index 181ca74..d76a273 100644 (file)
@@ -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 ();
 }
 
index c52fa7a..7b93150 100644 (file)
@@ -47,6 +47,9 @@ public:
        bool forensic_mark_audio () const {
                return _forensic_mark_audio;
        }
+       boost::optional<int> forensic_mark_audio_up_to () const {
+               return _forensic_mark_audio_up_to;
+       }
 
        std::pair<boost::shared_ptr<Job>, int> make (
                std::list<boost::shared_ptr<ScreenKDM> > screen_kdms,
@@ -74,4 +77,5 @@ private:
        wxCheckBox* _email;
        bool _forensic_mark_video;
        bool _forensic_mark_audio;
+       boost::optional<int> _forensic_mark_audio_up_to;
 };