Ignore:
Timestamp:
Nov 28, 2016, 6:44:44 PM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler, yinfft+
Children:
cad7e91
Parents:
b81a642
Message:

src/io/source_avcodec.c: use AV_SAMPLE_FMT_DBL when compiling with HAVE_AUBIO_DOUBLE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_avcodec.c

    rb81a642 r2f89ef4  
    6161  AVFrame *avFrame;
    6262  AVAudioResampleContext *avr;
    63   float *output;
     63  smpl_t *output;
    6464  uint_t read_samples;
    6565  uint_t read_index;
     
    206206
    207207  /* allocate output for avr */
    208   s->output = (float *)av_malloc(AUBIO_AVCODEC_MAX_BUFFER_SIZE * sizeof(float));
     208  s->output = (smpl_t *)av_malloc(AUBIO_AVCODEC_MAX_BUFFER_SIZE * sizeof(smpl_t));
    209209
    210210  s->read_samples = 0;
     
    233233
    234234void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s, uint_t multi) {
     235  // create or reset resampler to/from mono/multi-channel
    235236  if ( (multi != s->multi) || (s->avr == NULL) ) {
    236237    int64_t input_layout = av_get_default_channel_layout(s->input_channels);
     
    250251    av_opt_set_int(avr, "out_sample_rate",    s->samplerate,          0);
    251252    av_opt_set_int(avr, "in_sample_fmt",      s->avCodecCtx->sample_fmt, 0);
     253#if HAVE_AUBIO_DOUBLE
     254    av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_DBL,      0);
     255#else
    252256    av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_FLT,      0);
     257#endif
     258    // TODO: use planar?
     259    //av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_FLTP,      0);
    253260    int err;
    254261    if ( ( err = avresample_open(avr) ) < 0) {
Note: See TracChangeset for help on using the changeset viewer.