Set up audio stream description on load.
authorCarl Hetherington <cth@carlh.net>
Fri, 26 Jul 2013 14:55:03 +0000 (15:55 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 26 Jul 2013 14:55:03 +0000 (15:55 +0100)
src/wx/audio_panel.cc
src/wx/audio_panel.h

index 4fbb72708c22a44243010ae3a936574615f38ad9..f8dba6cd47fa88f1c1002913f192ae9741e247df 100644 (file)
@@ -127,6 +127,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 +139,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 +228,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 +244,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 {
index fb2d9296680d2b46604d09634941ecb97356b206..9c0d2a8775c0d28743849551fd73fafdf7daf3ce 100644 (file)
@@ -41,6 +41,7 @@ private:
        void delay_changed ();
        void stream_changed ();
        void mapping_changed (AudioMapping);
+       void setup_stream_description ();
 
        wxSpinCtrl* _gain;
        wxButton* _gain_calculate_button;