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

pross at xvid.org pross
Sun Aug 3 04:41:30 CEST 2008


On Sat, Aug 02, 2008 at 07:10:11PM -0700, Baptiste Coudurier wrote:
> Hi,
> 
> 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.

Yes, but that was before I got my hands dirty with sample_fmt.
(See attachments.)

I would prefer to hold-off on adding extra CODEC_PCM_Fxxxx's
until pcm.c is cleaned up. Expect to see a flurry of PCM-related
patches over the next days.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcm64.diff
Type: text/x-diff
Size: 5035 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080803/90b036a9/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcm64-aiff.diff
Type: text/x-diff
Size: 638 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080803/90b036a9/attachment-0001.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcm64-au.diff
Type: text/x-diff
Size: 458 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080803/90b036a9/attachment-0002.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcm64-mov.diff
Type: text/x-diff
Size: 1268 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080803/90b036a9/attachment-0003.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcm64-riff.diff
Type: text/x-diff
Size: 1661 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080803/90b036a9/attachment-0004.diff>
-------------- 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/20080803/90b036a9/attachment.pgp>



More information about the ffmpeg-devel mailing list