Changes in / [8177483:42f1cd01]
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified Makefile ¶
r8177483 r42f1cd01 11 11 12 12 WAFCMD=python waf 13 WAFURL=https://waf.io/waf-1.9.6 13 14 14 15 #WAFOPTS:= -
TabularUnified python/lib/moresetuptools.py ¶
r8177483 r42f1cd01 113 113 # loof for additional packages 114 114 print("Info: looking for *optional* additional packages") 115 packages = ['libavcodec', 'libavformat', 'libavutil', 116 'libswresample', 'libavresample', 115 packages = ['libavcodec', 'libavformat', 'libavutil', 'libavresample', 116 'jack', 117 'jack', 117 118 'sndfile', 118 119 #'fftw3f', … … 126 127 if 'avcodec' in ext.libraries \ 127 128 and 'avformat' in ext.libraries \ 128 and 'avutil' in ext.libraries: 129 if 'swresample' in ext.libraries: 130 ext.define_macros += [('HAVE_SWRESAMPLE', 1)] 131 elif 'avresample' in ext.libraries: 132 ext.define_macros += [('HAVE_AVRESAMPLE', 1)] 133 if 'swresample' in ext.libraries or 'avresample' in ext.libraries: 134 ext.define_macros += [('HAVE_LIBAV', 1)] 129 and 'avutil' in ext.libraries \ 130 and 'avresample' in ext.libraries: 131 ext.define_macros += [('HAVE_LIBAV', 1)] 132 if 'jack' in ext.libraries: 133 ext.define_macros += [('HAVE_JACK', 1)] 135 134 if 'sndfile' in ext.libraries: 136 135 ext.define_macros += [('HAVE_SNDFILE', 1)] -
TabularUnified scripts/build_mingw ¶
r8177483 r42f1cd01 1 1 #! /bin/bash 2 2 3 # This script cross compiles aubio for windows using mingw, four times: 4 # 5 # - 32 and 64 bits with no external dependencies 6 # - 32 and 64 bits against ffmpeg 7 # 3 # This script cross compiles aubio for windows using mingw, both for 32 and 64 4 # bits. Built binaries will be placed in ./dist-win32 and ./dist-win64. 5 8 6 # On debian or ubuntu, you will want to 'apt-get install gcc-mingw-w64' 9 7 … … 11 9 set -x 12 10 13 source VERSION 14 VERSION="$AUBIO_MAJOR_VERSION.$AUBIO_MINOR_VERSION.$AUBIO_PATCH_VERSION" 15 VERSION+="$AUBIO_VERSION_STATUS" 11 WAFOPTS="-v --disable-avcodec --disable-samplerate --disable-jack --disable-sndfile" 16 12 17 FFMPEG_BUILDS_URL="https://ffmpeg.zeranoe.com/builds" 18 FFMPEG_DEFAULT="20170315-6c4665d" 13 [ -d dist-win32 ] && rm -rf dist-win32 14 [ -d dist-win64 ] && rm -rf dist-win64 19 15 20 # define some default CFLAGS 21 DEF_CFLAGS="-Os -I/usr/share/mingw-w64" 22 DEF_LDFLAGS="" 16 CFLAGS="-Os" \ 17 LDFLAGS="" \ 18 CC=x86_64-w64-mingw32-gcc \ 19 ./waf distclean configure build install --destdir=$PWD/dist-win64 \ 20 --testcmd="echo %s" \ 21 $WAFOPTS --with-target-platform=win64 23 22 24 WAFOPTS="" 25 # disable external deps to make sure we don't try to use the host package 26 WAFOPTS+=" --disable-samplerate --disable-jack --disable-sndfile" 27 # enable ffmpeg build 28 WAFOPTS+=" --disable-avcodec" 29 # install without a prefix 30 WAFOPTS+=" --prefix=/" 31 # compile the tests, but fake running them 32 # passing this option WAFOPTS fails (escaping?), added in actual waf call below 33 #WAFOPTS+=" --testcmd='echo %s'" 34 35 # debugging 36 #WAFOPTS+=" -v" 37 #WAFOPTS+=" -j1" 38 #WAFOPTS+=" --notests" 39 40 function fetch_ffpmeg() { 41 ## manually add ffmpeg (no pkg-config .pc files in bins) 42 [ -n "$FFMPEG_VERSION" ] || FFMPEG_VERSION=$FFMPEG_DEFAULT 43 FFMPEG_TARBALL="$PWD/ffmpeg-$FFMPEG_VERSION-$TARGET-dev.zip" 44 FFMPEG_BINARIES="${FFMPEG_TARBALL%%.zip}" 45 if [ ! -d "$FFMPEG_BINARIES" ] 46 then 47 if [ ! -f "$FFMPEG_TARBALL" ] 48 then 49 curl -O $FFMPEG_BUILDS_URL/$TARGET/dev/ffmpeg-$FFMPEG_VERSION-$TARGET-dev.zip 50 else 51 echo "using $FFMPEG_TARBALL" 52 fi 53 unzip -x $FFMPEG_TARBALL 54 else 55 echo "using $FFMPEG_BINARIES" 56 fi 57 } 58 59 function get_cflags() { 60 CFLAGS="$DEF_CFLAGS" 61 LDFLAGS="$DEF_LDFLAGS" 62 if [ -n "$WITH_FFMEG" ] 63 then 64 fetch_ffpmeg 65 CFLAGS+=" -DHAVE_LIBAV=1 -DHAVE_SWRESAMPLE=1" 66 CFLAGS+=" -I$FFMPEG_BINARIES/include" 67 LDFLAGS+=" -lavcodec -lavformat -lavutil -lswresample" 68 LDFLAGS+=" -L$FFMPEG_BINARIES/lib" 69 fi 70 } 71 72 function build_mingw() { 73 DESTDIR="$PWD/aubio-$VERSION-$TARGET" 74 [ -n "$WITH_FFMEG" ] && DESTDIR+="-ffmpeg" 75 [ -f $DESTDIR.zip ] && echo "Remove existing $DESTDIR.zip first" && exit 1 76 [ -d $DESTDIR ] && rm -rf $DESTDIR 77 WAFOPTS_TGT="$WAFOPTS --destdir=$DESTDIR" 78 WAFOPTS_TGT+=" --with-target-platform=$TARGET" 79 get_cflags 80 CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \ 81 ./waf distclean configure build install $WAFOPTS_TGT --testcmd='echo %s' 82 zip -r $DESTDIR.zip `basename $DESTDIR` 83 rm -rf $DESTDIR 84 sha256sum $DESTDIR.zip > $DESTDIR.zip.sha256 85 } 86 87 function build_mingw32() { 88 TARGET=win32 89 export CC=i686-w64-mingw32-gcc 90 build_mingw 91 } 92 93 function build_mingw64() { 94 TARGET=win64 95 export CC=x86_64-w64-mingw32-gcc 96 build_mingw 97 } 98 99 # fetch waf if needed 100 [ -f "waf" ] || make getwaf 101 102 # first build without ffmpeg 103 build_mingw32 104 build_mingw64 105 106 # then build against ffmpeg 107 WITH_FFMEG=1 108 build_mingw32 109 build_mingw64 110 111 set +x 112 echo "" 113 echo "All done! The following files were generated:" 114 echo "" 115 ls -lart aubio*.zip* 23 CFLAGS="-Os" \ 24 LDFLAGS="" \ 25 CC=i686-w64-mingw32-gcc \ 26 ./waf distclean configure build install --destdir=$PWD/dist-win32 \ 27 --testcmd="echo %s" \ 28 $WAFOPTS --with-target-platform=win32 -
TabularUnified scripts/get_waf.sh ¶
r8177483 r42f1cd01 4 4 set -x 5 5 6 WAFURL=https://waf.io/waf-1. 9.66 WAFURL=https://waf.io/waf-1.8.22 7 7 8 8 ( which wget > /dev/null && wget -qO waf $WAFURL ) || ( which curl > /dev/null && curl $WAFURL > waf ) -
TabularUnified src/io/source_avcodec.c ¶
r8177483 r42f1cd01 25 25 #include <libavcodec/avcodec.h> 26 26 #include <libavformat/avformat.h> 27 #if defined(HAVE_SWRESAMPLE)28 #include <libswresample/swresample.h>29 #elif defined(HAVE_AVRESAMPLE)30 27 #include <libavresample/avresample.h> 31 #endif32 28 #include <libavutil/opt.h> 33 29 #include <stdlib.h> … … 73 69 AVFrame *avFrame; 74 70 AVPacket avPacket; 75 #ifdef HAVE_AVRESAMPLE76 71 AVAudioResampleContext *avr; 77 #elif defined(HAVE_SWRESAMPLE)78 SwrContext *avr;79 #endif80 72 smpl_t *output; 81 73 uint_t read_samples; … … 285 277 uint_t output_channels = multi ? s->input_channels : 1; 286 278 int64_t output_layout = av_get_default_channel_layout(output_channels); 287 #ifdef HAVE_AVRESAMPLE288 279 AVAudioResampleContext *avr = avresample_alloc_context(); 289 280 AVAudioResampleContext *oldavr = s->avr; 290 #elif defined(HAVE_SWRESAMPLE)291 SwrContext *avr = swr_alloc();292 SwrContext *oldavr = s->avr;293 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */294 281 295 282 av_opt_set_int(avr, "in_channel_layout", input_layout, 0); … … 306 293 //av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_FLTP, 0); 307 294 int err; 308 #ifdef HAVE_AVRESAMPLE309 295 if ( ( err = avresample_open(avr) ) < 0) { 310 #elif defined(HAVE_SWRESAMPLE)311 if ( ( err = swr_init(avr) ) < 0) {312 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */313 296 char errorstr[256]; 314 297 av_strerror (err, errorstr, sizeof(errorstr)); … … 320 303 s->avr = avr; 321 304 if (oldavr != NULL) { 322 #ifdef HAVE_AVRESAMPLE323 305 avresample_close( oldavr ); 324 #elif defined(HAVE_SWRESAMPLE)325 swr_close ( oldavr );326 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */327 306 av_free ( oldavr ); 328 307 oldavr = NULL; … … 338 317 AVPacket avPacket = s->avPacket; 339 318 av_init_packet (&avPacket); 340 #ifdef HAVE_AVRESAMPLE341 319 AVAudioResampleContext *avr = s->avr; 342 #elif defined(HAVE_SWRESAMPLE)343 SwrContext *avr = s->avr;344 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */345 320 smpl_t *output = s->output; 346 321 *read_samples = 0; … … 395 370 } 396 371 397 #ifdef HAVE_AVRESAMPLE398 372 int in_linesize = 0; 399 373 av_samples_get_buffer_size(&in_linesize, avCodecCtx->channels, … … 405 379 (uint8_t **)&output, out_linesize, max_out_samples, 406 380 (uint8_t **)avFrame->data, in_linesize, in_samples); 407 #elif defined(HAVE_SWRESAMPLE)408 int in_samples = avFrame->nb_samples;409 int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;410 int out_samples = swr_convert( avr,411 (uint8_t **)&output, max_out_samples,412 (const uint8_t **)avFrame->data, in_samples);413 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */414 381 if (out_samples <= 0) { 415 382 AUBIO_WRN("source_avcodec: no sample found while converting frame (%s)\n", s->path); … … 423 390 s->avCodecCtx = avCodecCtx; 424 391 s->avFrame = avFrame; 425 #if defined(HAVE_AVRESAMPLE) || defined(HAVE_SWRESAMPLE)426 392 s->avr = avr; 427 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */428 393 s->output = output; 429 394 … … 534 499 s->read_index = 0; 535 500 s->read_samples = 0; 536 #ifdef HAVE_AVRESAMPLE537 501 // reset the AVAudioResampleContext 538 502 avresample_close(s->avr); 539 503 avresample_open(s->avr); 540 #elif defined(HAVE_SWRESAMPLE)541 swr_close(s->avr);542 swr_init(s->avr);543 #endif544 504 return ret; 545 505 } … … 555 515 uint_t aubio_source_avcodec_close(aubio_source_avcodec_t * s) { 556 516 if (s->avr != NULL) { 557 #ifdef HAVE_AVRESAMPLE558 517 avresample_close( s->avr ); 559 #elif defined(HAVE_SWRESAMPLE)560 swr_close ( s->avr );561 #endif562 518 av_free ( s->avr ); 563 519 } -
TabularUnified src/utils/windll.c ¶
r8177483 r42f1cd01 42 42 #include "aubio.h" 43 43 44 BOOL APIENTRY DllMain( HMODULE hModule UNUSED,44 BOOL APIENTRY DllMain( HMODULE hModule, 45 45 DWORD ul_reason_for_call, 46 LPVOID lpReserved UNUSED)46 LPVOID lpReserved ) 47 47 { 48 48 switch (ul_reason_for_call) -
TabularUnified src/wscript_build ¶
r8177483 r42f1cd01 8 8 uselib += ['AVCODEC'] 9 9 uselib += ['AVFORMAT'] 10 uselib += ['SWRESAMPLE']11 10 uselib += ['AVRESAMPLE'] 12 11 uselib += ['AVUTIL'] -
TabularUnified wscript ¶
r8177483 r42f1cd01 325 325 args = '--cflags --libs', uselib_store = 'AVUTIL', 326 326 mandatory = ctx.options.enable_avcodec) 327 ctx.check_cfg(package = 'libswresample', atleast_version = '2.3.0', 328 args = '--cflags --libs', uselib_store = 'SWRESAMPLE', 329 mandatory = False) 330 if 'HAVE_SWRESAMPLE' not in ctx.env: 331 ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1', 332 args = '--cflags --libs', uselib_store = 'AVRESAMPLE', 333 mandatory = False) 334 335 msg_check = 'Checking for all libav libraries' 336 if 'HAVE_AVCODEC' not in ctx.env: 337 ctx.msg(msg_check, 'not found (missing avcodec)', color = 'YELLOW') 338 elif 'HAVE_AVFORMAT' not in ctx.env: 339 ctx.msg(msg_check, 'not found (missing avformat)', color = 'YELLOW') 340 elif 'HAVE_AVUTIL' not in ctx.env: 341 ctx.msg(msg_check, 'not found (missing avutil)', color = 'YELLOW') 342 elif 'HAVE_SWRESAMPLE' not in ctx.env and 'HAVE_AVRESAMPLE' not in ctx.env: 343 resample_missing = 'not found (avresample or swresample required)' 344 ctx.msg(msg_check, resample_missing, color = 'YELLOW') 345 else: 346 ctx.msg(msg_check, 'yes') 347 if 'HAVE_SWRESAMPLE' in ctx.env: 348 ctx.define('HAVE_SWRESAMPLE', 1) 349 elif 'HAVE_AVRESAMPLE' in ctx.env: 350 ctx.define('HAVE_AVRESAMPLE', 1) 327 ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1', 328 args = '--cflags --libs', uselib_store = 'AVRESAMPLE', 329 mandatory = ctx.options.enable_avcodec) 330 if all ( 'HAVE_' + i in ctx.env 331 for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ): 351 332 ctx.define('HAVE_LIBAV', 1) 333 ctx.msg('Checking for all libav libraries', 'yes') 334 else: 335 ctx.msg('Checking for all libav libraries', 'not found', color = 'YELLOW') 352 336 353 337 if (ctx.options.enable_wavread != False):
Note: See TracChangeset
for help on using the changeset viewer.