[FFmpeg-devel] [RFC] lavc/ffmpeg sample_fmt implementation

Baptiste Coudurier baptiste.coudurier
Sun Aug 3 04:10:11 CEST 2008


pross at xvid.org wrote:
> On Fri, Jul 25, 2008 at 11:32:33PM +0200, Michael Niedermayer wrote:
>> On Sat, Jul 26, 2008 at 01:08:09AM +1000, pross at xvid.org wrote:
>>> Hi.
>>> This patch adds sample_fmt conversion support to lavc (and ffmpeg).
>>> The sample_fmt behavior is modelled on pix_fmt. Codecs will need minor
>>> modification to support sample_fmt correctly. Namely, decoders need to
>>> report their output sample format, and encoders validate the input sample
>>> format (or publish a list of supported formats via the AVCodec struct).
>>> The PCM codecs are modified in this patch, and the more useful ones have
>>> been tested.
>> First id like to say that iam very happy that someone is finally working
>> on the sample_fmt issue :)
>> now the review ...
>>> +        if (av_audio_convert(NULL, obuf, ostride, enc->sample_fmt,
>>> +                                   ibuf, istride, dec->sample_fmt, len)<0) {
>> this definitly needs a context, otherwise we might end in a situation
>> similar to the current swscale vs. img convert. That is a future context
>> based converter would require its context to be created and destroyed
>> on each such call to emulate the API ...
> Would something like this suffice?
> struct AVAudioConvert;
> struct AVAudioConvert *av_audio_convert_alloc(SampleFormat in_fmt, SampleFormat out_fmt, int dsp_mask);
> void av_audio_convert_free(AVAudioConvert *acvt);
> void av_audio_convert(AVAudioContext *avct,
>                       void *out[6], int out_stride[6],
>                        void *in[6], int in_stride[6], int len);
>> [...]
>>>  int av_audio_convert(void *maybe_dspcontext_or_something_av_convert_specific,
>>>                       void *out[6], int out_stride[6], enum SampleFormat out_fmt,
>>>                       void * in[6], int  in_stride[6], enum SampleFormat  in_fmt, int len){
>>>      int ch;
>>> +//FIXME: size calculation will break when SAMPLE_FMT_DBL is added...
>> double, hmm
>> i wouldnt waste time with that ...
> Consider it already wasted!

Did you already implement float64/double ?
Im adding support for fl32/64 little and big endian in .mov.

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

More information about the ffmpeg-devel mailing list