[FFmpeg-devel] [PATCH+RFC] AVFrame for audio
Aurelien Jacobs
aurel
Sun Jul 11 14:48:22 CEST 2010
On Sun, Jul 11, 2010 at 11:12:56AM +0100, M?ns Rullg?rd wrote:
> Peter Ross <pross at xvid.org> writes:
>
> > Hi,
> >
> > To prototype use of audio in AVFrame, I have modified the PCM encoder/decoder
> > and addded new public lavc functions.
>
> Nice work.
Indeed !
> > +/**
> > + * Encode an audio frame from samples into buf.
> > + *
> > + * @param avctx the codec context
> > + * @param[out] buf the output buffer
> > + * @param[in] buf_size the output buffer size
> > + * @param[in] frame the input buffer containing the samples
> > + * @return On error a negative value is returned, on success zero or the number
> > + * of bytes used to encode the data read from the input buffer.
> > + */
> > +int avcodec_encode_audio2(AVCodecContext *avctx, uint8_t *buf, int buf_size,
> > + const AVFrame *frame);
>
> At some point, we should do something about the output buffer
> allocation too. Currently, a ridiculous size is allocated in ffmpeg.c
> just to be on the safe side.
And maybe we should ouptut to a AVPacket. It would sound more logical to
me and would be symmetrical to decode. But this is not related to patch,
and shouldn't hold it.
> > #if CONFIG_ENCODERS
> > #define PCM_ENCODER(id,sample_fmt_,name,long_name_) \
> > AVCodec name ## _encoder = { \
> > @@ -470,7 +484,7 @@ AVCodec name ## _decoder = { \
> > sizeof(PCMDecode), \
> > pcm_decode_init, \
> > NULL, \
> > - NULL, \
> > + pcm_decode_close, \
>
> I recommend using designated initialisers for any changes to these
> structs. It's so much easier to read that way.
I agree. I think it would be more readable to use designated
initializers in all _decoder, _encoder, _muxer,... structs.
Aurel
More information about the ffmpeg-devel
mailing list