[FFmpeg-devel] [PATCH] QCELP decoder

Baptiste Coudurier baptiste.coudurier
Sat Oct 4 03:46:28 CEST 2008


Kenan Gillet wrote:
> Hi,
> 
> On Oct 3, 2008, at 4:43 PM, Baptiste Coudurier wrote:
> 
>> Hi,
>>
>> Kenan Gillet wrote:
>>> [...]
>>>
>>> +*/
>>> +static int qcelp_decode_init(AVCodecContext *avctx) {
>>> +    QCELPContext *q = avctx->priv_data;
>>> +    int          i;
>>> +
>>> +    if (avctx->sample_rate != 8000) {
>>> +        if (avctx->sample_rate == 22050 ||
>>> +            avctx->sample_rate == 11025) {
>>> +            av_log(avctx, AV_LOG_WARNING,
>>> +                   "Unofficial samplerate %d, but supported by  
>>> Quicktime.", avctx->sample_rate);
>>> +        } else {
>>> +            av_log(avctx, AV_LOG_WARNING,
>>> +                   "Unsupported samplerate %d, resampling.", avctx- 
>>>> sample_rate);
>>> +            avctx->sample_rate= 8000;
>>> +        }
>>> +    }
>> It seems the qualcomm quicktime decoder supports more sampling rate  
>> than
>> these:
>> http://sketchup.google.com/gsu6vtvideos.html
>>
>> Some are 24 khz, and it seems decoder kinda works with these files.
>>
>> [...]
> 
> It seems that setting the sample_rate in AVCodecContext
> from the qcelp_decode_init function has no effect on how
> FFmpeg 'sees' the sample_rate.

There is atm some asynchronous behaviour, because decoder is not inited
before infos are printed.

> That explains why the 24khz sample kinda works ;)
>
> Is it the expected behavior ?

It seems you have to _not_ set it to 8000 hz to get correct synced sound.

> If it is, it seems the only place to change the sample_rate in
> AVCodecContext is to do it in libavcodec/mov.c.
> 
> Until now, all the files I came across had a valid sample_rate,
> so maybe we can just drop this check and warning.

In this case, you must not change the sample rate to 8000, you must let
it to 24 khz like quicktime does and plays correctly, otherwise you get
distorted sound.

[...]

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc.                                http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA




More information about the ffmpeg-devel mailing list