Skip to content

Accessing Cameras with the Same Name #1927

Open
@mahyarmirrashed

Description

@mahyarmirrashed

Environment:

  • Operating system (e.g. Windows, Linux(Debian), Linux(Ubuntu), Mac): Windows 11
  • Python version (e.g. 3.7.9, 3.8.5) : 3.8.16
  • SDL version (e.g. SDL 2.0.12): 2.26.3
  • PyGame version (e.g. 2.0.0.dev10, 1.9.6): 2.1.3
  • Relevant hardware (e.g. if reporting a bug about a controller, tell us the brand & name of it): Not necessary.

Current behavior:

I have three web cameras (from the same manufacturer) connected to my USB C dock.

image

I create a sample program:

>>> import pygame
pygame 2.1.3 (SDL 2.26.3, Python 3.8.16)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> import pygame.camera
>>> pygame.init()
(5, 0)
>>> pygame.camera.init()
>>> pygame.camera.list_cameras()
['PC Camera', 'PC Camera', 'HP Wide Vision HD Camera', 'PC Camera']

This is annoying. They are all listed as "PC Camera". Therefore, there is no way to access any individual camera, afaik.

Expected behavior:

It would be different if these were named tuples with an option that distinguishes them by their ID.

e.g.

>>> pygame.camera.list_cameras()
[CameraSource(name="PC Camera", uuid=""), etc.]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot working as intendedcamerapygame.camera

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions