Description: Fix compilation with FFMPEG-7.0
 API has changed a bit
Author: IOhannes m zmölnig
Origin: Debian
Bug: https://github.com/bplaum/gmerlin-avdecoder/issues/12
Last-Update: 2024-06-25
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- gmerlin-avdecoder.orig/lib/audio_ffmpeg.c
+++ gmerlin-avdecoder/lib/audio_ffmpeg.c
@@ -135,7 +135,7 @@
 
   /* These might be set from the codec or the container */
   
-  s->data.audio.format->num_channels = priv->ctx->channels;
+  s->data.audio.format->num_channels = priv->ctx->ch_layout.nb_channels;
   s->data.audio.format->samplerate   = priv->ctx->sample_rate;
 
   if(s->data.audio.format->samplerate == 2 * s->timescale)
@@ -281,7 +281,7 @@
 
 static int init_ffmpeg_audio(bgav_stream_t * s)
   {
-  AVCodec * codec;
+  const AVCodec * codec;
   ffmpeg_audio_priv * priv;
   priv = calloc(1, sizeof(*priv));
   priv->info = lookup_codec(s);
@@ -311,7 +311,9 @@
   bgav_dprintf("Adding extradata %d bytes\n", priv->ctx->extradata_size);
   gavl_hexdump(priv->ctx->extradata, priv->ctx->extradata_size, 16);
 #endif    
-  priv->ctx->channels        = s->data.audio.format->num_channels;
+  //JMZ:priv->ctx->channels        = s->data.audio.format->num_channels;
+  priv->ctx->ch_layout.order              = AV_CHANNEL_ORDER_UNSPEC;
+  priv->ctx->ch_layout.nb_channels        = s->data.audio.format->num_channels;
   priv->ctx->sample_rate     = s->data.audio.format->samplerate;
   priv->ctx->block_align     = s->data.audio.block_align;
   priv->ctx->bit_rate        = s->codec_bitrate;
--- gmerlin-avdecoder.orig/lib/demux_ffmpeg.c
+++ gmerlin-avdecoder/lib/demux_ffmpeg.c
@@ -753,7 +753,7 @@
     {
     gavl_track_set_duration(ctx->tt->cur->info, (priv->avfc->duration * GAVL_TIME_SCALE) / AV_TIME_BASE);
     
-    if(priv->avfc->iformat->read_seek)
+    if(priv->avfc->pb->seekable)
       ctx->flags |= BGAV_DEMUXER_CAN_SEEK;
     }
   
