Allow no-stretch scaling of video content.
[dcpomatic.git] / src / wx / audio_panel.cc
index 4fbb72708c22a44243010ae3a936574615f38ad9..b4921904c2051fe5accd41b1bda9e6c13a6423b1 100644 (file)
@@ -21,6 +21,7 @@
 #include <wx/spinctrl.h>
 #include "lib/config.h"
 #include "lib/sound_processor.h"
+#include "lib/ffmpeg_content.h"
 #include "audio_dialog.h"
 #include "audio_panel.h"
 #include "audio_mapping_view.h"
@@ -127,6 +128,8 @@ AudioPanel::film_content_changed (shared_ptr<Content> c, int property)
        } else if (property == AudioContentProperty::AUDIO_MAPPING) {
                _mapping->set (ac ? ac->audio_mapping () : AudioMapping ());
                _sizer->Layout ();
+       } else if (property == FFmpegContentProperty::AUDIO_STREAM) {
+               setup_stream_description ();
        } else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
                _stream->Clear ();
                if (fc) {
@@ -137,6 +140,7 @@ AudioPanel::film_content_changed (shared_ptr<Content> c, int property)
                        
                        if (fc->audio_stream()) {
                                checked_set (_stream, lexical_cast<string> (fc->audio_stream()->id));
+                               setup_stream_description ();
                        }
                }
        }
@@ -225,6 +229,10 @@ AudioPanel::stream_changed ()
        if (!fc) {
                return;
        }
+
+       if (_stream->GetSelection() == -1) {
+               return;
+       }
        
        vector<shared_ptr<FFmpegAudioStream> > a = fc->audio_streams ();
        vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin ();
@@ -237,6 +245,22 @@ AudioPanel::stream_changed ()
                fc->set_audio_stream (*i);
        }
 
+       setup_stream_description ();
+}
+
+void
+AudioPanel::setup_stream_description ()
+{
+       shared_ptr<Content> c = _editor->selected_content ();
+       if (!c) {
+               return;
+       }
+       
+       shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c);
+       if (!fc) {
+               return;
+       }
+
        if (!fc->audio_stream ()) {
                _description->SetLabel (wxT (""));
        } else {