forked from pool/aubio
Accepting request 1045016 from home:iznogood:branches:multimedia:libs
- Replace pkgconfig(libavresample) with pkgconfig(libswresample) BuildRequires as ffmpeg-5 does not provide libavresample. - Add cdfe9ce.patch: [source_avcodec] avoid deprecation warning with latest avcodec api (58.134.100). - Add 8a05420.patch: [source_avcodec] define FF_API_LAVF_AVCTX for libavcodec > 59, thx @berolinux (closes gh-353). OBS-URL: https://build.opensuse.org/request/show/1045016 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/aubio?expand=0&rev=40
This commit is contained in:
parent
269a27f1af
commit
0a74339319
25
8a05420.patch
Normal file
25
8a05420.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 8a05420e5dd8c7b8b2447f82dc919765876511b3 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Brossier <piem@piem.org>
|
||||
Date: Tue, 25 Jan 2022 18:30:27 +0100
|
||||
Subject: [PATCH] [source_avcodec] define FF_API_LAVF_AVCTX for libavcodec >
|
||||
59, thx @berolinux (closes gh-353)
|
||||
|
||||
---
|
||||
src/io/source_avcodec.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/io/source_avcodec.c b/src/io/source_avcodec.c
|
||||
index e0ae93b5..1421bd9a 100644
|
||||
--- a/src/io/source_avcodec.c
|
||||
+++ b/src/io/source_avcodec.c
|
||||
@@ -68,6 +68,10 @@
|
||||
#define AUBIO_AVCODEC_MAX_BUFFER_SIZE AV_INPUT_BUFFER_MIN_SIZE
|
||||
#endif
|
||||
|
||||
+#if LIBAVCODEC_VERSION_MAJOR >= 59
|
||||
+#define FF_API_LAVF_AVCTX 1
|
||||
+#endif
|
||||
+
|
||||
struct _aubio_source_avcodec_t {
|
||||
uint_t hop_size;
|
||||
uint_t samplerate;
|
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 13 09:19:51 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
|
||||
|
||||
- Replace pkgconfig(libavresample) with pkgconfig(libswresample)
|
||||
BuildRequires as ffmpeg-5 does not provide libavresample.
|
||||
- Add cdfe9ce.patch: [source_avcodec] avoid deprecation warning
|
||||
with latest avcodec api (58.134.100).
|
||||
- Add 8a05420.patch: [source_avcodec] define FF_API_LAVF_AVCTX for
|
||||
libavcodec > 59, thx @berolinux (closes gh-353).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Apr 9 15:14:06 UTC 2022 - dliw@posteo.net
|
||||
|
||||
|
@ -27,6 +27,11 @@ Group: Development/Libraries/C and C++
|
||||
URL: http://aubio.org
|
||||
Source: http://aubio.org/pub/%{name}-%{version}.tar.bz2
|
||||
Source1: http://aubio.org/pub/%{name}-%{version}.tar.bz2.asc
|
||||
# PATCH-FIX-UPSTREAM https://github.com/aubio/aubio/commit/cdfe9ce.patch -- [source_avcodec] avoid deprecation warning with latest avcodec api (58.134.100)
|
||||
Patch0: cdfe9ce.patch
|
||||
# PATCH-FIX-UPSTREAM https://github.com/aubio/aubio/commit/8a05420.patch -- [source_avcodec] define FF_API_LAVF_AVCTX for libavcodec > 59, thx @berolinux (closes gh-353)
|
||||
Patch1: 8a05420.patch
|
||||
|
||||
Source99: baselibs.conf
|
||||
BuildRequires: alsa-devel
|
||||
BuildRequires: doxygen
|
||||
@ -41,7 +46,7 @@ BuildRequires: txt2man
|
||||
BuildRequires: pkgconfig(libavcodec)
|
||||
BuildRequires: pkgconfig(libavdevice)
|
||||
BuildRequires: pkgconfig(libavformat)
|
||||
BuildRequires: pkgconfig(libavresample)
|
||||
BuildRequires: pkgconfig(libswresample)
|
||||
BuildRequires: pkgconfig(libavutil)
|
||||
%endif
|
||||
|
||||
@ -81,7 +86,7 @@ Group: Productivity/Multimedia/Sound/Editors and Convertors
|
||||
This package includes the example programs for aubio library.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%autosetup -p1
|
||||
# set proper library dir
|
||||
sed -i -e "s#/lib#/%{_lib}#" src/wscript_build
|
||||
# set python3 as testrunner
|
||||
|
157
cdfe9ce.patch
Normal file
157
cdfe9ce.patch
Normal file
@ -0,0 +1,157 @@
|
||||
From cdfe9cef2dcc3edf7d05ca2e9c2dbbf8dea21f1c Mon Sep 17 00:00:00 2001
|
||||
From: Paul Brossier <piem@piem.org>
|
||||
Date: Sun, 26 Dec 2021 01:52:16 -0500
|
||||
Subject: [PATCH] [source_avcodec] avoid deprecation warning with latest
|
||||
avcodec api (58.134.100)
|
||||
|
||||
---
|
||||
src/io/source_avcodec.c | 52 +++++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 45 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/io/source_avcodec.c b/src/io/source_avcodec.c
|
||||
index 5b25d85cc..e0ae93b5e 100644
|
||||
--- a/src/io/source_avcodec.c
|
||||
+++ b/src/io/source_avcodec.c
|
||||
@@ -82,7 +82,11 @@ struct _aubio_source_avcodec_t {
|
||||
AVFormatContext *avFormatCtx;
|
||||
AVCodecContext *avCodecCtx;
|
||||
AVFrame *avFrame;
|
||||
+#if FF_API_INIT_PACKET
|
||||
+ AVPacket *avPacket;
|
||||
+#else
|
||||
AVPacket avPacket;
|
||||
+#endif
|
||||
#ifdef HAVE_AVRESAMPLE
|
||||
AVAudioResampleContext *avr;
|
||||
#elif defined(HAVE_SWRESAMPLE)
|
||||
@@ -122,10 +126,14 @@ aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path,
|
||||
AVFormatContext *avFormatCtx = NULL;
|
||||
AVCodecContext *avCodecCtx = NULL;
|
||||
AVFrame *avFrame = NULL;
|
||||
+#if FF_API_INIT_PACKET
|
||||
+ AVPacket *avPacket = NULL;
|
||||
+#endif
|
||||
sint_t selected_stream = -1;
|
||||
#if FF_API_LAVF_AVCTX
|
||||
AVCodecParameters *codecpar;
|
||||
#endif
|
||||
+
|
||||
AVCodec *codec;
|
||||
uint_t i;
|
||||
int err;
|
||||
@@ -277,8 +285,17 @@ aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path,
|
||||
avFrame = av_frame_alloc();
|
||||
if (!avFrame) {
|
||||
AUBIO_ERR("source_avcodec: Could not allocate frame for (%s)\n", s->path);
|
||||
+ goto beach;
|
||||
}
|
||||
|
||||
+#if FF_API_INIT_PACKET
|
||||
+ avPacket = av_packet_alloc();
|
||||
+ if (!avPacket) {
|
||||
+ AUBIO_ERR("source_avcodec: Could not allocate packet for (%s)\n", s->path);
|
||||
+ goto beach;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
/* allocate output for avr */
|
||||
s->output = (smpl_t *)av_malloc(AUBIO_AVCODEC_MAX_BUFFER_SIZE
|
||||
* sizeof(smpl_t));
|
||||
@@ -289,6 +306,9 @@ aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path,
|
||||
s->avFormatCtx = avFormatCtx;
|
||||
s->avCodecCtx = avCodecCtx;
|
||||
s->avFrame = avFrame;
|
||||
+#if FF_API_INIT_PACKET
|
||||
+ s->avPacket = avPacket;
|
||||
+#endif
|
||||
|
||||
aubio_source_avcodec_reset_resampler(s);
|
||||
|
||||
@@ -354,7 +374,11 @@ void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s,
|
||||
AVFormatContext *avFormatCtx = s->avFormatCtx;
|
||||
AVCodecContext *avCodecCtx = s->avCodecCtx;
|
||||
AVFrame *avFrame = s->avFrame;
|
||||
- AVPacket avPacket = s->avPacket;
|
||||
+#if FF_API_INIT_PACKET
|
||||
+ AVPacket *avPacket = s->avPacket;
|
||||
+#else
|
||||
+ AVPacket *avPacket = &s->avPacket;
|
||||
+#endif
|
||||
#ifdef HAVE_AVRESAMPLE
|
||||
AVAudioResampleContext *avr = s->avr;
|
||||
#elif defined(HAVE_SWRESAMPLE)
|
||||
@@ -378,12 +402,14 @@ void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s,
|
||||
#else
|
||||
int ret = 0;
|
||||
#endif
|
||||
- av_init_packet (&avPacket);
|
||||
+#ifndef FF_API_INIT_PACKET
|
||||
+ av_init_packet (avPacket);
|
||||
+#endif
|
||||
*read_samples = 0;
|
||||
|
||||
do
|
||||
{
|
||||
- int err = av_read_frame (avFormatCtx, &avPacket);
|
||||
+ int err = av_read_frame (avFormatCtx, avPacket);
|
||||
if (err == AVERROR_EOF) {
|
||||
s->eof = 1;
|
||||
goto beach;
|
||||
@@ -396,10 +422,10 @@ void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s,
|
||||
s->eof = 1;
|
||||
goto beach;
|
||||
}
|
||||
- } while (avPacket.stream_index != s->selected_stream);
|
||||
+ } while (avPacket->stream_index != s->selected_stream);
|
||||
|
||||
#if FF_API_LAVF_AVCTX
|
||||
- ret = avcodec_send_packet(avCodecCtx, &avPacket);
|
||||
+ ret = avcodec_send_packet(avCodecCtx, avPacket);
|
||||
if (ret < 0 && ret != AVERROR_EOF) {
|
||||
AUBIO_ERR("source_avcodec: error when sending packet for %s\n", s->path);
|
||||
goto beach;
|
||||
@@ -422,7 +448,7 @@ void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s,
|
||||
}
|
||||
}
|
||||
#else
|
||||
- len = avcodec_decode_audio4(avCodecCtx, avFrame, &got_frame, &avPacket);
|
||||
+ len = avcodec_decode_audio4(avCodecCtx, avFrame, &got_frame, avPacket);
|
||||
|
||||
if (len < 0) {
|
||||
AUBIO_ERR("source_avcodec: error while decoding %s\n", s->path);
|
||||
@@ -472,7 +498,7 @@ void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s,
|
||||
*read_samples = out_samples;
|
||||
|
||||
beach:
|
||||
- av_packet_unref(&avPacket);
|
||||
+ av_packet_unref(avPacket);
|
||||
}
|
||||
|
||||
void aubio_source_avcodec_do(aubio_source_avcodec_t * s, fvec_t * read_data,
|
||||
@@ -638,7 +664,13 @@ uint_t aubio_source_avcodec_close(aubio_source_avcodec_t * s) {
|
||||
avformat_close_input(&s->avFormatCtx);
|
||||
s->avFormatCtx = NULL;
|
||||
}
|
||||
+#if FF_API_INIT_PACKET
|
||||
+ if (s->avPacket) {
|
||||
+ av_packet_unref(s->avPacket);
|
||||
+ }
|
||||
+#else
|
||||
av_packet_unref(&s->avPacket);
|
||||
+#endif
|
||||
return AUBIO_OK;
|
||||
}
|
||||
|
||||
@@ -653,6 +685,12 @@ void del_aubio_source_avcodec(aubio_source_avcodec_t * s){
|
||||
av_frame_free( &(s->avFrame) );
|
||||
}
|
||||
s->avFrame = NULL;
|
||||
+#if FF_API_INIT_PACKET
|
||||
+ if (s->avPacket != NULL) {
|
||||
+ av_packet_free( &(s->avPacket) );
|
||||
+ }
|
||||
+ s->avPacket = NULL;
|
||||
+#endif
|
||||
if (s->path) {
|
||||
AUBIO_FREE(s->path);
|
||||
}
|
Loading…
Reference in New Issue
Block a user