1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
While this was to fix an occasional ffmpeg-5 issue, it fixes
a bigger issue with ffmpeg-7.
https://bugs.gentoo.org/953008
https://github.com/acoustid/chromaprint/issues/142
https://github.com/acoustid/chromaprint/commit/82781d02cd30
From: Marshal Walker <CatmanIX@gmail.com>
Date: Thu, 8 Dec 2022 11:53:58 -0500
Subject: [PATCH] ffmpeg5 fix for issue #122
tested on Arch Linux, needs testing on win/mac/etc (should be fine tho)
--- a/src/audio/ffmpeg_audio_processor_swresample.h
+++ b/src/audio/ffmpeg_audio_processor_swresample.h
@@ -29,7 +29,7 @@ class FFmpegAudioProcessor {
}
void SetInputChannelLayout(AVChannelLayout *channel_layout) {
- av_opt_set_int(m_swr_ctx, "in_channel_layout", channel_layout->u.mask, 0);
+ av_opt_set_chlayout(m_swr_ctx, "in_chlayout", channel_layout, 0);
}
void SetInputSampleFormat(AVSampleFormat sample_format) {
@@ -41,7 +41,7 @@ class FFmpegAudioProcessor {
}
void SetOutputChannelLayout(AVChannelLayout *channel_layout) {
- av_opt_set_int(m_swr_ctx, "out_channel_layout", channel_layout->u.mask, 0);
+ av_opt_set_chlayout(m_swr_ctx, "out_chlayout", channel_layout, 0);
}
void SetOutputSampleFormat(AVSampleFormat sample_format) {
--- a/src/audio/ffmpeg_audio_reader.h
+++ b/src/audio/ffmpeg_audio_reader.h
@@ -301,9 +301,10 @@ inline bool FFmpegAudioReader::Read(const int16_t **data, size_t *size) {
} else {
m_has_more_frames = false;
}
+ } else {
+ SetError("Error decoding the audio source", ret);
+ return false;
}
- SetError("Error decoding the audio source", ret);
- return false;
}
if (m_frame->nb_samples > 0) {
|