Re: Zero-copy CameraFile transfer?
Marcus Meissner <[email protected]> Thu, 10 Mar 2022 08:32:33 +0100
| Newsgroups | gmane.comp.multimedia.gphoto.user |
|---|---|
| Message-ID | <YimpkTuPaBZDwzQJ@jet> |
On Wed, Mar 09, 2022 at 07:02:40PM -0800, Dave Taylor wrote: > Hi, I've been looking through the libgphoto2 API for a way to > implement zero-copy transfers such as through Linux's sendfile(2) > system call, but it seems there isn't currently an exposed way to get > at an open CameraFile's file descriptor to pull this off. > > I do see that the CameraFile object has an fd member in it that > gp_file_slurp() references, but the comments say that gp_file_slurp() > is an internal function and that gp_file_open() is now deprecated. > > Is there a cleaner way to do this? Or should I not play with matches? :) If you create a CameraFile from a fd or a handler (gp_file_new_from_fd / gp_file_new_from_handler), it will only use a small local buffer (currently 512kb) to transfer data. gp_file_new() itself would use in-memory storage for the full image. I can take a look to avoid any kind of buffering, not sure if libusb1 allows this. Ciao, Marcus