Changeset 808c852 for src


Ignore:
Timestamp:
Apr 10, 2017, 3:26:06 PM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, sampler
Children:
b678858
Parents:
5bd9a2b
Message:

src/io/source_avcodec.c: more fixes for declaration before assignment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_avcodec.c

    r5bd9a2b r808c852  
    289289  // create or reset resampler to/from mono/multi-channel
    290290  if ( (multi != s->multi) || (s->avr == NULL) ) {
     291    int err;
    291292    int64_t input_layout = av_get_default_channel_layout(s->input_channels);
    292293    uint_t output_channels = multi ? s->input_channels : 1;
     
    312313    // TODO: use planar?
    313314    //av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_FLTP,      0);
    314     int err;
    315315#ifdef HAVE_AVRESAMPLE
    316316    if ( ( err = avresample_open(avr) ) < 0) {
     
    349349  SwrContext *avr = s->avr;
    350350#endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
     351  int got_frame = 0;
     352  int ret = 0;
     353#ifdef HAVE_AVRESAMPLE
     354  int in_linesize = 0;
     355  int in_samples = avFrame->nb_samples;
     356  int out_linesize = 0;
     357  int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE;
     358  int out_samples = 0;
     359#elif defined(HAVE_SWRESAMPLE)
     360  int in_samples = avFrame->nb_samples;
     361  int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;
     362  int out_samples = 0;
     363#endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
    351364  smpl_t *output = s->output;
    352365  av_init_packet (&avPacket);
     
    369382  } while (avPacket.stream_index != s->selected_stream);
    370383
    371   int got_frame = 0;
    372384#if FF_API_LAVF_AVCTX
    373   int ret = avcodec_send_packet(avCodecCtx, &avPacket);
     385  ret = avcodec_send_packet(avCodecCtx, &avPacket);
    374386  if (ret < 0 && ret != AVERROR_EOF) {
    375387    AUBIO_ERR("source_avcodec: error when sending packet for %s\n", s->path);
     
    405417
    406418#ifdef HAVE_AVRESAMPLE
    407   int in_linesize = 0;
     419  in_linesize = 0;
    408420  av_samples_get_buffer_size(&in_linesize, avCodecCtx->channels,
    409421      avFrame->nb_samples, avCodecCtx->sample_fmt, 1);
    410   int in_samples = avFrame->nb_samples;
    411   int out_linesize = 0;
    412   int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE;
    413   int out_samples = avresample_convert ( avr,
     422  in_samples = avFrame->nb_samples;
     423  out_linesize = 0;
     424  max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE;
     425  out_samples = avresample_convert ( avr,
    414426        (uint8_t **)&output, out_linesize, max_out_samples,
    415427        (uint8_t **)avFrame->data, in_linesize, in_samples);
    416428#elif defined(HAVE_SWRESAMPLE)
    417   int in_samples = avFrame->nb_samples;
    418   int max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;
    419   int out_samples = swr_convert( avr,
     429  in_samples = avFrame->nb_samples;
     430  max_out_samples = AUBIO_AVCODEC_MAX_BUFFER_SIZE / avCodecCtx->channels;
     431  out_samples = swr_convert( avr,
    420432      (uint8_t **)&output, max_out_samples,
    421433      (const uint8_t **)avFrame->data, in_samples);
Note: See TracChangeset for help on using the changeset viewer.