Make video frame rate option respect OK/Cancel.
authorCarl Hetherington <cth@carlh.net>
Fri, 14 Oct 2022 23:58:54 +0000 (01:58 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 15 Oct 2022 21:24:56 +0000 (23:24 +0200)
src/wx/content_advanced_dialog.cc
src/wx/content_advanced_dialog.h
src/wx/content_menu.cc

index 21cba5e8a31041ec2d97c58684b8fc5255f90232..ba2c3f43b67b2e2588388c7b62c0004776386b99 100644 (file)
@@ -197,15 +197,20 @@ ContentAdvancedDialog::filters_changed (vector<Filter const *> filters)
 }
 
 
-void
-ContentAdvancedDialog::set_video_frame_rate ()
+optional<double>
+ContentAdvancedDialog::video_frame_rate() const
 {
-       if (_video_frame_rate->GetValue() != wxT("")) {
-               _content->set_video_frame_rate (locale_convert<double>(wx_to_std(_video_frame_rate->GetValue())));
-       } else {
-               _content->unset_video_frame_rate ();
+       if (_video_frame_rate->GetValue() == wxT("")) {
+               return {};
        }
 
+       return locale_convert<double>(wx_to_std(_video_frame_rate->GetValue()));
+}
+
+
+void
+ContentAdvancedDialog::set_video_frame_rate ()
+{
        _set_video_frame_rate->Enable (false);
 }
 
index 26c1a374afc2dab02ea7487faf0a0eb77bf30f78..3c2454449b742c8addeda51f7b998544a35a5a04 100644 (file)
@@ -23,6 +23,7 @@
 LIBDCP_DISABLE_WARNINGS
 #include <wx/wx.h>
 LIBDCP_ENABLE_WARNINGS
+#include <boost/optional.hpp>
 #include <memory>
 #include <vector>
 
@@ -38,10 +39,13 @@ public:
        ContentAdvancedDialog (wxWindow* parent, std::shared_ptr<Content> content);
 
        bool ignore_video() const;
+
        std::vector<Filter const*> filters() {
                return _filters_list;
        }
 
+       boost::optional<double> video_frame_rate() const;
+
 private:
        void edit_filters ();
        void filters_changed (std::vector<Filter const *> filters);
index 6e903397d54585b4b49efacb2387cd2e09aa0da2..3dfb2f28214409a406e11c25272bc45393501aca 100644 (file)
@@ -480,6 +480,12 @@ ContentMenu::advanced ()
        if (ffmpeg) {
                ffmpeg->set_filters(dialog->filters());
        }
+
+       if (dialog->video_frame_rate()) {
+               content->set_video_frame_rate(*dialog->video_frame_rate());
+       } else {
+               content->unset_video_frame_rate();
+       }
 }