> +    /* the codec gives us the frame size, in samples,
> +     * we calculate the size of the samples buffer in bytes */
> +    buffer_size = av_samples_get_buffer_size(NULL, c->channels, 
> c->frame_size,
> +                                             c->sample_fmt, 0);
> +    samples = av_malloc(buffer_size);
> +    if (!samples) {
> +        fprintf(stderr, "could not allocate %d bytes for samples buffer\n",
> +                buffer_size);
> +        exit(1);
> +    }
> +    /* setup the data pointers in the AVFrame */
> +    ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt,
> +                                   (const uint8_t*)samples, buffer_size, 0);
> +    if (ret < 0) {
> +        fprintf(stderr, "could not setup audio frame\n");
> +        exit(1);
> +    }

Is this hunk not the same as av_samples_alloc?
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to