diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-11-15 17:02:16 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-11-20 07:34:23 +0100 |
| commit | 5b916bf26e3ad1cc49ef8e498bd5e4ff844ed7db (patch) | |
| tree | b58ed80986cbcc83b8bc633b5b02000dc74e3c46 /src/lib | |
| parent | 83a948956916abb7b2c13c25141323d326b38708 (diff) | |
Fix audio analysis attempts with source files that have more channels than the film.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/audio_analyser.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/audio_analyser.cc b/src/lib/audio_analyser.cc index 45097c5b6..df76932de 100644 --- a/src/lib/audio_analyser.cc +++ b/src/lib/audio_analyser.cc @@ -86,10 +86,18 @@ AudioAnalyser::AudioAnalyser (shared_ptr<const Film> film, shared_ptr<const Play } }; - _leqm_channels = film->audio_channels(); auto content = _playlist->content(); if (content.size() == 1 && content[0]->audio) { - _leqm_channels = content[0]->audio->mapping().mapped_output_channels().size(); + _leqm_channels = 0; + for (auto channel: content[0]->audio->mapping().mapped_output_channels()) { + /* This means that if, for example, a file only maps C we will + * calculate LEQ(m) for L, R and C. I'm not sure if this is + * right or not. + */ + _leqm_channels = std::min(film->audio_channels(), channel + 1); + } + } else { + _leqm_channels = film->audio_channels(); } /* XXX: is this right? Especially for more than 5.1? */ |
