[FFmpeg-devel] AVCodec struct fields (encode function prototype)

Ronald S. Bultje rsbultje
Fri Oct 22 13:35:32 CEST 2010


On Fri, Oct 22, 2010 at 6:25 AM, Dang Le <babyprez at gmail.com> wrote:
> Hi all,
> I'm writing my own codec for ffmpeg.
> I have completed the decoder and it works well thanks to nice explanations
> about the parameters of decode frame function from here:
> http://wiki.multimedia.cx/index.php?title=FFmpeg_codec_HOWTO#libavcodec.2Fcook.c_Decode
> Unfortunately, there's no documentation on the encode frame function
> (parameters & return value) out there.
> Could someone please help me to understand those params?
> The function prototype is:
> int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
> Particularly: buf, buf_size and data. which is the input, which is the
> output?
> Do I have to av_malloc memory for the output or not?

void *data, for video, is a AVFrame *pict which contains uncompressed input.

buf/buf_size is output buffer and max buffer size. The return value of
the function should be the number of bytes actually filled. See also
avcodec_encode_video() and its documentation.


More information about the ffmpeg-devel mailing list