From: Carl Hetherington Date: Wed, 1 Jun 2016 16:23:39 +0000 (+0100) Subject: Put codec name into the audio mapping view for each stream. X-Git-Tag: v2.8.7~9 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=97d25da42455d0ed93c2eebe023883767bb12d53 Put codec name into the audio mapping view for each stream. --- diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index 264cac325..7b02ee111 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -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); diff --git a/src/lib/ffmpeg_audio_stream.cc b/src/lib/ffmpeg_audio_stream.cc index e0c8cae4c..a81f69e65 100644 --- a/src/lib/ffmpeg_audio_stream.cc +++ b/src/lib/ffmpeg_audio_stream.cc @@ -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 (first_audio.get().get ())); } + if (codec_name) { + root->add_child("CodecName")->add_child_text (codec_name.get()); + } } diff --git a/src/lib/ffmpeg_audio_stream.h b/src/lib/ffmpeg_audio_stream.h index 31ec9d125..a754ec574 100644 --- a/src/lib/ffmpeg_audio_stream.h +++ b/src/lib/ffmpeg_audio_stream.h @@ -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 first_audio; + boost::optional codec_name; private: friend struct ffmpeg_pts_offset_test; diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 06154cc8c..18a87f40e 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -63,11 +63,14 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr c, shared_ptrduration != AV_NOPTS_VALUE); + DCPOMATIC_ASSERT (s->codec->codec); + DCPOMATIC_ASSERT (s->codec->codec->name); _audio_streams.push_back ( shared_ptr ( 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, diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index fa086b8e3..a2ede0bd6 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -160,7 +160,14 @@ AudioPanel::film_content_changed (int property) int c = 0; BOOST_FOREACH (shared_ptr i, ac.front()->audio->streams()) { shared_ptr f = dynamic_pointer_cast (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);