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

Baptiste Coudurier baptiste.coudurier
Sat Jan 31 22:59:56 CET 2009


Hi,

David DeHaven wrote:
>> +    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.

Humm, why not submitting a patch before ?

Besides I did the 2 approaches and you only need at most 2 contexts,
since when you use resampling API, the conversion is done for you.

With the API if you specify S16 output it will only resample once.

Actually ffmpeg.c will not convert in do_audio_out when resampling with
the new api.

Scenarios:

S32 decoding -> S16 resampling -> FLOAT32 output. (2 context)
S32 decoding -> S16 resampling -> S16 output      (1 context)
S16 decoding -> S16 resampling -> FLOAT32 output. (1 context)

Am I missing something ?

> 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.

Yes, definitely, it justs need a volunteer :>
Im only fixing a regression here.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
checking for life_signs in -lkenny... no
FFmpeg maintainer                                  http://www.ffmpeg.org




More information about the ffmpeg-devel mailing list