summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-13 01:20:27 +0200
committerCarl Hetherington <cth@carlh.net>2024-05-13 23:03:04 +0200
commite2ea739fcaa8077975a8559f267a1b1377b7e100 (patch)
tree19a6fa66ea10194d3e1fd64442c5f035810f0dea /src/lib/ffmpeg_decoder.cc
parent63fd3d143387bc0dbbbe228955421a59239dbe5c (diff)
Don't bother decoding audio if none of it is mapped (#2809).
On a test adding subs from an MKV to an existing DCP this reduces the processing time from ~2h to ~1m because it doesn't resample the audio from the whole of the MKV, only to discard it.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
-rw-r--r--src/lib/ffmpeg_decoder.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 6130d8e5f..e0d9918b2 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -89,7 +89,7 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> film, shared_ptr<const FFmp
_pts_offset = {};
}
- if (c->audio) {
+ if (c->audio && !c->audio->mapping().mapped_output_channels().empty()) {
audio = make_shared<AudioDecoder>(this, c->audio, fast);
}
@@ -240,7 +240,7 @@ FFmpegDecoder::pass ()
decode_and_process_video_packet (packet);
} else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !only_text()->ignore()) {
decode_and_process_subtitle_packet (packet);
- } else {
+ } else if (audio) {
decode_and_process_audio_packet (packet);
}