Merge ~liushuyu-011/ubuntu/+source/aubio:ubuntu/devel into ubuntu/+source/aubio:ubuntu/devel

Proposed by Zixing Liu
Status: Merged
Merged at revision: 0de4dd3c2deca5f72f1d12acbaae043ed9ef4ec6
Proposed branch: ~liushuyu-011/ubuntu/+source/aubio:ubuntu/devel
Merge into: ubuntu/+source/aubio:ubuntu/devel
Diff against target: 256 lines (+210/-1)
6 files modified
debian/changelog (+8/-0)
debian/control (+2/-1)
debian/patches/ffmpeg5.1-adjust.patch (+58/-0)
debian/patches/ffmpeg5.1.patch (+90/-0)
debian/patches/fixpy312.patch (+49/-0)
debian/patches/series (+3/-0)
Reviewer Review Type Date Requested Status
Graham Inggs (community) Approve
Review via email: mp+473379@code.launchpad.net

Description of the change

This merge proposal fixes the FTBFS with FFmpeg 7 and Python 3.12.

To post a comment you must log in.
Revision history for this message
Graham Inggs (ginggs) wrote :

Looks good to me, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 68e2b6c..e2f2b1e 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+aubio (0.4.9-4.4ubuntu1) oracular; urgency=medium
7+
8+ * d/patches: backport upstream patches
9+ * debian/patches/ffmpeg5.1.patch: fix for FFMpeg 7
10+ * d/p/fixpy312.patch: add a patch to fix Python 3.12 compatibility
11+
12+ -- Zixing Liu <zixing.liu@canonical.com> Tue, 17 Sep 2024 11:46:30 -0600
13+
14 aubio (0.4.9-4.4build1) noble; urgency=medium
15
16 * No-change rebuild with Python 3.12 only
17diff --git a/debian/control b/debian/control
18index e860a93..857cd83 100644
19--- a/debian/control
20+++ b/debian/control
21@@ -1,7 +1,8 @@
22 Source: aubio
23 Section: sound
24 Priority: optional
25-Maintainer: Paul Brossier <piem@debian.org>
26+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
27+XSBC-Original-Maintainer: Paul Brossier <piem@debian.org>
28 Build-Depends: debhelper-compat (= 12),
29 libtool,
30 libjack-dev | libjack-jackd2-dev,
31diff --git a/debian/patches/ffmpeg5.1-adjust.patch b/debian/patches/ffmpeg5.1-adjust.patch
32new file mode 100644
33index 0000000..abd54cd
34--- /dev/null
35+++ b/debian/patches/ffmpeg5.1-adjust.patch
36@@ -0,0 +1,58 @@
37+Description: [source_avcodec] adjust detection of AVChannelLayout (>ffmpeg 5.0)
38+Author: Paul Brossier <piem@piem.org>
39+Origin: upstream, https://github.com/aubio/aubio/commit/0b947f9634937d27589d995ec90e90d763aca86f
40+Last-Update: 2024-09-17
41+---
42+Index: aubio/src/io/source_avcodec.c
43+===================================================================
44+--- aubio.orig/src/io/source_avcodec.c
45++++ aubio/src/io/source_avcodec.c
46+@@ -56,6 +56,12 @@
47+ #define av_packet_unref av_free_packet
48+ #endif
49+
50++#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57,28,100)
51++#warning "libavutil < 57.28.100 is deprecated"
52++#else
53++#define LIBAVUTIL_HAS_CH_LAYOUT
54++#endif
55++
56+ #include "aubio_priv.h"
57+ #include "fvec.h"
58+ #include "fmat.h"
59+@@ -263,7 +269,7 @@ aubio_source_avcodec_t * new_aubio_sourc
60+
61+ /* get input specs */
62+ s->input_samplerate = avCodecCtx->sample_rate;
63+-#ifdef AVUTIL_CHANNEL_LAYOUT_H
64++#ifdef LIBAVUTIL_HAS_CH_LAYOUT
65+ s->input_channels = avCodecCtx->ch_layout.nb_channels;
66+ #else
67+ s->input_channels = avCodecCtx->channels;
68+@@ -325,7 +331,7 @@ void aubio_source_avcodec_reset_resample
69+ #elif defined(HAVE_SWRESAMPLE)
70+ SwrContext *avr = swr_alloc();
71+ #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
72+-#ifdef AVUTIL_CHANNEL_LAYOUT_H
73++#ifdef LIBAVUTIL_HAS_CH_LAYOUT
74+ AVChannelLayout input_layout;
75+ AVChannelLayout output_layout;
76+ av_channel_layout_default(&input_layout, s->input_channels);
77+@@ -387,7 +393,7 @@ void aubio_source_avcodec_readframe(aubi
78+ int out_samples = 0;
79+ #elif defined(HAVE_SWRESAMPLE)
80+ int in_samples = avFrame->nb_samples;
81+-#ifdef AVUTIL_CHANNEL_LAYOUT_H
82++#ifdef LIBAVUTIL_HAS_CH_LAYOUT
83+ int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->ch_layout.nb_channels;
84+ #else
85+ int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;
86+@@ -458,7 +464,7 @@ void aubio_source_avcodec_readframe(aubi
87+ }
88+
89+ #if LIBAVUTIL_VERSION_MAJOR > 52
90+-#ifdef AVUTIL_CHANNEL_LAYOUT_H
91++#ifdef LIBAVUTIL_HAS_CH_LAYOUT
92+ int frame_channels = avFrame->ch_layout.nb_channels;
93+ #else
94+ int frame_channels = avFrame->channels;
95diff --git a/debian/patches/ffmpeg5.1.patch b/debian/patches/ffmpeg5.1.patch
96new file mode 100644
97index 0000000..57faae9
98--- /dev/null
99+++ b/debian/patches/ffmpeg5.1.patch
100@@ -0,0 +1,90 @@
101+Description: [source_avcodec] add support for AVChannelLayout (ffmpeg 5.1)
102+Author: Paul Brossier <piem@piem.org>
103+Origin: upstream, https://github.com/aubio/aubio/commit/0b947f9634937d27589d995ec90e90d763aca86f
104+Last-Update: 2024-09-17
105+---
106+Index: aubio/src/io/source_avcodec.c
107+===================================================================
108+--- aubio.orig/src/io/source_avcodec.c
109++++ aubio/src/io/source_avcodec.c
110+@@ -263,7 +263,11 @@ aubio_source_avcodec_t * new_aubio_sourc
111+
112+ /* get input specs */
113+ s->input_samplerate = avCodecCtx->sample_rate;
114++#ifdef AVUTIL_CHANNEL_LAYOUT_H
115++ s->input_channels = avCodecCtx->ch_layout.nb_channels;
116++#else
117+ s->input_channels = avCodecCtx->channels;
118++#endif
119+ //AUBIO_DBG("input_samplerate: %d\n", s->input_samplerate);
120+ //AUBIO_DBG("input_channels: %d\n", s->input_channels);
121+
122+@@ -316,16 +320,26 @@ void aubio_source_avcodec_reset_resample
123+ // create or reset resampler to/from mono/multi-channel
124+ if ( s->avr == NULL ) {
125+ int err;
126+- int64_t input_layout = av_get_default_channel_layout(s->input_channels);
127+- int64_t output_layout = av_get_default_channel_layout(s->input_channels);
128+ #ifdef HAVE_AVRESAMPLE
129+ AVAudioResampleContext *avr = avresample_alloc_context();
130+ #elif defined(HAVE_SWRESAMPLE)
131+ SwrContext *avr = swr_alloc();
132+ #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
133++#ifdef AVUTIL_CHANNEL_LAYOUT_H
134++ AVChannelLayout input_layout;
135++ AVChannelLayout output_layout;
136++ av_channel_layout_default(&input_layout, s->input_channels);
137++ av_channel_layout_default(&output_layout, s->input_channels);
138++
139++ av_opt_set_chlayout(avr, "in_chlayout", &input_layout, 0);
140++ av_opt_set_chlayout(avr, "out_chlayout", &output_layout, 0);
141++#else
142++ int64_t input_layout = av_get_default_channel_layout(s->input_channels);
143++ int64_t output_layout = av_get_default_channel_layout(s->input_channels);
144+
145+ av_opt_set_int(avr, "in_channel_layout", input_layout, 0);
146+ av_opt_set_int(avr, "out_channel_layout", output_layout, 0);
147++#endif /* AVUTIL_CHANNEL_LAYOUT_H */
148+ av_opt_set_int(avr, "in_sample_rate", s->input_samplerate, 0);
149+ av_opt_set_int(avr, "out_sample_rate", s->samplerate, 0);
150+ av_opt_set_int(avr, "in_sample_fmt", s->avCodecCtx->sample_fmt, 0);
151+@@ -373,7 +387,11 @@ void aubio_source_avcodec_readframe(aubi
152+ int out_samples = 0;
153+ #elif defined(HAVE_SWRESAMPLE)
154+ int in_samples = avFrame->nb_samples;
155++#ifdef AVUTIL_CHANNEL_LAYOUT_H
156++ int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->ch_layout.nb_channels;
157++#else
158+ int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;
159++#endif
160+ int out_samples = 0;
161+ #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
162+ smpl_t *output = s->output;
163+@@ -440,10 +458,15 @@ void aubio_source_avcodec_readframe(aubi
164+ }
165+
166+ #if LIBAVUTIL_VERSION_MAJOR > 52
167+- if (avFrame->channels != (sint_t)s->input_channels) {
168++#ifdef AVUTIL_CHANNEL_LAYOUT_H
169++ int frame_channels = avFrame->ch_layout.nb_channels;
170++#else
171++ int frame_channels = avFrame->channels;
172++#endif
173++ if (frame_channels != (sint_t)s->input_channels) {
174+ AUBIO_WRN ("source_avcodec: trying to read from %d channel(s),"
175+ "but configured for %d; is '%s' corrupt?\n",
176+- avFrame->channels, s->input_channels, s->path);
177++ frame_channels, s->input_channels, s->path);
178+ goto beach;
179+ }
180+ #else
181+@@ -462,7 +485,8 @@ void aubio_source_avcodec_readframe(aubi
182+ (uint8_t **)avFrame->data, in_linesize, in_samples);
183+ #elif defined(HAVE_SWRESAMPLE)
184+ in_samples = avFrame->nb_samples;
185+- max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;
186++ max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE;
187++ if (frame_channels > 0) max_out_samples /= frame_channels;
188+ out_samples = swr_convert( avr,
189+ (uint8_t **)&output, max_out_samples,
190+ (const uint8_t **)avFrame->data, in_samples);
191diff --git a/debian/patches/fixpy312.patch b/debian/patches/fixpy312.patch
192new file mode 100644
193index 0000000..ee5aa84
194--- /dev/null
195+++ b/debian/patches/fixpy312.patch
196@@ -0,0 +1,49 @@
197+Description: Fix Python 3.12 compatibility
198+Author: Zixing Liu <zixing.liu@canonical.com>
199+Forwarded: no
200+Last-Update: 2024-09-17
201+---
202+--- aubio-0.4.9.orig/python/ext/ufuncs.c
203++++ aubio-0.4.9/python/ext/ufuncs.c
204+@@ -3,8 +3,8 @@
205+
206+ typedef smpl_t (*aubio_unary_func_t)(smpl_t input);
207+
208+-static void aubio_PyUFunc_d_d(char **args, npy_intp *dimensions,
209+- npy_intp* steps, void* data)
210++static void aubio_PyUFunc_d_d(char **args, const npy_intp *dimensions,
211++ const npy_intp* steps, void* data)
212+ {
213+ npy_intp i;
214+ npy_intp n = dimensions[0];
215+@@ -22,8 +22,8 @@ static void aubio_PyUFunc_d_d(char **arg
216+ }
217+ }
218+
219+-static void aubio_PyUFunc_f_f_As_d_d(char **args, npy_intp *dimensions,
220+- npy_intp* steps, void* data)
221++static void aubio_PyUFunc_f_f_As_d_d(char **args, const npy_intp *dimensions,
222++ const npy_intp* steps, void* data)
223+ {
224+ npy_intp i;
225+ npy_intp n = dimensions[0];
226+--- aubio-0.4.9.orig/python/lib/gen_code.py
227++++ aubio-0.4.9/python/lib/gen_code.py
228+@@ -106,7 +106,7 @@ def get_name(proto):
229+
230+ def get_return_type(proto):
231+ import re
232+- paramregex = re.compile('(\w+ ?\*?).*')
233++ paramregex = re.compile(r'(\w+ ?\*?).*')
234+ outputs = paramregex.findall(proto)
235+ assert len(outputs) == 1
236+ return outputs[0].replace(' ', '')
237+@@ -137,7 +137,7 @@ def get_params(proto):
238+ returns: ['int argc', 'char ** argv']
239+ """
240+ import re
241+- paramregex = re.compile('.*\((.*)\);')
242++ paramregex = re.compile(r'.*\((.*)\);')
243+ a = paramregex.findall(proto)[0].split(', ')
244+ #a = [i.replace('const ', '') for i in a]
245+ return a
246diff --git a/debian/patches/series b/debian/patches/series
247index 2c657fd..f25bbc0 100644
248--- a/debian/patches/series
249+++ b/debian/patches/series
250@@ -6,3 +6,6 @@ wscript_py3.patch
251 waflib-py311.patch
252 ffmpeg5.patch
253 waflib-py312.patch
254+ffmpeg5.1.patch
255+ffmpeg5.1-adjust.patch
256+fixpy312.patch

Subscribers

People subscribed via source and target branches

to all changes: