On Thu, 18 Dec 2008 05:39:08 -0500, Stefan Klug <[email protected]> wrote:
> Hi,
>
> I'm trying to understand avcodec_decode_video.
> In particular I'd like to know if I can store the filled frame in a
> queue and decode further frames.
[...]
> I ask because avcodec_alloc_frame() just allocates the struct but not
> the data array. So avcodec_decode_video has to allocate the memory. Is
> that allocation done from a static buffer, which would mean I have to
> copy the frame?

Depends on the codec.  Some codecs allocate each frame, others return  
frames from an allocated pool, and some codecs do all their operations on  
a single frame.  The contract is that you must use the frame before the  
next call to decode, and that you must free the frame as well, so the  
codec can use whichever method it likes to manage memory.

> If its an internal buffer, is there some way to quarantee for example,
> that I can store at least n AVFrames until the first one gets  
> overwritten?

There is another option, mentioned by Michael Niedermayer in  
http://lists.mplayerhq.hu/pipermail/libav-user/2008-August/001215.html
If the codec supports CODEC_CAP_DR1, you can use a custom buffer  
allocation function, and hold onto the frame after the codec frees it,  
until you've used it, then actually free it or return it to a pool where  
your 'get' function allocates from.

-- 
Michael Conrad
IntelliTree Solutions llc.
513-552-6362
[email protected]
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to