blackjack / webcam

Golang webcam library for Linux
MIT License
411 stars 90 forks source link

Add support for unbuffered streaming #54

Open DerZombiiie opened 1 year ago

DerZombiiie commented 1 year ago

When using uncompressed formats its impossible to use the library on devices with little ram. E.g. a Raspberry Pi

bazile-clyde commented 1 year ago

We (gostream) also need support for an unbuffered stream, though, for different reasons. We depend on mediadevices which in turn depends on this library for its linux implementation (see camera_linux.go). mediadevices calls camera.SetBufferCount(1) when opening a camera and later camera.ReadFrame() to get a frame from that camera. Because camera.ReadFrame() returns the last frame in the buffer we always get a stale image. Setting camera.SetBufferCount(2) gives us two stale frames and so forth. Is there currently a way to get the current frame from camera.ReadFrame() rather than a previously buffered image?