The current OpenCV capture class has 2 minor issues
it casts the device id to int immediately, which is then tested for truthiness in main.py (because for window capture, it represents the window ID), but openCV device ID can be 0, which is falsy
Casting to int implies the user only uses openCV for local device capture. However OpenCV supports many string-based identifier, like stream URLs.
This PR:
delays the casting to int: the opencv id is kept as string initially, so it is truthy even if it's '0'
handles casting failure and passes the opencv ID as-is.
2) above means that a casting failure is treated as the user passing a stream on purpose rather than being a mistake.
The current OpenCV capture class has 2 minor issues
int
immediately, which is then tested for truthiness inmain.py
(because for window capture, it represents the window ID), but openCV device ID can be0
, which is falsyThis PR:
int
: the opencv id is kept as string initially, so it is truthy even if it's'0'
2) above means that a casting failure is treated as the user passing a stream on purpose rather than being a mistake.
On real mistakes, openCV itself will complain.