Add FFmpeg content dialog; moving ffmpeg-specific things out of the film editor.
authorCarl Hetherington <cth@carlh.net>
Sat, 4 May 2013 15:52:48 +0000 (16:52 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 4 May 2013 15:52:48 +0000 (16:52 +0100)
src/lib/film.cc
src/lib/film.h
src/lib/playlist.cc
src/lib/playlist.h
src/wx/ffmpeg_content_dialog.cc [new file with mode: 0644]
src/wx/ffmpeg_content_dialog.h [new file with mode: 0644]
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/imagemagick_content_dialog.cc
src/wx/imagemagick_content_dialog.h
src/wx/wscript

index 8fed87122977bdf311d9640f1cd2c8a4d92ab496..7d1985d08eac56cea8265762c5af171191342919 100644 (file)
@@ -1154,66 +1154,10 @@ Film::content_length () const
        return _playlist->content_length ();
 }
 
-vector<FFmpegSubtitleStream>
-Film::ffmpeg_subtitle_streams () const
-{
-       shared_ptr<FFmpegContent> f = _playlist->ffmpeg ();
-       if (f) {
-               return f->subtitle_streams ();
-       }
-
-       return vector<FFmpegSubtitleStream> ();
-}
-
-boost::optional<FFmpegSubtitleStream>
-Film::ffmpeg_subtitle_stream () const
-{
-       shared_ptr<FFmpegContent> f = _playlist->ffmpeg ();
-       if (f) {
-               return f->subtitle_stream ();
-       }
-
-       return boost::none;
-}
-
-vector<FFmpegAudioStream>
-Film::ffmpeg_audio_streams () const
-{
-       shared_ptr<FFmpegContent> f = _playlist->ffmpeg ();
-       if (f) {
-               return f->audio_streams ();
-       }
-
-       return vector<FFmpegAudioStream> ();
-}
-
-boost::optional<FFmpegAudioStream>
-Film::ffmpeg_audio_stream () const
-{
-       shared_ptr<FFmpegContent> f = _playlist->ffmpeg ();
-       if (f) {
-               return f->audio_stream ();
-       }
-
-       return boost::none;
-}
-
-void
-Film::set_ffmpeg_subtitle_stream (FFmpegSubtitleStream s)
-{
-       shared_ptr<FFmpegContent> f = _playlist->ffmpeg ();
-       if (f) {
-               f->set_subtitle_stream (s);
-       }
-}
-
-void
-Film::set_ffmpeg_audio_stream (FFmpegAudioStream s)
+bool
+Film::has_subtitles () const
 {
-       shared_ptr<FFmpegContent> f = _playlist->ffmpeg ();
-       if (f) {
-               f->set_audio_stream (s);
-       }
+       return _playlist->has_subtitles ();
 }
 
 void
index f4d7cde677a78518f064e2624379cae310064c78..48b0d16c548d921c9adebb2e05b1a3c20eb675c6 100644 (file)
@@ -112,6 +112,8 @@ public:
        int audio_channels () const;
        int audio_frame_rate () const;
        bool has_audio () const;
+
+       bool has_subtitles () const;
        
        float video_frame_rate () const;
        libdcp::Size video_size () const;
@@ -119,17 +121,10 @@ public:
 
        ContentVideoFrame content_length () const;
 
-       std::vector<FFmpegSubtitleStream> ffmpeg_subtitle_streams () const;
-       boost::optional<FFmpegSubtitleStream> ffmpeg_subtitle_stream () const;
-       std::vector<FFmpegAudioStream> ffmpeg_audio_streams () const;
-       boost::optional<FFmpegAudioStream> ffmpeg_audio_stream () const;
-
-       void set_ffmpeg_subtitle_stream (FFmpegSubtitleStream);
-       void set_ffmpeg_audio_stream (FFmpegAudioStream);
-
        void set_loop (int);
        int loop () const;
 
+
        enum TrimType {
                CPL,
                ENCODE
index 72745f2208435e31e69964e8a16eba1c948d756d..63b44f9d649f8ad59ad4d24d8355feb27802a202 100644 (file)
@@ -416,3 +416,14 @@ Playlist::ffmpeg () const
 
        return shared_ptr<FFmpegContent> ();
 }
+
+bool
+Playlist::has_subtitles () const
+{
+       shared_ptr<FFmpegContent> fc = ffmpeg ();
+       if (!fc) {
+               return false;
+       }
+       
+       return !fc->subtitle_streams().empty();
+}
index 935bbb2bdddd759cebd869340bbb68561ab7c142..e6acff6944472db7e45827237914f1279c1c1a93 100644 (file)
@@ -82,6 +82,8 @@ public:
                return _audio_from;
        }
 
+       bool has_subtitles () const;
+       
        ContentList content () const {
                return _content;
        }
diff --git a/src/wx/ffmpeg_content_dialog.cc b/src/wx/ffmpeg_content_dialog.cc
new file mode 100644 (file)
index 0000000..540bae0
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+
+    This program 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.
+
+    This program 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 this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/lexical_cast.hpp>
+#include "lib/ffmpeg_content.h"
+#include "ffmpeg_content_dialog.h"
+#include "wx_util.h"
+
+using std::vector;
+using std::string;
+using boost::shared_ptr;
+using boost::lexical_cast;
+
+FFmpegContentDialog::FFmpegContentDialog (wxWindow* parent, shared_ptr<FFmpegContent> content)
+       : wxDialog (parent, wxID_ANY, _("Video"))
+{
+       wxFlexGridSizer* grid = new wxFlexGridSizer (3, 6, 6);
+       grid->AddGrowableCol (1, 1);
+
+       add_label_to_sizer (grid, this, _("Audio Stream"));
+       _audio_stream = new wxChoice (this, wxID_ANY);
+       grid->Add (_audio_stream, 1, wxEXPAND | wxALL, 6);
+       _audio_description = new wxStaticText (this, wxID_ANY, wxT (""));
+       grid->Add (_audio_description, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
+       
+       add_label_to_sizer (grid, this, "Subtitle stream");
+       _subtitle_stream = new wxChoice (this, wxID_ANY);
+       grid->Add (_subtitle_stream, 1, wxEXPAND | wxALL, 6);
+       grid->AddSpacer (0);
+
+       _audio_stream->Clear ();
+       vector<FFmpegAudioStream> a = content->audio_streams ();
+       for (vector<FFmpegAudioStream>::iterator i = a.begin(); i != a.end(); ++i) {
+               _audio_stream->Append (std_to_wx (i->name), new wxStringClientData (std_to_wx (lexical_cast<string> (i->id))));
+       }
+       
+       if (content->audio_stream()) {
+               checked_set (_audio_stream, lexical_cast<string> (content->audio_stream()->id));
+       }
+
+       _subtitle_stream->Clear ();
+       vector<FFmpegSubtitleStream> s = content->subtitle_streams ();
+       for (vector<FFmpegSubtitleStream>::iterator i = s.begin(); i != s.end(); ++i) {
+               _subtitle_stream->Append (std_to_wx (i->name), new wxStringClientData (std_to_wx (lexical_cast<string> (i->id))));
+       }
+       
+       if (content->subtitle_stream()) {
+               checked_set (_subtitle_stream, lexical_cast<string> (content->subtitle_stream()->id));
+       } else {
+               _subtitle_stream->SetSelection (wxNOT_FOUND);
+       }
+
+       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+       overall_sizer->Add (grid, 1, wxEXPAND | wxALL, 6);
+
+       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+       if (buttons) {
+               overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+       }
+
+       SetSizer (overall_sizer);
+       overall_sizer->Layout ();
+       overall_sizer->SetSizeHints (this);
+
+       _audio_stream->Connect    (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FFmpegContentDialog::audio_stream_changed), 0, this);
+       _subtitle_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FFmpegContentDialog::subtitle_stream_changed), 0, this);
+}
+
+void
+FFmpegContentDialog::audio_stream_changed (wxCommandEvent &)
+{
+       shared_ptr<FFmpegContent> c = _content.lock ();
+       if (!c) {
+               return;
+       }
+       
+       vector<FFmpegAudioStream> a = c->audio_streams ();
+       vector<FFmpegAudioStream>::iterator i = a.begin ();
+       string const s = string_client_data (_audio_stream->GetClientObject (_audio_stream->GetSelection ()));
+       while (i != a.end() && lexical_cast<string> (i->id) != s) {
+               ++i;
+       }
+
+       if (i != a.end ()) {
+               c->set_audio_stream (*i);
+       }
+
+       if (!c->audio_stream ()) {
+               _audio_description->SetLabel (wxT (""));
+       } else {
+               wxString s;
+               if (c->audio_channels() == 1) {
+                       s << _("1 channel");
+               } else {
+                       s << c->audio_channels() << wxT (" ") << _("channels");
+               }
+               s << wxT (", ") << c->audio_frame_rate() << _("Hz");
+               _audio_description->SetLabel (s);
+       }
+}
+
+
+
+void
+FFmpegContentDialog::subtitle_stream_changed (wxCommandEvent &)
+{
+       shared_ptr<FFmpegContent> c = _content.lock ();
+       if (!c) {
+               return;
+       }
+       
+       vector<FFmpegSubtitleStream> a = c->subtitle_streams ();
+       vector<FFmpegSubtitleStream>::iterator i = a.begin ();
+       string const s = string_client_data (_subtitle_stream->GetClientObject (_subtitle_stream->GetSelection ()));
+       while (i != a.end() && lexical_cast<string> (i->id) != s) {
+               ++i;
+       }
+
+       if (i != a.end ()) {
+               c->set_subtitle_stream (*i);
+       }
+}
diff --git a/src/wx/ffmpeg_content_dialog.h b/src/wx/ffmpeg_content_dialog.h
new file mode 100644 (file)
index 0000000..5251ad5
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+
+    This program 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.
+
+    This program 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 this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <wx/wx.h>
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+
+class wxSpinCtrl;
+class FFmpegContent;
+
+class FFmpegContentDialog : public wxDialog
+{
+public:
+       FFmpegContentDialog (wxWindow *, boost::shared_ptr<FFmpegContent>);
+
+private:
+       void audio_stream_changed (wxCommandEvent &);
+       void subtitle_stream_changed (wxCommandEvent &);
+
+       boost::weak_ptr<FFmpegContent> _content;
+       wxChoice* _audio_stream;
+       wxStaticText* _audio_description;
+       wxChoice* _subtitle_stream;
+};
index 4f08953b9537ffce7eef4d2185cbd779727aca91..85c4f71f866631f4018e635d0b8cb5d3dab3256d 100644 (file)
@@ -50,6 +50,7 @@
 #include "scaler.h"
 #include "audio_dialog.h"
 #include "imagemagick_content_dialog.h"
+#include "ffmpeg_content_dialog.h"
 #include "audio_mapping_view.h"
 
 using std::string;
@@ -234,8 +235,6 @@ FilmEditor::connect_to_widgets ()
        _subtitle_scale->Connect         (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::subtitle_scale_changed), 0, this);
        _colour_lut->Connect             (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::colour_lut_changed), 0, this);
        _j2k_bandwidth->Connect          (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::j2k_bandwidth_changed), 0, this);
-       _ffmpeg_subtitle_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::ffmpeg_subtitle_stream_changed), 0, this);
-       _ffmpeg_audio_stream->Connect    (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::ffmpeg_audio_stream_changed), 0, this);
        _audio_gain->Connect             (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::audio_gain_changed), 0, this);
        _audio_gain_calculate_button->Connect (
                wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::audio_gain_calculate_button_clicked), 0, this
@@ -420,16 +419,6 @@ FilmEditor::make_audio_panel ()
                grid->Add (s);
        }
 
-        {
-                add_label_to_sizer (grid, _audio_panel, _("Audio Stream"));
-                wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-                _ffmpeg_audio_stream = new wxChoice (_audio_panel, wxID_ANY);
-                s->Add (_ffmpeg_audio_stream, 1);
-                _audio = new wxStaticText (_audio_panel, wxID_ANY, wxT (""));
-                s->Add (_audio, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
-                grid->Add (s, 1, wxEXPAND);
-        }
-
        _audio_mapping = new AudioMappingView (_audio_panel);
        _audio_sizer->Add (_audio_mapping, 1, wxEXPAND | wxALL, 6);
        
@@ -448,10 +437,8 @@ FilmEditor::make_subtitle_panel ()
 
        _with_subtitles = new wxCheckBox (_subtitle_panel, wxID_ANY, _("With Subtitles"));
        grid->Add (_with_subtitles, 1);
+       grid->AddSpacer (0);
        
-       _ffmpeg_subtitle_stream = new wxChoice (_subtitle_panel, wxID_ANY);
-       grid->Add (_ffmpeg_subtitle_stream);
-
        {
                add_label_to_sizer (grid, _subtitle_panel, _("Subtitle Offset"));
                wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
@@ -628,7 +615,6 @@ FilmEditor::film_changed (Film::Property p)
                setup_formats ();
                setup_format ();
                setup_subtitle_control_sensitivity ();
-               setup_streams ();
                setup_show_audio_sensitivity ();
                setup_length ();
                break;
@@ -756,9 +742,7 @@ FilmEditor::film_content_changed (weak_ptr<Content> content, int property)
                
        if (property == FFmpegContentProperty::SUBTITLE_STREAMS) {
                setup_subtitle_control_sensitivity ();
-               setup_streams ();
        } else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
-               setup_streams ();
                setup_show_audio_sensitivity ();
        } else if (property == VideoContentProperty::VIDEO_LENGTH || property == AudioContentProperty::AUDIO_LENGTH) {
                setup_length ();
@@ -767,16 +751,8 @@ FilmEditor::film_content_changed (weak_ptr<Content> content, int property)
                        setup_content_information ();
                }
        } else if (property == FFmpegContentProperty::AUDIO_STREAM) {
-               if (_film->ffmpeg_audio_stream()) {
-                       checked_set (_ffmpeg_audio_stream, boost::lexical_cast<string> (_film->ffmpeg_audio_stream()->id));
-               }
                setup_dcp_name ();
-               setup_audio_details ();
                setup_show_audio_sensitivity ();
-       } else if (property == FFmpegContentProperty::SUBTITLE_STREAM) {
-               if (_film->ffmpeg_subtitle_stream()) {
-                       checked_set (_ffmpeg_subtitle_stream, boost::lexical_cast<string> (_film->ffmpeg_subtitle_stream()->id));
-               }
        }
 }
 
@@ -958,7 +934,6 @@ FilmEditor::set_things_sensitive (bool s)
        _bottom_crop->Enable (s);
        _filters_button->Enable (s);
        _scaler->Enable (s);
-       _ffmpeg_audio_stream->Enable (s);
        _dcp_content_type->Enable (s);
        _best_dcp_frame_rate->Enable (s);
        _dcp_frame_rate->Enable (s);
@@ -1115,7 +1090,7 @@ FilmEditor::setup_subtitle_control_sensitivity ()
 {
        bool h = false;
        if (_generally_sensitive && _film) {
-               h = !_film->ffmpeg_subtitle_streams().empty();
+               h = !_film->has_subtitles ();
        }
        
        _with_subtitles->Enable (h);
@@ -1125,7 +1100,6 @@ FilmEditor::setup_subtitle_control_sensitivity ()
                j = _film->with_subtitles ();
        }
        
-       _ffmpeg_subtitle_stream->Enable (j);
        _subtitle_offset->Enable (j);
        _subtitle_scale->Enable (j);
 }
@@ -1153,93 +1127,6 @@ FilmEditor::edit_dci_button_clicked (wxCommandEvent &)
        d->Destroy ();
 }
 
-void
-FilmEditor::setup_streams ()
-{
-       if (!_film) {
-               return;
-       }
-       
-       _ffmpeg_audio_stream->Clear ();
-       vector<FFmpegAudioStream> a = _film->ffmpeg_audio_streams ();
-       for (vector<FFmpegAudioStream>::iterator i = a.begin(); i != a.end(); ++i) {
-               _ffmpeg_audio_stream->Append (std_to_wx (i->name), new wxStringClientData (std_to_wx (boost::lexical_cast<string> (i->id))));
-       }
-       
-       if (_film->ffmpeg_audio_stream()) {
-               checked_set (_ffmpeg_audio_stream, boost::lexical_cast<string> (_film->ffmpeg_audio_stream()->id));
-       }
-
-       _ffmpeg_subtitle_stream->Clear ();
-       vector<FFmpegSubtitleStream> s = _film->ffmpeg_subtitle_streams ();
-       for (vector<FFmpegSubtitleStream>::iterator i = s.begin(); i != s.end(); ++i) {
-               _ffmpeg_subtitle_stream->Append (std_to_wx (i->name), new wxStringClientData (std_to_wx (boost::lexical_cast<string> (i->id))));
-       }
-       
-       if (_film->ffmpeg_subtitle_stream()) {
-               checked_set (_ffmpeg_subtitle_stream, boost::lexical_cast<string> (_film->ffmpeg_subtitle_stream()->id));
-       } else {
-               _ffmpeg_subtitle_stream->SetSelection (wxNOT_FOUND);
-       }
-}
-
-void
-FilmEditor::ffmpeg_audio_stream_changed (wxCommandEvent &)
-{
-       if (!_film) {
-               return;
-       }
-
-       vector<FFmpegAudioStream> a = _film->ffmpeg_audio_streams ();
-       vector<FFmpegAudioStream>::iterator i = a.begin ();
-       string const s = string_client_data (_ffmpeg_audio_stream->GetClientObject (_ffmpeg_audio_stream->GetSelection ()));
-       while (i != a.end() && lexical_cast<string> (i->id) != s) {
-               ++i;
-       }
-
-       if (i != a.end ()) {
-               _film->set_ffmpeg_audio_stream (*i);
-       }
-}
-
-void
-FilmEditor::ffmpeg_subtitle_stream_changed (wxCommandEvent &)
-{
-       if (!_film) {
-               return;
-       }
-
-       vector<FFmpegSubtitleStream> a = _film->ffmpeg_subtitle_streams ();
-       vector<FFmpegSubtitleStream>::iterator i = a.begin ();
-       string const s = string_client_data (_ffmpeg_subtitle_stream->GetClientObject (_ffmpeg_subtitle_stream->GetSelection ()));
-       while (i != a.end() && lexical_cast<string> (i->id) != s) {
-               ++i;
-       }
-
-       if (i != a.end ()) {
-               _film->set_ffmpeg_subtitle_stream (*i);
-       }
-}
-
-void
-FilmEditor::setup_audio_details ()
-{
-       if (!_film->ffmpeg_audio_stream()) {
-               _audio->SetLabel (wxT (""));
-       } else {
-               wxString s;
-               if (_film->audio_channels() == 1) {
-                       s << _("1 channel");
-               } else {
-                       s << _film->audio_channels() << wxT (" ") << _("channels");
-               }
-               s << wxT (", ") << _film->audio_frame_rate() << _("Hz");
-               _audio->SetLabel (s);
-       }
-
-       setup_notebook_size ();
-}
-
 void
 FilmEditor::active_jobs_changed (bool a)
 {
@@ -1377,8 +1264,13 @@ FilmEditor::edit_content (shared_ptr<Content> c)
                ImageMagickContentDialog* d = new ImageMagickContentDialog (this, im);
                d->ShowModal ();
                d->Destroy ();
+       }
 
-               im->set_video_length (d->video_length() * 24);
+       shared_ptr<FFmpegContent> ff = dynamic_pointer_cast<FFmpegContent> (c);
+       if (ff) {
+               FFmpegContentDialog* d = new FFmpegContentDialog (this, ff);
+               d->ShowModal ();
+               d->Destroy ();
        }
 }
 
@@ -1426,7 +1318,11 @@ FilmEditor::setup_content_button_sensitivity ()
 
        shared_ptr<Content> selection = selected_content ();
 
-        _content_edit->Enable (selection && _generally_sensitive && dynamic_pointer_cast<ImageMagickContent> (selection));
+        _content_edit->Enable (
+               selection && _generally_sensitive &&
+               (dynamic_pointer_cast<ImageMagickContent> (selection) || dynamic_pointer_cast<FFmpegContent> (selection))
+               );
+       
         _content_remove->Enable (selection && _generally_sensitive);
         _content_earlier->Enable (selection && _generally_sensitive);
         _content_later->Enable (selection && _generally_sensitive);
index 5944633a8cbbe13b7ba91db070a0b66fe0384a19..db657a7d3f5b4876fcb13199e45bad1afff5d473 100644 (file)
@@ -88,8 +88,6 @@ private:
        void subtitle_scale_changed (wxCommandEvent &);
        void colour_lut_changed (wxCommandEvent &);
        void j2k_bandwidth_changed (wxCommandEvent &);
-       void ffmpeg_audio_stream_changed (wxCommandEvent &);
-       void ffmpeg_subtitle_stream_changed (wxCommandEvent &);
        void dcp_frame_rate_changed (wxCommandEvent &);
        void best_dcp_frame_rate_clicked (wxCommandEvent &);
        void edit_filters_clicked (wxCommandEvent &);
@@ -103,8 +101,6 @@ private:
        void set_things_sensitive (bool);
        void setup_formats ();
        void setup_subtitle_control_sensitivity ();
-       void setup_streams ();
-       void setup_audio_details ();
        void setup_dcp_name ();
        void setup_show_audio_sensitivity ();
        void setup_scaling_description ();
@@ -164,10 +160,8 @@ private:
        wxButton* _audio_gain_calculate_button;
        wxButton* _show_audio;
        wxSpinCtrl* _audio_delay;
-       wxChoice* _ffmpeg_audio_stream;
        AudioMappingView* _audio_mapping;
        wxCheckBox* _with_subtitles;
-       wxChoice* _ffmpeg_subtitle_stream;
        wxSpinCtrl* _subtitle_offset;
        wxSpinCtrl* _subtitle_scale;
        wxChoice* _colour_lut;
index 726e4b8e2c5db315fc21eaa84ba7e6d6494b329f..24b92fdafee2d5e39339957630551f3d8167fed2 100644 (file)
@@ -26,6 +26,7 @@ using boost::shared_ptr;
 
 ImageMagickContentDialog::ImageMagickContentDialog (wxWindow* parent, shared_ptr<ImageMagickContent> content)
        : wxDialog (parent, wxID_ANY, _("Image"))
+       , _content (content)
 {
        wxFlexGridSizer* grid = new wxFlexGridSizer (3, 6, 6);
        grid->AddGrowableCol (1, 1);
@@ -53,10 +54,16 @@ ImageMagickContentDialog::ImageMagickContentDialog (wxWindow* parent, shared_ptr
        overall_sizer->SetSizeHints (this);
 
        checked_set (_video_length, content->video_length () / 24);
+       _video_length->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (ImageMagickContentDialog::video_length_changed), 0, this);
 }
 
-int
-ImageMagickContentDialog::video_length () const
+void
+ImageMagickContentDialog::video_length_changed (wxCommandEvent &)
 {
-       return _video_length->GetValue ();
+       shared_ptr<ImageMagickContent> c = _content.lock ();
+       if (!c) {
+               return;
+       }
+       
+       c->set_video_length (_video_length->GetValue() * 24);
 }
index 2fa955929ac189ac65ac91f970ea25c1580aed3e..b22ff6817b90582d106f5e1dba26c7d88794c294 100644 (file)
@@ -27,8 +27,9 @@ class ImageMagickContentDialog : public wxDialog
 public:
        ImageMagickContentDialog (wxWindow *, boost::shared_ptr<ImageMagickContent>);
 
-       int video_length () const;
-
 private:
+       void video_length_changed (wxCommandEvent &);
+
+       boost::weak_ptr<ImageMagickContent> _content;
        wxSpinCtrl* _video_length;
 };
index 09bf40393d3ed4bdf70ab99ae8497188970223f9..001e8469eeb24917f407e54281cdff96c0cf7839 100644 (file)
@@ -10,6 +10,7 @@ sources = """
           config_dialog.cc
           dci_metadata_dialog.cc
           dir_picker_ctrl.cc
+          ffmpeg_content_dialog.cc
           film_editor.cc
           film_viewer.cc
           filter_dialog.cc