Allow specification of audio forensic marking (in KDMs) for some channels only. ...
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 2027c06392efa247bd0c665b490a8f3e798870bb..f5ed88b41c80afef5d4030cd65b0ded5f61b57b9 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.
 
 
     This file is part of DCP-o-matic.
 
 
 #include "kdm_advanced_dialog.h"
 #include "check_box.h"
 
 #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"));
        : 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 ();
 
        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 ();
        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
 }
 
 bool
@@ -47,3 +73,21 @@ KDMAdvancedDialog::forensic_mark_audio () const
 {
        return _forensic_mark_audio->GetValue ();
 }
 {
        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 590c16137ecd60c05cbaebabf1dc6b0828ab657f..25e47d05c8658e042f430190672823a7617de2c0 100644 (file)
 */
 
 #include "table_dialog.h"
 */
 
 #include "table_dialog.h"
+#include <boost/optional.hpp>
+
+class wxSpinCtrl;
 
 class KDMAdvancedDialog : public TableDialog
 {
 public:
 
 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;
 
        bool forensic_mark_video () const;
        bool forensic_mark_audio () const;
+       boost::optional<int> forensic_mark_audio_up_to () const;
 
 private:
 
 private:
+       void setup_sensitivity ();
+
        wxCheckBox* _forensic_mark_video;
        wxCheckBox* _forensic_mark_audio;
        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 55b89a37128925841dafbcada17040c9faac4508..5a31501cf27bb3e53a14ddb82e774ebe5db9d557 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.
 
 
     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 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"))
 
 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 {
 
        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(),
                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) {
                        );
 
        } catch (runtime_error& e) {
index 181ca74f4008cd897b75861eaba37d676534677f..d76a2735902d97923466f8ce1bac34b7ad391b1e 100644 (file)
@@ -49,8 +49,9 @@ using boost::function;
 
 KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
        : wxPanel (parent, wxID_ANY)
 
 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);
 
 {
        wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0);
 
@@ -160,10 +161,11 @@ KDMOutputPanel::setup_sensitivity ()
 void
 KDMOutputPanel::advanced_clicked ()
 {
 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 ();
        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 ();
 }
 
        d->Destroy ();
 }
 
index c52fa7a1530ca6418b1493e194f36cb87604c511..7b931507170122d8ba7f78ffcfea864e26f2518c 100644 (file)
@@ -47,6 +47,9 @@ public:
        bool forensic_mark_audio () const {
                return _forensic_mark_audio;
        }
        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,
 
        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;
        wxCheckBox* _email;
        bool _forensic_mark_video;
        bool _forensic_mark_audio;
+       boost::optional<int> _forensic_mark_audio_up_to;
 };
 };