[Ffmpeg-devel] Eliminating some memcpy() & memory allocations from the v4l2 input

Michael Niedermayer michaelni
Wed Feb 1 17:12:24 CET 2006


Hi

On Wed, Feb 01, 2006 at 04:25:58PM +0100, Fran?ois Revol wrote:
> > So, my idea is to avoid dinamically allocating the memory for the
> > packet, and to set pkt->data = <pointer to buffer returned by
> > VIDIOC_DQBUF>. VIDIOC_QBUF will be called only when libavformat does
> > not
> > need the packet anymore, and I am planning to use the destruct()
> > method
> > of AVPacket for this. Does this usage of AVPacket (and of its
> > destruct()
> > method) make sense? 

yes


> Or am I misunderstanding its purpose?
> 
> You could add some args to av_new_packet(), 

no not without forking :)


> or an extended version
> like:
> av_new_packet_dest(void *data, void (*destruct)(void *, void *), void *
> cookie);
> 
> and keep the cookie in AVPacket, then call destruct() with both data
> and cookie.
> So you can pass the fd to ioctl() in the cookie.

well, yes thats possible but why would we want that extra layer? is there
some advatge i dont see?

[...]

-- 
Michael





More information about the ffmpeg-devel mailing list