Put codec name into the audio mapping view for each stream.
authorCarl Hetherington <cth@carlh.net>
Wed, 1 Jun 2016 16:23:39 +0000 (17:23 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 1 Jun 2016 16:23:39 +0000 (17:23 +0100)
src/lib/content_factory.cc
src/lib/ffmpeg_audio_stream.cc
src/lib/ffmpeg_audio_stream.h
src/lib/ffmpeg_examiner.cc
src/wx/audio_panel.cc

index 264cac325e60ceceb81747816d767dc88faeedfc..7b02ee111aff45502f16d1f66f7875d26f6ede10 100644 (file)
@@ -43,6 +43,7 @@
 using std::string;
 using std::list;
 using boost::shared_ptr;
+using boost::optional;
 
 #define LOG_GENERAL(...) film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
 
index e0c8cae4c6496db66be03cfcb82fa0bc15c43d63..a81f69e65678d67ac4360b0ad435b171f6f865cb 100644 (file)
@@ -38,6 +38,7 @@ FFmpegAudioStream::FFmpegAudioStream (cxml::ConstNodePtr node, int version)
        if (f) {
                first_audio = ContentTime (f.get ());
        }
+       codec_name = node->optional_string_child("CodecName");
 }
 
 void
@@ -50,4 +51,7 @@ FFmpegAudioStream::as_xml (xmlpp::Node* root) const
        if (first_audio) {
                root->add_child("FirstAudio")->add_child_text (raw_convert<string> (first_audio.get().get ()));
        }
+       if (codec_name) {
+               root->add_child("CodecName")->add_child_text (codec_name.get());
+       }
 }
index 31ec9d125e550daa4688a913cd0081aa0c7f9440..a754ec5748440d00d7fc38b57bbe49683d946077 100644 (file)
@@ -32,6 +32,12 @@ public:
                , AudioStream (frame_rate, length, channels)
        {}
 
+       FFmpegAudioStream (std::string name, std::string codec_name_, int id, int frame_rate, Frame length, int channels)
+               : FFmpegStream (name, id)
+               , AudioStream (frame_rate, length, channels)
+               , codec_name (codec_name_)
+       {}
+
        FFmpegAudioStream (std::string name, int id, int frame_rate, Frame length, AudioMapping mapping)
                : FFmpegStream (name, id)
                , AudioStream (frame_rate, length, mapping)
@@ -44,6 +50,7 @@ public:
        /* XXX: should probably be locked */
 
        boost::optional<ContentTime> first_audio;
+       boost::optional<std::string> codec_name;
 
 private:
        friend struct ffmpeg_pts_offset_test;
index 06154cc8c66dfeaada4e6fe5a555e5c5b10becfc..18a87f40e591ab0e27d66b88d2677ea75043bae4 100644 (file)
@@ -63,11 +63,14 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
                        }
 
                        DCPOMATIC_ASSERT (_format_context->duration != AV_NOPTS_VALUE);
+                       DCPOMATIC_ASSERT (s->codec->codec);
+                       DCPOMATIC_ASSERT (s->codec->codec->name);
 
                        _audio_streams.push_back (
                                shared_ptr<FFmpegAudioStream> (
                                        new FFmpegAudioStream (
                                                stream_name (s),
+                                               s->codec->codec->name,
                                                s->id,
                                                s->codec->sample_rate,
                                                (double (_format_context->duration) / AV_TIME_BASE) * s->codec->sample_rate,
index fa086b8e35ce7f026901035b00852e695b6a5b00..a2ede0bd64ba63e15e4e4e82b12513d995380c61 100644 (file)
@@ -160,7 +160,14 @@ AudioPanel::film_content_changed (int property)
                        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);
-                               groups.push_back (AudioMappingView::Group (c, c + i->channels() - 1, f ? f->name : ""));
+                               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);