summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-01 17:23:39 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-01 17:23:39 +0100
commit97d25da42455d0ed93c2eebe023883767bb12d53 (patch)
tree3fe2d7b795e61fcc084e3f556e6f1be2e95b0c1c /src
parentbf1191b8c548903f7a7d0664a51d15611573d00b (diff)
Put codec name into the audio mapping view for each stream.
Diffstat (limited to 'src')
-rw-r--r--src/lib/content_factory.cc1
-rw-r--r--src/lib/ffmpeg_audio_stream.cc4
-rw-r--r--src/lib/ffmpeg_audio_stream.h7
-rw-r--r--src/lib/ffmpeg_examiner.cc3
-rw-r--r--src/wx/audio_panel.cc9
5 files changed, 23 insertions, 1 deletions
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<string> (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<ContentTime> first_audio;
+ boost::optional<std::string> 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<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,
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<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);