[Ffmpeg-devel] Eliminating some memcpy() & memory allocations from the v4l2 input
Wed Feb 1 16:25:58 CET 2006
> 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
> need the packet anymore, and I am planning to use the destruct()
> of AVPacket for this. Does this usage of AVPacket (and of its
> method) make sense? Or am I misunderstanding its purpose?
You could add some args to av_new_packet(), or an extended version
av_new_packet_dest(void *data, void (*destruct)(void *, void *), void *
and keep the cookie in AVPacket, then call destruct() with both data
So you can pass the fd to ioctl() in the cookie.
More information about the ffmpeg-devel