I'm thinking about using this for a baby monitor, and I don't need the camera on the whole time. I also have single-client access.
So my idea was to only access the camera when a client is connected.
I tried playing with it a bit and I naively thought that creating/destroying the camera thread inside elif on line 145 would do, but of course the fd needs to be closed/reopened, and it doesn't work like that. Also, closing it is not so simple because it would need to signal the main_loop to stop, wait for it to stop using the device file, and then close it.
Any thoughts on how I could approach this? Or would you consider offering a "disconnect camera when no user is connected" (which is probably much simpler for single-client use)?
I'm thinking about using this for a baby monitor, and I don't need the camera on the whole time. I also have single-client access.
So my idea was to only access the camera when a client is connected.
I tried playing with it a bit and I naively thought that creating/destroying the camera thread inside
elif
on line 145 would do, but of course the fd needs to be closed/reopened, and it doesn't work like that. Also, closing it is not so simple because it would need to signal the main_loop to stop, wait for it to stop using the device file, and then close it.Any thoughts on how I could approach this? Or would you consider offering a "disconnect camera when no user is connected" (which is probably much simpler for single-client use)?
Thanks