From: Debian Multimedia Maintainers <debian-multimedia@lists.debian.org>
Date: Tue, 13 Aug 2024 09:45:27 +0200
Subject: Fix FTBFS with FFMPEG7

Origin: Debian
Forwarded: no
Last-Update: 2024-06-25

Last-Update: 2024-06-25
---
 plugins/ffmpeg/codec.c         | 8 ++++++--
 plugins/ffmpeg/ffmpeg_common.c | 4 ++--
 plugins/ffmpeg/ffmpeg_common.h | 2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/plugins/ffmpeg/codec.c b/plugins/ffmpeg/codec.c
index 5686154..c136d64 100644
--- a/plugins/ffmpeg/codec.c
+++ b/plugins/ffmpeg/codec.c
@@ -337,7 +337,7 @@ void bg_ffmpeg_set_audio_format_avctx(AVCodecContext * avctx,
   avctx->sample_rate = fmt->samplerate;
   
   /* Channel setup */
-  avctx->channels    = fmt->num_channels;
+  avctx->ch_layout.nb_channels    = fmt->num_channels;
   }
 
 void bg_ffmpeg_set_audio_format_params(AVCodecParameters * avctx,
@@ -347,7 +347,7 @@ void bg_ffmpeg_set_audio_format_params(AVCodecParameters * avctx,
   avctx->sample_rate = fmt->samplerate;
   
   /* Channel setup */
-  avctx->channels    = fmt->num_channels;
+  avctx->ch_layout.nb_channels    = fmt->num_channels;
   }
 
 gavl_audio_sink_t * bg_ffmpeg_codec_open_audio(bg_ffmpeg_codec_context_t * ctx,
@@ -367,8 +367,12 @@ gavl_audio_sink_t * bg_ffmpeg_codec_open_audio(bg_ffmpeg_codec_context_t * ctx,
   bg_ffmpeg_set_audio_format_avctx(ctx->avctx, fmt);
 
   
+#if 1
+# warning TODO fix channel layout
+#else
   ctx->avctx->channel_layout =
     bg_ffmpeg_get_channel_layout(fmt);
+#endif
 
   
   /* Sample format */
diff --git a/plugins/ffmpeg/ffmpeg_common.c b/plugins/ffmpeg/ffmpeg_common.c
index e9365a6..40a157e 100644
--- a/plugins/ffmpeg/ffmpeg_common.c
+++ b/plugins/ffmpeg/ffmpeg_common.c
@@ -259,7 +259,7 @@ static int ffmpeg_open(void * data, const char * filename,
   {
   const gavl_dictionary_t * cl;
   ffmpeg_priv_t * priv;
-  AVOutputFormat *fmt;
+  const AVOutputFormat *fmt;
   
   priv = data;
   if(!priv->format)
@@ -769,7 +769,7 @@ static int open_video_encoder(ffmpeg_priv_t * priv,
 
 #define IO_BUFFER_SIZE 2048 // Too large values increase the latency
 
-static int io_write(void * opaque, uint8_t * buf, int size)
+static int io_write(void * opaque, const uint8_t * buf, int size)
   {
   return gavf_io_write_data(opaque, buf, size);
   }
diff --git a/plugins/ffmpeg/ffmpeg_common.h b/plugins/ffmpeg/ffmpeg_common.h
index 718006c..ebd5788 100644
--- a/plugins/ffmpeg/ffmpeg_common.h
+++ b/plugins/ffmpeg/ffmpeg_common.h
@@ -118,7 +118,7 @@ typedef struct bg_ffmpeg_codec_context_s bg_ffmpeg_codec_context_t;
 
 struct bg_ffmpeg_codec_context_s
   {
-  AVCodec * codec;
+  const AVCodec * codec;
   
   AVCodecContext * avctx_priv;
   AVCodecContext * avctx;
