Source: aubio
Version: 0.4.9-4.4
Severity: normal
Tags: patch

Dear Maintainer,

I'm currently preparing an NMU for the RC-bugs #1072399 and #1074827,
and will upload it to DELAYED/10.

Attached you'll find the debdiff.
diff -Nru aubio-0.4.9/debian/changelog aubio-0.4.9/debian/changelog
--- aubio-0.4.9/debian/changelog        2024-02-07 00:46:01.000000000 +0100
+++ aubio-0.4.9/debian/changelog        2024-10-05 01:40:39.000000000 +0200
@@ -1,3 +1,14 @@
+aubio (0.4.9-4.5) unstable; urgency=medium
+
+  * Non-maintainer upload.
+
+  * Backport fix for FTBFS with FFMpeg-7 from upstream via Ubuntu
+    (Closes: #1072399)
+  * Backport fix for FTBFS with Python3.12 from Ubuntu.
+    Thanks to Zixing Liu <zixing....@canonical.com> (Closes: #1074827)
+
+ -- IOhannes m zmölnig (Debian/GNU) <umlae...@debian.org>  Sat, 05 Oct 2024 
01:40:39 +0200
+
 aubio (0.4.9-4.4) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru aubio-0.4.9/debian/patches/ffmpeg5.1-adjust.patch 
aubio-0.4.9/debian/patches/ffmpeg5.1-adjust.patch
--- aubio-0.4.9/debian/patches/ffmpeg5.1-adjust.patch   1970-01-01 
01:00:00.000000000 +0100
+++ aubio-0.4.9/debian/patches/ffmpeg5.1-adjust.patch   2024-10-05 
01:40:39.000000000 +0200
@@ -0,0 +1,58 @@
+Description: [source_avcodec] adjust detection of AVChannelLayout (>ffmpeg 5.0)
+Author: Paul Brossier <p...@piem.org>
+Origin: upstream, 
https://github.com/aubio/aubio/commit/0b947f9634937d27589d995ec90e90d763aca86f
+Last-Update: 2024-09-17
+---
+Index: aubio/src/io/source_avcodec.c
+===================================================================
+--- aubio.orig/src/io/source_avcodec.c
++++ aubio/src/io/source_avcodec.c
+@@ -56,6 +56,12 @@
+ #define av_packet_unref av_free_packet
+ #endif
+ 
++#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57,28,100)
++#warning "libavutil < 57.28.100 is deprecated"
++#else
++#define LIBAVUTIL_HAS_CH_LAYOUT
++#endif
++
+ #include "aubio_priv.h"
+ #include "fvec.h"
+ #include "fmat.h"
+@@ -263,7 +269,7 @@ aubio_source_avcodec_t * new_aubio_sourc
+ 
+   /* get input specs */
+   s->input_samplerate = avCodecCtx->sample_rate;
+-#ifdef AVUTIL_CHANNEL_LAYOUT_H
++#ifdef LIBAVUTIL_HAS_CH_LAYOUT
+   s->input_channels   = avCodecCtx->ch_layout.nb_channels;
+ #else
+   s->input_channels   = avCodecCtx->channels;
+@@ -325,7 +331,7 @@ void aubio_source_avcodec_reset_resample
+ #elif defined(HAVE_SWRESAMPLE)
+     SwrContext *avr = swr_alloc();
+ #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
+-#ifdef AVUTIL_CHANNEL_LAYOUT_H
++#ifdef LIBAVUTIL_HAS_CH_LAYOUT
+     AVChannelLayout input_layout;
+     AVChannelLayout output_layout;
+     av_channel_layout_default(&input_layout, s->input_channels);
+@@ -387,7 +393,7 @@ void aubio_source_avcodec_readframe(aubi
+   int out_samples = 0;
+ #elif defined(HAVE_SWRESAMPLE)
+   int in_samples = avFrame->nb_samples;
+-#ifdef AVUTIL_CHANNEL_LAYOUT_H
++#ifdef LIBAVUTIL_HAS_CH_LAYOUT
+   int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / 
avCodecCtx->ch_layout.nb_channels;
+ #else
+   int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;
+@@ -458,7 +464,7 @@ void aubio_source_avcodec_readframe(aubi
+   }
+ 
+ #if LIBAVUTIL_VERSION_MAJOR > 52
+-#ifdef AVUTIL_CHANNEL_LAYOUT_H
++#ifdef LIBAVUTIL_HAS_CH_LAYOUT
+   int frame_channels = avFrame->ch_layout.nb_channels;
+ #else
+   int frame_channels = avFrame->channels;
diff -Nru aubio-0.4.9/debian/patches/ffmpeg5.1.patch 
aubio-0.4.9/debian/patches/ffmpeg5.1.patch
--- aubio-0.4.9/debian/patches/ffmpeg5.1.patch  1970-01-01 01:00:00.000000000 
+0100
+++ aubio-0.4.9/debian/patches/ffmpeg5.1.patch  2024-10-05 01:40:39.000000000 
+0200
@@ -0,0 +1,90 @@
+Description: [source_avcodec] add support for AVChannelLayout (ffmpeg 5.1)
+Author: Paul Brossier <p...@piem.org>
+Origin: upstream, 
https://github.com/aubio/aubio/commit/0b947f9634937d27589d995ec90e90d763aca86f
+Last-Update: 2024-09-17
+---
+Index: aubio/src/io/source_avcodec.c
+===================================================================
+--- aubio.orig/src/io/source_avcodec.c
++++ aubio/src/io/source_avcodec.c
+@@ -263,7 +263,11 @@ aubio_source_avcodec_t * new_aubio_sourc
+ 
+   /* get input specs */
+   s->input_samplerate = avCodecCtx->sample_rate;
++#ifdef AVUTIL_CHANNEL_LAYOUT_H
++  s->input_channels   = avCodecCtx->ch_layout.nb_channels;
++#else
+   s->input_channels   = avCodecCtx->channels;
++#endif
+   //AUBIO_DBG("input_samplerate: %d\n", s->input_samplerate);
+   //AUBIO_DBG("input_channels: %d\n", s->input_channels);
+ 
+@@ -316,16 +320,26 @@ void aubio_source_avcodec_reset_resample
+   // create or reset resampler to/from mono/multi-channel
+   if ( s->avr == NULL ) {
+     int err;
+-    int64_t input_layout = av_get_default_channel_layout(s->input_channels);
+-    int64_t output_layout = av_get_default_channel_layout(s->input_channels);
+ #ifdef HAVE_AVRESAMPLE
+     AVAudioResampleContext *avr = avresample_alloc_context();
+ #elif defined(HAVE_SWRESAMPLE)
+     SwrContext *avr = swr_alloc();
+ #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
++#ifdef AVUTIL_CHANNEL_LAYOUT_H
++    AVChannelLayout input_layout;
++    AVChannelLayout output_layout;
++    av_channel_layout_default(&input_layout, s->input_channels);
++    av_channel_layout_default(&output_layout, s->input_channels);
++
++    av_opt_set_chlayout(avr, "in_chlayout",  &input_layout,        0);
++    av_opt_set_chlayout(avr, "out_chlayout", &output_layout,       0);
++#else
++    int64_t input_layout = av_get_default_channel_layout(s->input_channels);
++    int64_t output_layout = av_get_default_channel_layout(s->input_channels);
+ 
+     av_opt_set_int(avr, "in_channel_layout",  input_layout,              0);
+     av_opt_set_int(avr, "out_channel_layout", output_layout,             0);
++#endif /* AVUTIL_CHANNEL_LAYOUT_H */
+     av_opt_set_int(avr, "in_sample_rate",     s->input_samplerate,       0);
+     av_opt_set_int(avr, "out_sample_rate",    s->samplerate,             0);
+     av_opt_set_int(avr, "in_sample_fmt",      s->avCodecCtx->sample_fmt, 0);
+@@ -373,7 +387,11 @@ void aubio_source_avcodec_readframe(aubi
+   int out_samples = 0;
+ #elif defined(HAVE_SWRESAMPLE)
+   int in_samples = avFrame->nb_samples;
++#ifdef AVUTIL_CHANNEL_LAYOUT_H
++  int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / 
avCodecCtx->ch_layout.nb_channels;
++#else
+   int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;
++#endif
+   int out_samples = 0;
+ #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
+   smpl_t *output = s->output;
+@@ -440,10 +458,15 @@ void aubio_source_avcodec_readframe(aubi
+   }
+ 
+ #if LIBAVUTIL_VERSION_MAJOR > 52
+-  if (avFrame->channels != (sint_t)s->input_channels) {
++#ifdef AVUTIL_CHANNEL_LAYOUT_H
++  int frame_channels = avFrame->ch_layout.nb_channels;
++#else
++  int frame_channels = avFrame->channels;
++#endif
++  if (frame_channels != (sint_t)s->input_channels) {
+     AUBIO_WRN ("source_avcodec: trying to read from %d channel(s),"
+         "but configured for %d; is '%s' corrupt?\n",
+-        avFrame->channels, s->input_channels, s->path);
++        frame_channels, s->input_channels, s->path);
+     goto beach;
+   }
+ #else
+@@ -462,7 +485,8 @@ void aubio_source_avcodec_readframe(aubi
+         (uint8_t **)avFrame->data, in_linesize, in_samples);
+ #elif defined(HAVE_SWRESAMPLE)
+   in_samples = avFrame->nb_samples;
+-  max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;
++  max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE;
++  if (frame_channels > 0) max_out_samples /= frame_channels;
+   out_samples = swr_convert( avr,
+       (uint8_t **)&output, max_out_samples,
+       (const uint8_t **)avFrame->data, in_samples);
diff -Nru aubio-0.4.9/debian/patches/fixpy312.patch 
aubio-0.4.9/debian/patches/fixpy312.patch
--- aubio-0.4.9/debian/patches/fixpy312.patch   1970-01-01 01:00:00.000000000 
+0100
+++ aubio-0.4.9/debian/patches/fixpy312.patch   2024-10-05 01:40:39.000000000 
+0200
@@ -0,0 +1,49 @@
+Description: Fix Python 3.12 compatibility
+Author: Zixing Liu <zixing....@canonical.com>
+Forwarded: no
+Last-Update: 2024-09-17
+---
+--- aubio-0.4.9.orig/python/ext/ufuncs.c
++++ aubio-0.4.9/python/ext/ufuncs.c
+@@ -3,8 +3,8 @@
+ 
+ typedef smpl_t (*aubio_unary_func_t)(smpl_t input);
+ 
+-static void aubio_PyUFunc_d_d(char **args, npy_intp *dimensions,
+-                            npy_intp* steps, void* data)
++static void aubio_PyUFunc_d_d(char **args, const npy_intp *dimensions,
++                            const npy_intp* steps, void* data)
+ {
+     npy_intp i;
+     npy_intp n = dimensions[0];
+@@ -22,8 +22,8 @@ static void aubio_PyUFunc_d_d(char **arg
+     }
+ }
+ 
+-static void aubio_PyUFunc_f_f_As_d_d(char **args, npy_intp *dimensions,
+-                            npy_intp* steps, void* data)
++static void aubio_PyUFunc_f_f_As_d_d(char **args, const npy_intp *dimensions,
++                            const npy_intp* steps, void* data)
+ {
+     npy_intp i;
+     npy_intp n = dimensions[0];
+--- aubio-0.4.9.orig/python/lib/gen_code.py
++++ aubio-0.4.9/python/lib/gen_code.py
+@@ -106,7 +106,7 @@ def get_name(proto):
+ 
+ def get_return_type(proto):
+     import re
+-    paramregex = re.compile('(\w+ ?\*?).*')
++    paramregex = re.compile(r'(\w+ ?\*?).*')
+     outputs = paramregex.findall(proto)
+     assert len(outputs) == 1
+     return outputs[0].replace(' ', '')
+@@ -137,7 +137,7 @@ def get_params(proto):
+     returns: ['int argc', 'char ** argv']
+     """
+     import re
+-    paramregex = re.compile('.*\((.*)\);')
++    paramregex = re.compile(r'.*\((.*)\);')
+     a = paramregex.findall(proto)[0].split(', ')
+     #a = [i.replace('const ', '') for i in a]
+     return a
diff -Nru aubio-0.4.9/debian/patches/series aubio-0.4.9/debian/patches/series
--- aubio-0.4.9/debian/patches/series   2024-02-07 00:46:01.000000000 +0100
+++ aubio-0.4.9/debian/patches/series   2024-10-05 01:40:39.000000000 +0200
@@ -6,3 +6,6 @@
 waflib-py311.patch
 ffmpeg5.patch
 waflib-py312.patch
+ffmpeg5.1.patch
+ffmpeg5.1-adjust.patch
+fixpy312.patch

Reply via email to