diff --git a/alsa-plugins/.signature b/alsa-plugins/.signature index ebd1526a9..469f10ccc 100644 --- a/alsa-plugins/.signature +++ b/alsa-plugins/.signature @@ -1,6 +1,7 @@ untrusted comment: verify with /etc/ports/opt.pub -RWSE3ohX2g5d/fBa21N9xHCtNDGVvIl8bO4n7reXrGwyGZw4JpRrappbsiBzyyyRjvhlrFoepsElrvWUnRsZYVYCBrWJMr+hiwc= -SHA256 (Pkgfile) = 027e2886f1c383ec57f6238501d84d391be971ab1b77d435d1d0f5233deb0f3c +RWSE3ohX2g5d/f/eAN7N2qLov+gMJY087FqB60dJjSf9IFpIA5emIjahjQDhYR64U3MjlIjA/bn+5jl9E0Snk9JlHJIdyt+cVQw= +SHA256 (Pkgfile) = 4e030a424005301cac1304f5809f0541473e2d3dff74eae7670673e72673b2f9 SHA256 (.footprint) = 37c6522ccf4fc33353130b3d087e57e708fa82ba482d47d2a584d8bfa8ba823d SHA256 (alsa-plugins-1.2.7.1.tar.bz2) = 8c337814954bb7c167456733a6046142a2931f12eccba3ec2a4ae618a3432511 +SHA256 (ffmpeg7.patch) = c15453f0ad1903146427aeff76998b717dd488886ca39cadffffbf61c9240ca2 SHA256 (pulse-sysdefault.diff) = d8c59b891e2913619d057ffea308293d73892b16fa5a01583d056e372e55309d diff --git a/alsa-plugins/Pkgfile b/alsa-plugins/Pkgfile index 601fb68d1..831a68837 100644 --- a/alsa-plugins/Pkgfile +++ b/alsa-plugins/Pkgfile @@ -6,14 +6,16 @@ name=alsa-plugins version=1.2.7.1 -release=2 +release=3 source=(ftp://ftp.alsa-project.org/pub/plugins/$name-$version.tar.bz2 + ffmpeg7.patch pulse-sysdefault.diff) build() { cd $name-$version patch -Np1 -i $SRC/pulse-sysdefault.diff + patch -Np1 -i $SRC/ffmpeg7.patch ./configure --prefix=/usr --sysconfdir=/etc diff --git a/alsa-plugins/ffmpeg7.patch b/alsa-plugins/ffmpeg7.patch new file mode 100644 index 000000000..f157f5cda --- /dev/null +++ b/alsa-plugins/ffmpeg7.patch @@ -0,0 +1,146 @@ +From a26742f6b21431da93f8c0e94d002ee55a5f9000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= +Date: Sun, 14 Apr 2024 11:09:20 +0200 +Subject: [PATCH] Compatibility with FFMPEG 7.0 + +channel_layout has been replace with ch_layout + +avcodec_close has been deprecated in favor of avcodec_free_context + +Fix #57 +--- + a52/pcm_a52.c | 33 ++++++++++++++++++++++++++++++++- + rate-lav/rate_lavrate.c | 24 ++++++++++++++++++++++-- + 2 files changed, 54 insertions(+), 3 deletions(-) + +diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c +index 9da8897..a0df5c7 100644 +--- a/a52/pcm_a52.c ++++ b/a52/pcm_a52.c +@@ -78,6 +78,9 @@ + #define av_frame_free avcodec_free_frame + #endif + ++#define HAVE_AVCODEC_FREE_CONTEXT (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 69, 100)) ++#define HAVE_CH_LAYOUT (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)) ++ + struct a52_ctx { + snd_pcm_ioplug_t io; + snd_pcm_t *slave; +@@ -628,7 +631,11 @@ static int a52_stop(snd_pcm_ioplug_t *io) + static void a52_free(struct a52_ctx *rec) + { + if (rec->avctx) { +- avcodec_close(rec->avctx); ++ #if HAVE_AVCODEC_FREE_CONTEXT ++ avcodec_free_context(&rec->avctx); ++ #else ++ avcodec_close(rec->avctx); ++ #endif + av_free(rec->avctx); + rec->avctx = NULL; + } +@@ -667,6 +674,21 @@ static void a52_free(struct a52_ctx *rec) + static void set_channel_layout(snd_pcm_ioplug_t *io) + { + struct a52_ctx *rec = io->private_data; ++#if HAVE_CH_LAYOUT ++ switch (io->channels) { ++ case 2: ++ rec->avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; ++ break; ++ case 4: ++ rec->avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_QUAD; ++ break; ++ case 6: ++ rec->avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1; ++ break; ++ default: ++ break; ++ } ++#else + switch (io->channels) { + case 2: + rec->avctx->channel_layout = AV_CH_LAYOUT_STEREO; +@@ -680,6 +702,7 @@ static void set_channel_layout(snd_pcm_ioplug_t *io) + default: + break; + } ++#endif + } + #else + #define set_channel_layout(io) /* NOP */ +@@ -695,8 +718,12 @@ static int alloc_input_buffer(snd_pcm_ioplug_t *io) + rec->frame->nb_samples = rec->avctx->frame_size; + #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 91, 0) + rec->frame->format = rec->avctx->sample_fmt; ++#if HAVE_CH_LAYOUT ++ av_channel_layout_from_mask(&rec->frame->ch_layout, rec->avctx->ch_layout.u.mask); ++#else + rec->frame->channels = rec->avctx->channels; + rec->frame->channel_layout = rec->avctx->channel_layout; ++#endif + if (av_frame_get_buffer(rec->frame, 0)) + return -ENOMEM; + #else +@@ -731,7 +758,11 @@ static int a52_prepare(snd_pcm_ioplug_t *io) + + rec->avctx->bit_rate = rec->bitrate * 1000; + rec->avctx->sample_rate = io->rate; ++#if HAVE_CH_LAYOUT ++ rec->avctx->ch_layout.nb_channels = io->channels; ++#else + rec->avctx->channels = io->channels; ++#endif + rec->avctx->sample_fmt = rec->av_format; + + set_channel_layout(io); +diff --git a/rate-lav/rate_lavrate.c b/rate-lav/rate_lavrate.c +index f78eea5..ee53e45 100644 +--- a/rate-lav/rate_lavrate.c ++++ b/rate-lav/rate_lavrate.c +@@ -18,11 +18,24 @@ + #include + + #include ++#include ++#include + #include + #include + #include + #include + ++/* some compatibility wrappers */ ++#ifndef AV_VERSION_INT ++#define AV_VERSION_INT(a, b, c) (((a) << 16) | ((b) << 8) | (c)) ++#endif ++#ifndef LIBAVUTIL_VERSION_INT ++#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ ++LIBAVUTIL_VERSION_MINOR, \ ++LIBAVUTIL_VERSION_MICRO) ++#endif ++ ++#define HAVE_CH_LAYOUT (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)) + + static unsigned int filter_size = 16; + +@@ -95,10 +108,17 @@ static int pcm_src_init(void *obj, snd_pcm_rate_info_t *info) + if (!rate->avr) + return -ENOMEM; + ++#if HAVE_CH_LAYOUT ++ AVChannelLayout layout; ++ av_channel_layout_default(&layout, rate->channels); ++ av_opt_set_chlayout(rate->avr, "in_chlayout", &layout, 0); ++ av_opt_set_chlayout(rate->avr, "out_chlayout", &layout, 0); ++#else + av_opt_set_channel_layout(rate->avr, "in_channel_layout", +- av_get_default_channel_layout(rate->channels), 0); ++ av_get_default_channel_layout(rate->channels), 0); + av_opt_set_channel_layout(rate->avr, "out_channel_layout", +- av_get_default_channel_layout(rate->channels), 0); ++ av_get_default_channel_layout(rate->channels), 0); ++#endif + av_opt_set_int(rate->avr, "in_sample_rate", rate->in_rate, 0); + av_opt_set_int(rate->avr, "out_sample_rate", rate->out_rate, 0); + fmt = support_multi_format(rate) ? info->in.format : SND_PCM_FORMAT_S16;