Revert "Use make_shared<>."
[dcpomatic.git] / src / wx / audio_panel.cc
index df8c7871ecdbdd0a890406611eb6ebd091de8eba..ab26329a4b878a564ecf9cd96e9eed8890f674db 100644 (file)
@@ -25,6 +25,7 @@
 #include "content_panel.h"
 #include "audio_dialog.h"
 #include "lib/config.h"
+#include "lib/ffmpeg_audio_stream.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/cinema_sound_processor.h"
 #include "lib/job_manager.h"
@@ -154,6 +155,23 @@ AudioPanel::film_content_changed (int property)
                if (ac.size() == 1) {
                        _mapping->set (ac.front()->audio->mapping());
                        _mapping->set_input_channels (ac.front()->audio->channel_names ());
+
+                       vector<AudioMappingView::Group> groups;
+                       int c = 0;
+                       BOOST_FOREACH (shared_ptr<const AudioStream> i, ac.front()->audio->streams()) {
+                               shared_ptr<const FFmpegAudioStream> f = dynamic_pointer_cast<const FFmpegAudioStream> (i);
+                               string name = "";
+                               if (f) {
+                                       name = f->name;
+                                       if (f->codec_name) {
+                                               name += " (" + f->codec_name.get() + ")";
+                                       }
+                               }
+                               groups.push_back (AudioMappingView::Group (c, c + i->channels() - 1, name));
+                               c += i->channels ();
+                       }
+                       _mapping->set_input_groups (groups);
+
                } else {
                        _mapping->set (AudioMapping ());
                }
@@ -344,3 +362,13 @@ AudioPanel::reference_clicked ()
 
        d->set_reference_audio (_reference->GetValue ());
 }
+
+void
+AudioPanel::set_film (shared_ptr<Film>)
+{
+       /* We are changing film, so destroy any audio dialog for the old one */
+       if (_audio_dialog) {
+               _audio_dialog->Destroy ();
+               _audio_dialog = 0;
+       }
+}