Package: aubio Version: 0.4.9-4.4 Followup-For: Bug #1072399 User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu oracular ubuntu-patch Control: tags -1 patch ftbfs
Dear Maintainer, In Ubuntu, the attached patch was applied to achieve the following: * d/patches: backport upstream patches * debian/patches/ffmpeg5.1.patch: fix for FFMpeg 7 * d/p/fixpy312.patch: add a patch to fix Python 3.12 compatibility Thanks for considering the patch. -- System Information: Debian Release: trixie/sid APT prefers noble-updates APT policy: (500, 'noble-updates'), (500, 'noble-security'), (500, 'noble'), (100, 'noble-backports') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 6.8.0-45-generic (SMP w/10 CPU threads; PREEMPT) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
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 1969-12-31 17:00:00.000000000 -0700 +++ aubio-0.4.9/debian/patches/ffmpeg5.1-adjust.patch 2024-09-17 11:46:30.000000000 -0600 @@ -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 1969-12-31 17:00:00.000000000 -0700 +++ aubio-0.4.9/debian/patches/ffmpeg5.1.patch 2024-09-17 11:46:30.000000000 -0600 @@ -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 1969-12-31 17:00:00.000000000 -0700 +++ aubio-0.4.9/debian/patches/fixpy312.patch 2024-09-17 11:46:30.000000000 -0600 @@ -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-04-10 12:35:41.000000000 -0600 +++ aubio-0.4.9/debian/patches/series 2024-09-17 11:46:30.000000000 -0600 @@ -6,3 +6,6 @@ waflib-py311.patch ffmpeg5.patch waflib-py312.patch +ffmpeg5.1.patch +ffmpeg5.1-adjust.patch +fixpy312.patch