From 3190fb98298ebdd29c41b2cf6019a381e71a6248 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 8 Mar 2014 19:09:46 +0000 Subject: [PATCH] Name audio analyses with stream ID so that you can see analyses for different streams correctly. Reported-by: Markus Raab --- ChangeLog | 2 ++ src/lib/audio_content.cc | 4 +++- src/lib/audio_content.h | 2 +- src/lib/ffmpeg_content.cc | 20 ++++++++++++++++++++ src/lib/ffmpeg_content.h | 1 + src/lib/film.cc | 6 ++---- src/lib/film.h | 2 +- 7 files changed, 30 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bfcdd4d9..674e08e0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-03-08 Carl Hetherington + * Fix incorrect audio analyses on multiple-stream content. + * Support for unsigned 8-bit audio (hmm!). 2014-03-06 Carl Hetherington diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index b4c4f34b6..b96300e15 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -141,7 +141,9 @@ AudioContent::audio_analysis_path () const return boost::filesystem::path (); } - return film->audio_analysis_path (dynamic_pointer_cast (shared_from_this ())); + boost::filesystem::path p = film->audio_analysis_dir (); + p /= digest (); + return p; } string diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index ca4a1f234..d30db02d7 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -57,9 +57,9 @@ public: virtual int output_audio_frame_rate () const = 0; virtual AudioMapping audio_mapping () const = 0; virtual void set_audio_mapping (AudioMapping) = 0; + virtual boost::filesystem::path audio_analysis_path () const; boost::signals2::connection analyse_audio (boost::function); - boost::filesystem::path audio_analysis_path () const; void set_audio_gain (float); void set_audio_delay (int); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 4ae5546c2..47fe4f807 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -477,3 +477,23 @@ FFmpegContent::identifier () const return s.str (); } +boost::filesystem::path +FFmpegContent::audio_analysis_path () const +{ + shared_ptr film = _film.lock (); + if (!film) { + return boost::filesystem::path (); + } + + /* We need to include the stream ID in this path so that we get different + analyses for each stream. + */ + + boost::filesystem::path p = film->audio_analysis_dir (); + string name = digest (); + if (audio_stream ()) { + name += "_" + audio_stream()->identifier (); + } + p /= name; + return p; +} diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 6dbff41d1..9600666b3 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -150,6 +150,7 @@ public: int output_audio_frame_rate () const; AudioMapping audio_mapping () const; void set_audio_mapping (AudioMapping); + boost::filesystem::path audio_analysis_path () const; void set_filters (std::vector const &); diff --git a/src/lib/film.cc b/src/lib/film.cc index 1b724b27e..da48bc9b2 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -232,11 +232,9 @@ Film::filename_safe_name () const } boost::filesystem::path -Film::audio_analysis_path (shared_ptr c) const +Film::audio_analysis_dir () const { - boost::filesystem::path p = dir ("analysis"); - p /= c->digest(); - return p; + return dir ("analysis"); } /** Add suitable Jobs to the JobManager to create a DCP for this Film */ diff --git a/src/lib/film.h b/src/lib/film.h index 7e65ecb16..e5840621a 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -63,7 +63,7 @@ public: boost::filesystem::path info_path (int, Eyes) const; boost::filesystem::path internal_video_mxf_dir () const; boost::filesystem::path internal_video_mxf_filename () const; - boost::filesystem::path audio_analysis_path (boost::shared_ptr) const; + boost::filesystem::path audio_analysis_dir () const; boost::filesystem::path video_mxf_filename () const; boost::filesystem::path audio_mxf_filename () const; -- 2.30.2