Changes in / [bad88364:bff692e]


Ignore:
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    rbad88364 rbff692e  
    1111
    1212WAFCMD=python waf
     13WAFURL=https://waf.io/waf-1.9.6
    1314
    1415#WAFOPTS:=
  • python/lib/moresetuptools.py

    rbad88364 rbff692e  
    114114    print("Info: looking for *optional* additional packages")
    115115    packages = ['libavcodec', 'libavformat', 'libavutil', 'libavresample',
     116                'jack',
    116117                'sndfile',
     118                'samplerate',
    117119                'rubberband',
    118120                #'fftw3f',
     
    126128    if 'avcodec' in ext.libraries \
    127129            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)]
     130            and 'avutil' in ext.libraries \
     131            and 'avresample' in ext.libraries:
     132        ext.define_macros += [('HAVE_LIBAV', 1)]
     133    if 'jack' in ext.libraries:
     134        ext.define_macros += [('HAVE_JACK', 1)]
    135135    if 'sndfile' in ext.libraries:
    136136        ext.define_macros += [('HAVE_SNDFILE', 1)]
  • scripts/build_mingw

    rbad88364 rbff692e  
    11#! /bin/bash
    22
    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
    86# On debian or ubuntu, you will want to 'apt-get install gcc-mingw-w64'
    97
     
    119set -x
    1210
    13 source VERSION
    14 VERSION="$AUBIO_MAJOR_VERSION.$AUBIO_MINOR_VERSION.$AUBIO_PATCH_VERSION"
    15 VERSION+="$AUBIO_VERSION_STATUS"
     11WAFOPTS="-v --disable-avcodec --disable-samplerate --disable-jack --disable-sndfile"
    1612
    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
    1915
    20 # define some default CFLAGS
    21 DEF_CFLAGS="-Os -I/usr/share/mingw-w64"
    22 DEF_LDFLAGS=""
     16CFLAGS="-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
    2322
    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*
     23CFLAGS="-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
  • scripts/get_waf.sh

    rbad88364 rbff692e  
    44set -x
    55
    6 WAFURL=https://waf.io/waf-1.9.6
     6WAFURL=https://waf.io/waf-1.8.22
    77
    88( which wget > /dev/null && wget -qO waf $WAFURL ) || ( which curl > /dev/null && curl $WAFURL > waf )
  • src/io/source_avcodec.c

    rbad88364 rbff692e  
    2525#include <libavcodec/avcodec.h>
    2626#include <libavformat/avformat.h>
    27 #if defined(HAVE_SWRESAMPLE)
    28 #include <libswresample/swresample.h>
    29 #elif defined(HAVE_AVRESAMPLE)
    3027#include <libavresample/avresample.h>
    31 #endif
    3228#include <libavutil/opt.h>
    3329#include <stdlib.h>
     
    8177  AVFrame *avFrame;
    8278  AVPacket avPacket;
    83 #ifdef HAVE_AVRESAMPLE
    8479  AVAudioResampleContext *avr;
    85 #elif defined(HAVE_SWRESAMPLE)
    86   SwrContext *avr;
    87 #endif
    8880  smpl_t *output;
    8981  uint_t read_samples;
     
    317309    uint_t output_channels = multi ? s->input_channels : 1;
    318310    int64_t output_layout = av_get_default_channel_layout(output_channels);
    319 #ifdef HAVE_AVRESAMPLE
    320311    AVAudioResampleContext *avr = avresample_alloc_context();
    321312    AVAudioResampleContext *oldavr = s->avr;
    322 #elif defined(HAVE_SWRESAMPLE)
    323     SwrContext *avr = swr_alloc();
    324     SwrContext *oldavr = s->avr;
    325 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
    326313
    327314    av_opt_set_int(avr, "in_channel_layout",  input_layout,           0);
     
    338325    //av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_FLTP,      0);
    339326    int err;
    340 #ifdef HAVE_AVRESAMPLE
    341327    if ( ( err = avresample_open(avr) ) < 0) {
    342 #elif defined(HAVE_SWRESAMPLE)
    343     if ( ( err = swr_init(avr) ) < 0) {
    344 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
    345328      char errorstr[256];
    346329      av_strerror (err, errorstr, sizeof(errorstr));
     
    352335    s->avr = avr;
    353336    if (oldavr != NULL) {
    354 #ifdef HAVE_AVRESAMPLE
    355337      avresample_close( oldavr );
    356 #elif defined(HAVE_SWRESAMPLE)
    357       swr_close ( oldavr );
    358 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
    359338      av_free ( oldavr );
    360339      oldavr = NULL;
     
    370349  AVPacket avPacket = s->avPacket;
    371350  av_init_packet (&avPacket);
    372 #ifdef HAVE_AVRESAMPLE
    373351  AVAudioResampleContext *avr = s->avr;
    374 #elif defined(HAVE_SWRESAMPLE)
    375   SwrContext *avr = s->avr;
    376 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
    377352  smpl_t *output = s->output;
    378353  *read_samples = 0;
     
    427402  }
    428403
    429 #ifdef HAVE_AVRESAMPLE
    430404  int in_linesize = 0;
    431405  av_samples_get_buffer_size(&in_linesize, avCodecCtx->channels,
     
    437411        (uint8_t **)&output, out_linesize, max_out_samples,
    438412        (uint8_t **)avFrame->data, in_linesize, in_samples);
    439 #elif defined(HAVE_SWRESAMPLE)
    440   int in_samples = avFrame->nb_samples;
    441   int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;
    442   int out_samples = swr_convert( avr,
    443       (uint8_t **)&output, max_out_samples,
    444       (const uint8_t **)avFrame->data, in_samples);
    445 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
    446413  if (out_samples <= 0) {
    447414    AUBIO_WRN("source_avcodec: no sample found while converting frame (%s)\n", s->path);
     
    455422  s->avCodecCtx = avCodecCtx;
    456423  s->avFrame = avFrame;
    457 #if defined(HAVE_AVRESAMPLE) || defined(HAVE_SWRESAMPLE)
    458424  s->avr = avr;
    459 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
    460425  s->output = output;
    461426
     
    566531  s->read_index = 0;
    567532  s->read_samples = 0;
    568 #ifdef HAVE_AVRESAMPLE
    569533  // reset the AVAudioResampleContext
    570534  avresample_close(s->avr);
    571535  avresample_open(s->avr);
    572 #elif defined(HAVE_SWRESAMPLE)
    573   swr_close(s->avr);
    574   swr_init(s->avr);
    575 #endif
    576536  return ret;
    577537}
     
    587547uint_t aubio_source_avcodec_close(aubio_source_avcodec_t * s) {
    588548  if (s->avr != NULL) {
    589 #ifdef HAVE_AVRESAMPLE
    590549    avresample_close( s->avr );
    591 #elif defined(HAVE_SWRESAMPLE)
    592     swr_close ( s->avr );
    593 #endif
    594550    av_free ( s->avr );
    595551  }
  • src/utils/windll.c

    rbad88364 rbff692e  
    4242#include "aubio.h"
    4343
    44 BOOL APIENTRY DllMain( HMODULE hModule UNUSED,
     44BOOL APIENTRY DllMain( HMODULE hModule,
    4545                       DWORD  ul_reason_for_call,
    46                        LPVOID lpReserved UNUSED)
     46                       LPVOID lpReserved )
    4747{
    4848  switch (ul_reason_for_call)
  • src/wscript_build

    rbad88364 rbff692e  
    99uselib += ['AVCODEC']
    1010uselib += ['AVFORMAT']
    11 uselib += ['SWRESAMPLE']
    1211uselib += ['AVRESAMPLE']
    1312uselib += ['AVUTIL']
  • wscript

    rbad88364 rbff692e  
    339339                args = '--cflags --libs', uselib_store = 'AVUTIL',
    340340                mandatory = ctx.options.enable_avcodec)
    341         ctx.check_cfg(package = 'libswresample', atleast_version = '2.3.0',
    342                 args = '--cflags --libs', uselib_store = 'SWRESAMPLE',
    343                 mandatory = False)
    344         if 'HAVE_SWRESAMPLE' not in ctx.env:
    345             ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1',
    346                     args = '--cflags --libs', uselib_store = 'AVRESAMPLE',
    347                     mandatory = False)
    348 
    349         msg_check = 'Checking for all libav libraries'
    350         if 'HAVE_AVCODEC' not in ctx.env:
    351             ctx.msg(msg_check, 'not found (missing avcodec)', color = 'YELLOW')
    352         elif 'HAVE_AVFORMAT' not in ctx.env:
    353             ctx.msg(msg_check, 'not found (missing avformat)', color = 'YELLOW')
    354         elif 'HAVE_AVUTIL' not in ctx.env:
    355             ctx.msg(msg_check, 'not found (missing avutil)', color = 'YELLOW')
    356         elif 'HAVE_SWRESAMPLE' not in ctx.env and 'HAVE_AVRESAMPLE' not in ctx.env:
    357             resample_missing = 'not found (avresample or swresample required)'
    358             ctx.msg(msg_check, resample_missing, color = 'YELLOW')
    359         else:
    360             ctx.msg(msg_check, 'yes')
    361             if 'HAVE_SWRESAMPLE' in ctx.env:
    362                 ctx.define('HAVE_SWRESAMPLE', 1)
    363             elif 'HAVE_AVRESAMPLE' in ctx.env:
    364                 ctx.define('HAVE_AVRESAMPLE', 1)
     341        ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1',
     342                args = '--cflags --libs', uselib_store = 'AVRESAMPLE',
     343                mandatory = ctx.options.enable_avcodec)
     344        if all ( 'HAVE_' + i in ctx.env
     345                for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ):
    365346            ctx.define('HAVE_LIBAV', 1)
     347            ctx.msg('Checking for all libav libraries', 'yes')
     348        else:
     349            ctx.msg('Checking for all libav libraries', 'not found', color = 'YELLOW')
    366350
    367351    if (ctx.options.enable_wavread != False):
Note: See TracChangeset for help on using the changeset viewer.