Hello @raymanfx ,
first of, I want to thank you for creating this crate. Unfortunately I'm wondering about some decisions that you did in this crate.
You implemented an mmap interface where you can queue multiple buffers, but in the way you are using it
images are always only generated once you call io::mmap::stream::dequeue so you will never have images queued up ready to use.
For that to work you need to open the filedescriptor as NONBLOCK.
Also with your current iteration I'm not sure why queue and dequeue are still public as you cannot do anything with them.
You can dequeue a new image, you get a buffer_index but you cannot get the image from this index, as the arena is private
and you don't have any get and get_meta functions anymore. We are currently using it in this way: We run an analysis on an
image, get the next image and skip all images that were asynchronously taken in the meantime (see NONBLOCK above) until we reach the newest image that is available at this time, without waiting for a new one. This isn't possible with the use of the next method. As you will always wait for a new image, regardless of how long it waits. For this to work you also need a method to poll the filedescriptor to you
know if there are images waiting currently.
For the changes we made to do that, you can look at our fork here: https://github.com/HULKs/libv4l-rs/tree/hulksChanges
If you want to, we can come to an understanding on how to integrate these changes properly into your crate. It would be nicer
to have one good v4l wrapper instead of forking and maintaining a second one.
Have a nice day!
Hello @raymanfx ,
first of, I want to thank you for creating this crate. Unfortunately I'm wondering about some decisions that you did in this crate.
You implemented an
mmapinterface where you can queue multiple buffers, but in the way you are using itimages are always only generated once you call
io::mmap::stream::dequeueso you will never have images queued up ready to use.For that to work you need to open the filedescriptor as
NONBLOCK.Also with your current iteration I'm not sure why
queueanddequeueare still public as you cannot do anything with them.You can
dequeuea new image, you get abuffer_indexbut you cannot get the image from this index, as the arena is privateand you don't have any
getandget_metafunctions anymore. We are currently using it in this way: We run an analysis on animage, get the next image and skip all images that were asynchronously taken in the meantime (see NONBLOCK above) until we reach the newest image that is available at this time, without waiting for a new one. This isn't possible with the use of the
nextmethod. As you will always wait for a new image, regardless of how long it waits. For this to work you also need a method to poll the filedescriptor to youknow if there are images waiting currently.
For the changes we made to do that, you can look at our fork here: https://github.com/HULKs/libv4l-rs/tree/hulksChanges
If you want to, we can come to an understanding on how to integrate these changes properly into your crate. It would be nicer
to have one good v4l wrapper instead of forking and maintaining a second one.
Have a nice day!