1 From 82781d02cd3063d071a501218297a90bde9a314f Mon Sep 17 00:00:00 2001
2 From: Marshal Walker <CatmanIX@gmail.com>
3 Date: Thu, 8 Dec 2022 11:53:58 -0500
4 Subject: [PATCH] ffmpeg5 fix for issue #122
6 tested on Arch Linux, needs testing on win/mac/etc (should be fine tho)
8 src/audio/ffmpeg_audio_processor_swresample.h | 4 ++--
9 src/audio/ffmpeg_audio_reader.h | 5 +++--
10 2 files changed, 5 insertions(+), 4 deletions(-)
12 diff --git a/src/audio/ffmpeg_audio_processor_swresample.h b/src/audio/ffmpeg_audio_processor_swresample.h
13 index b1d4bea..e8fcb3f 100644
14 --- a/src/audio/ffmpeg_audio_processor_swresample.h
15 +++ b/src/audio/ffmpeg_audio_processor_swresample.h
16 @@ -29,7 +29,7 @@ class FFmpegAudioProcessor {
19 void SetInputChannelLayout(AVChannelLayout *channel_layout) {
20 - av_opt_set_int(m_swr_ctx, "in_channel_layout", channel_layout->u.mask, 0);
21 + av_opt_set_chlayout(m_swr_ctx, "in_chlayout", channel_layout, 0);
24 void SetInputSampleFormat(AVSampleFormat sample_format) {
25 @@ -41,7 +41,7 @@ class FFmpegAudioProcessor {
28 void SetOutputChannelLayout(AVChannelLayout *channel_layout) {
29 - av_opt_set_int(m_swr_ctx, "out_channel_layout", channel_layout->u.mask, 0);
30 + av_opt_set_chlayout(m_swr_ctx, "out_chlayout", channel_layout, 0);
33 void SetOutputSampleFormat(AVSampleFormat sample_format) {
34 diff --git a/src/audio/ffmpeg_audio_reader.h b/src/audio/ffmpeg_audio_reader.h
35 index 1c6b346..35b2934 100644
36 --- a/src/audio/ffmpeg_audio_reader.h
37 +++ b/src/audio/ffmpeg_audio_reader.h
38 @@ -301,9 +301,10 @@ inline bool FFmpegAudioReader::Read(const int16_t **data, size_t *size) {
40 m_has_more_frames = false;
43 + SetError("Error decoding the audio source", ret);
46 - SetError("Error decoding the audio source", ret);
50 if (m_frame->nb_samples > 0) {