[libav-api] avcodec_decode_video2 return value

Ronald S. Bultje rsbultje at gmail.com
Mon Apr 18 23:05:06 CEST 2011

Hi Chris,

sorry for the late reply.

On Sat, Mar 26, 2011 at 6:22 PM, Chris Stankevitz
<chrisstankevitz at yahoo.com> wrote:
> Hello,
> I use av_read_frame to fill an AVPacket which is passed to avcodec_decode_video2.
> What do I do when avcodec_decode_video2 returns a value n that is 0 <= n < AVPacket::size?  In this case, should I increment AVPacket::data by n, decrement AVPacket::size by n, and pass the packet back into avcodec_decode_video2?
> I'm used to dealing with this myself with the deprecated avcodec_decode_video.  With the deprecated approach, I controlled my buffer and felt free to things like I described in the prior paragraph.  With the new approach, I'm not sure if I can or should make such changes to AVPacket.

Yes, that is still how it works. That's also how ffmpeg.c and ffplay.c do it.

Kind regards,

More information about the libav-api mailing list