- AudioContentList ac = _parent->selected_audio ();
- shared_ptr<AudioContent> acs;
- shared_ptr<FFmpegContent> fcs;
- if (ac.size() == 1) {
- acs = ac.front ();
- fcs = dynamic_pointer_cast<FFmpegContent> (acs);
- }
-
- if (property == AudioContentProperty::AUDIO_MAPPING) {
- _mapping->set (acs ? acs->audio_mapping () : AudioMapping ());
- _sizer->Layout ();
- } else if (property == FFmpegContentProperty::AUDIO_STREAM) {
- _mapping->set (acs ? acs->audio_mapping () : AudioMapping ());
- _sizer->Layout ();
- } else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
- _stream->Clear ();
- if (fcs) {
- vector<shared_ptr<FFmpegAudioStream> > a = fcs->audio_streams ();
- for (vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin(); i != a.end(); ++i) {
- _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx ((*i)->identifier ())));
- }
-
- if (fcs->audio_stream()) {
- checked_set (_stream, fcs->audio_stream()->identifier ());
+ ContentList ac = _parent->selected_audio ();
+ if (property == AudioContentProperty::STREAMS) {
+ 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 ();