Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disambiguate cameras with same product/vendor ids (issue #59) #60

Merged
merged 2 commits into from
May 5, 2022

Conversation

jazzychad
Copy link
Contributor

Fix issue where AVCaptureDevice.usbDevice() would return a USBDevice
pointing to the wrong camera if multiple cameras with the same product
id and vendor id are attached to the computer.

The new approach is to use an iterator to lookup the cameras with the
given vendor and product ids, and then loop through the results and
match against their property dictionaries against the
avDevice.localizedName since that seems to be the only reliable way to
disambiguate between different cameras with otherwise similar
properties.

Fix issue where `AVCaptureDevice.usbDevice()` would return a USBDevice
pointing to the wrong camera if multiple cameras with the same product
id and vendor id are attached to the computer.

The new approach is to use an iterator to lookup the cameras with the
given vendor and product ids, and then loop through the results and
match against their property dictionaries against the
avDevice.localizedName since that seems to be the only reliable way to
disambiguate between different cameras with otherwise similar
properties.
@jazzychad
Copy link
Contributor Author

There may be a better approach to solve this issue, but this is one that I came up with that works in my situation.

I am happy to hear other ideas about how to solve this.

@Itaybre
Copy link
Owner

Itaybre commented May 4, 2022

I was going to tell you about using a function, but seems like you already did that :)

Looks good, I am not on my machine, but I try it once I get it

@Itaybre
Copy link
Owner

Itaybre commented May 5, 2022

Seems to be working fine, merging

@Itaybre Itaybre merged commit 73d2c1c into Itaybre:master May 5, 2022
@Itaybre Itaybre modified the milestones: 1.3, 1.4.0 May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants