[Ffmpeg-devel] Eliminating some memcpy() & memory allocationsfrom the v4l2 input (original) (raw)
Luca Abeni lucabe72
Thu Feb 2 10:31:17 CET 2006
- Previous message: [Ffmpeg-devel] Eliminating some memcpy() & memory allocations from the v4l2 input
- Next message: [Ffmpeg-devel] Eliminating some memcpy() & memory allocationsfrom the v4l2 input
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Michael,
On Wed, 2006-02-01 at 17:12 +0100, Michael Niedermayer wrote: [...]
> > VIDIOCQBUF 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 Thanks for confirming
> Or am I misunderstanding its purpose? > > You could add some args to avnewpacket(),
no not without forking :) Of course I do not want to fork :) My goal is to implement this feature without modifying the libavformat infrastructure.
> or an extended version > like: > avnewpacketdest(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? I guess Fran?ois does not like these parts of my patch:
pkt->priv = (void *)((res & 0xFF) | ((s->fd & 0xFFFFFF) << 8));
buf.index = (int)pkt->priv & 0xFF;
fd = (int)pkt->priv >> 8;
This was just a quick hack to get things working in a short time.
- I think on some architectures there might be problems casting int to void*, but the C standard probably defines an int type that can be casted to pointers (going to search for it...).
- The "res & 0xFF" and "buf.index = (int)pkt->priv & 0xFF" part is safe if I change desired_video_buffers to 255
- There still is a problem if s->fd > (2 << 24) - 1, but I hope I can reasonably assume this will not happen? I'll add a check anyway.
Or do you think it is better to define a struct buffer_descriptor{ int fd; int index; }; and to use pkt->priv as a pointer to it?
Thanks,
Luca
-- _____________________________________________________________________________ Copy this in your signature, if you think it is important: N O W A R ! ! !
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor: Vinci con Suzi Wan: sfida la sorte, in palio ben 2 wok al giorno!
* Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4722&d=2-2
- Previous message: [Ffmpeg-devel] Eliminating some memcpy() & memory allocations from the v4l2 input
- Next message: [Ffmpeg-devel] Eliminating some memcpy() & memory allocationsfrom the v4l2 input
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]