[FFmpeg-devel] [PATCH] convert to S16 when resampling is requested

David DeHaven dave
Sat Jan 31 19:53:04 CET 2009

> +    AVAudioConvert *convert_ctx[2];
> +    enum SampleFormat sample_fmt; ///< input sample format
> +    unsigned sample_size;         ///< size of one sample in  
> sample_fmt
> +    short *buffer[2];             ///< buffers used for conversion  
> to S16
> +    unsigned buffer_size[2];      ///< sizes of allocated buffers

If you convert back, you could end up with three convert contexts if  
the output format doesn't like S16. I did this with one convert  
context in resample.c and most of the time it doesn't have to convert  
after resampling since the encoder likes S16 anyways.

Ideally, the resampling should be part of the converter. Then you  
could remove the resampling code in ffmpeg.c and simplify the API a bit.


More information about the ffmpeg-devel mailing list