Linux-Fake-Background-Webcam icon indicating copy to clipboard operation
Linux-Fake-Background-Webcam copied to clipboard

Switching the source webcam on the fly.

Open fangfufu opened this issue 4 years ago • 1 comments

Guus said

"Also, being able to switch webcams on the fly would be great. I normally have my laptop docked and using a nice Logitech C920, but if I'm undocked I'm using the laptop's integrated webcam. Even better if it did this switching automatically :slightly_smiling_face:"

It would be nice if Guus's feature request gets implemented.

fangfufu avatar Jun 28 '21 12:06 fangfufu

This might probably be implemented simalary to the ondemand processing:

  1. Fill a stack with all dev/video* devices that can be found on startup. If the --webcam-path parameter has been supplied, make sure this one gets pushed last. This would probably change the default device. We might want to keep the default behaviour and ensure just ensure webcam_path gets added last. We could also start with a single stack element, the content of the (supplied or default) webcam_path. Start processing with the last evice added. If opening fails, just try the next one.

  2. Monitor for /dev/video* files being added/removed to /dev using inotify. (Filter out the v4l2loopback-path). If a device gets added push it to the stack. If a device gets removed, remove it from the stack

  3. On device change use the last device on the stack for processing. If it fails to open, just use the next one.

Imho this should not be default behaviour, at least there should be a flag to decativate, since we can imagine the use case of wanting a stable device connection. I.e. while attending to a conference one might want to attach another cam for different purposes.

mithrandir42 avatar Jul 05 '21 13:07 mithrandir42