.gear/libaubio.spec | 198 +++++++++++++++++++++ .gear/rules | 3 + .../tags/319186517bfc0dd5c015241c091b849f209e0483 | 24 +++ .gear/tags/list | 1 + src/io/source_avcodec.c | 56 +++++- tests/wscript_build | 2 +- 6 files changed, 276 insertions(+), 8 deletions(-) diff --git a/.gear/libaubio.spec b/.gear/libaubio.spec new file mode 100644 index 00000000..88ebd748 --- /dev/null +++ b/.gear/libaubio.spec @@ -0,0 +1,198 @@ +%define origname aubio +%define sover 5 +%def_enable python + +Name: libaubio%sover +Version: 0.4.9 +Release: alt6 +Summary: Aubio is a library for real time audio labelling +Url: http://www.aubio.org/ +VCS: https://github.com/aubio/aubio +License: GPLv3 +Group: System/Libraries + +Source: %origname-%version.tar +Patch0: %name-%version-alt.patch + +# Automatically added by buildreq on Thu Nov 06 2008 +BuildRequires: docbook-to-man jackit-devel libfftw3-devel libsamplerate-devel libsndfile-devel + +BuildPreReq: python3-base waf >= 1.9.12 libavcodec-devel libavformat-devel +BuildPreReq: txt2man doxygen python3-dev libswresample-devel +BuildPreReq: libnumpy-py3-devel python3-module-numpy + +%description +Aubio is a library for real time audio labelling. Its features include +segmenting a sound file before each of its attacks, performing pitch detection, +tapping the beat and producing midi streams from live audio. + +A few examples of applications are provided in examples/ and python/: + - aubioonset output the onset detected, + - aubionotes emits midi-like notes, + - aubiocut is a python script that takes an input sound and creates one new + sample at each detected onset or beat, + - aubiopitch is a python script to extract pitch tracks from sound files. + +%if_enabled python +%package -n python3-module-%origname +Group: Development/Python +Summary: Python bindings to %name +Requires: %name = %EVR + +%description -n python3-module-%origname +Aubio is a library for real time audio labelling. Its features include +segmenting a sound file before each of its attacks, performing pitch detection, +tapping the beat and producing midi streams from live audio. + +This package contains the Python bindings required for +building Python programs based on %name. +%endif + +%package devel +Group: Development/C +Summary: Development files of %name +Requires: %name = %EVR +Conflicts: lib%origname-devel +Provides: lib%origname-devel + +%description devel +Aubio is a library for real time audio labelling. Its features include +segmenting a sound file before each of its attacks, performing pitch detection, +tapping the beat and producing midi streams from live audio. + +This package contains the C headers and documentation required for +building programs based on %name. + +%package examples +Group: Sound +Summary: Examples of %name +Conflicts: lib%origname-examples + +%description examples +Aubio is a library for real time audio labelling. Its features include +segmenting a sound file before each of its attacks, performing pitch detection, +tapping the beat and producing midi streams from live audio. + +This package contains +A few examples of applications are provided in examples/ and python/: + - aubioonset output the onset detected, + - aubionotes emits midi-like notes, + - aubiocut is a python script that takes an input sound and creates one new + sample at each detected onset or beat, + - aubiopitch is a python script to extract pitch tracks from sound files. + +aubioonset and aubionotes can work either off-line or online, outputting the +results on the console or playing a wood-block sound at each detected onset. +Both Python scripts can plot the results with Gnuplot. + +%package devel-docs +Summary: Documentation for %name +Group: Development/Documentation +BuildArch: noarch + +%description devel-docs +Aubio is a library for real time audio labelling. Its features include +segmenting a sound file before each of its attacks, performing pitch detection, +tapping the beat and producing midi streams from live audio. + +This package contains documentation for %name. + +%prep +%setup -n %origname-%version +%patch0 -p1 + +rm -fR waflib + +%build +waf configure --prefix=%prefix --libdir=%_libdir +waf build -vv + +%if_enabled python +%python3_build +%endif + +%install +waf install --destdir=%buildroot +rm -v %buildroot%_libdir/libaubio.a + +%if_enabled python +%python3_install +%endif + +%files +%doc AUTHORS ChangeLog README.md doc/* +%_libdir/*.so.%{sover}* + +%if_enabled python +%files -n python3-module-%origname +%doc python/README.md python/demos +%python3_sitelibdir/* +%endif + +%files devel +%_includedir/%origname +%_libdir/*.so +%_pkgconfigdir/%origname.pc + +%files examples +%_bindir/* +#_datadir/sounds/%origname +%_man1dir/* + +%files devel-docs +%_docdir/lib%origname-doc + +%changelog +* Thu Sep 07 2023 Anton Farygin 0.4.9-alt6 +- add commits e1888a67 and 19b20ab9 from upstream to support build with ffmpeg 6 + +* Mon Aug 07 2023 Vitaly Lipatov 0.4.9-alt5 +- NMU: dropped unneded BR: libnumpy-devel, removed libaubio.a + +* Fri Sep 03 2021 Anton Farygin 0.4.9-alt4 +- FTBFS: use python3 to prepare data for tests (closes: #40405) + +* Mon Mar 16 2020 Aleksei Nikiforov 0.4.9-alt3 +- Fixed build with numpy. + +* Wed Nov 27 2019 Anton Farygin 0.4.9-alt2 +- built with python3 + +* Fri Mar 08 2019 Anton Farygin 0.4.9-alt1 +- 0.4.9 +- added libaubio-devel provides + +* Tue Jan 22 2019 Anton Farygin 0.4.8-alt1 +- 0.4.8 + +* Tue Oct 09 2018 Anton Farygin 0.4.7-alt1 +- 0.4.7 + +* Wed Jun 13 2018 Anton Farygin 0.4.6-alt2 +- rebuilt for ffmpeg-4.0 + +* Mon Nov 13 2017 Anton Farygin 0.4.6-alt1 +- 0.4.6 + +* Sun Jun 04 2017 Anton Farygin 0.4.5-alt1 +- 0.4.5 + +* Mon Jun 06 2016 Ivan Zakharyaschev 0.4.1-alt2.git20140312.1 +- (AUTO) subst_x86_64. + +* Sat Mar 12 2016 Sergey Bolshakov 0.4.1-alt2.git20140312 +- rebuilt with recent libav + +* Sat Sep 13 2014 Eugeny A. Rostovtsev (REAL) 0.4.1-alt1.git20140312 +- Version 0.4.1 + +* Wed Jun 13 2012 Eugeny A. Rostovtsev (REAL) 0.3.2-alt1.2 +- Fixed build + +* Thu Jan 20 2011 Igor Vlasenko 0.3.2-alt1.1 +- rebuild for set:provides by request of mithraen + +* Thu Nov 06 2008 Ildar Mulyukov 0.3.2-alt1 +- 1st version for Sisyphus +- Python bindings are OFF +- build without Lash and PureData diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 00000000..b0b927ea --- /dev/null +++ b/.gear/rules @@ -0,0 +1,3 @@ +spec: .gear/libaubio.spec +tar: @version@:. name=aubio-@version@ +diff: @version@:. . name=@name@-@version@-alt.patch diff --git a/.gear/tags/319186517bfc0dd5c015241c091b849f209e0483 b/.gear/tags/319186517bfc0dd5c015241c091b849f209e0483 new file mode 100644 index 00000000..b0b06c8a --- /dev/null +++ b/.gear/tags/319186517bfc0dd5c015241c091b849f209e0483 @@ -0,0 +1,24 @@ +object 90bd27a23123fcc524c31787c9c8fc0ae4c79378 +type commit +tag 0.4.9 +tagger Paul Brossier 1549554786 +0100 + +0.4.9 +-----BEGIN PGP SIGNATURE----- + +iQKTBAABCgB9FiEEuIpQctSRWuz4GiQ0akmxlyir3ZIFAlxcVHxfFIAAAAAALgAo +aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEI4 +OEE1MDcyRDQ5MTVBRUNGODFBMjQzNDZBNDlCMTk3MjhBQkREOTIACgkQakmxlyir +3ZKTexAAoVGiQkNBz+6KuZXmJBOzoFAANHDXWHvcOcNeuSiC4WHsSACydq/ICwcz +Be2SgnTr3zAMNGHA3WBH41aOtnvliN7wWVRUNygAEbkqLke4oGXV7mA3YIfIvryq +CGUUk36N4wpx18FPqALO9j13/3RuxbjjA0icCMJMDic2vPkvF07VYE8ZbKdaZAzV +m/SkO+41uyDCbArqQmjMqLcv0lL7H1hecOvsNgs874/Ed65FMo/IgxRmE/c8Csyo +qX5J+Alyz/qc9ruih4IET4B3gu++hnd9hA5LwDmMXwp3572zsjHyHYM2PWN5QDRc +Lr6J+202EjNWEo841OLlLhFgarbhxPOEQftHcB4Vl1IA5OmjWatB2UKvvwxKzHrP +zM4BHPPkcNtuAgPI8xrA4iBqBSZY2FlzmM4hhiFVglbuKPc2d+9pXhsxj0uIVcrx +9rkOHB27680KHkPaSwBfdFMwxKiQsMnbhvObovZSrQgNWVXbAU0Or7Z6u0RI4i33 +Pd8X0gVTKuS3O8p6K7OrmF8aKeYr5oc0PnDbDqgIt3ehM43aI/rrUr1R3Jp7nOvq +8JKqNFbbOUQMCuZdgIRZ6Aw26q6b3lHroAXCeGzJ8OBfqG092/sM4+kTQtyu03L5 +l23fGaRdwKtXBqy6c2AlCpxn0fE/oHHVDux5KrRKMuzVIhEVsS8= +=VAw5 +-----END PGP SIGNATURE----- diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 00000000..8be9331e --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1 @@ +319186517bfc0dd5c015241c091b849f209e0483 0.4.9 diff --git a/src/io/source_avcodec.c b/src/io/source_avcodec.c index 5b25d85c..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; @@ -82,7 +86,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 +130,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,7 +289,16 @@ 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 @@ -289,6 +310,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 +378,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 +406,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 +426,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 +452,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 +502,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 +668,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 +689,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); } diff --git a/tests/wscript_build b/tests/wscript_build index c99a051e..f0e1385c 100644 --- a/tests/wscript_build +++ b/tests/wscript_build @@ -13,7 +13,7 @@ test_sound_abspath = bld.path.get_bld().make_node(test_sound_target) test_sound_abspath = str(test_sound_abspath).replace('\\', '\\\\') b = bld(name='create_tests_source', - rule='python ${SRC} ${TGT}', + rule='python3 ${SRC} ${TGT}', source='create_tests_source.py', target=test_sound_target) # use post() to create the task, keep a reference to it