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

pross at xvid.org pross
Sat Jul 26 04:42:26 CEST 2008


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!

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080726/b2fe0277/attachment.pgp>



More information about the ffmpeg-devel mailing list