- Implemented CameraSettingsDialog to manage UVC and Qt camera controls. - Integrated UVC parameter sliders and auto controls for brightness, contrast, saturation, hue, sharpness, gamma, white balance, backlight compensation, and exposure. - Added functionality to change white balance and exposure settings via Qt controls. - Updated MainWindow to open CameraSettingsDialog and manage UVC controller lifecycle. - Enhanced AppMenuBar to include a Camera Settings option. - Created tests for UVC controller abstraction layer and parameter info. - Documented camera specifications and supported features in new markdown files.
49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
"""UVC camera controls — platform-aware factory."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
import platform
|
|
|
|
from app.camera.uvc.base import UvcControllerBase, UvcParam, UvcParamInfo
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def make_uvc_controller(device_name: str) -> UvcControllerBase:
|
|
"""
|
|
Return the best available UVC controller for the current platform.
|
|
|
|
Falls back to NullUvcController if the required native library is absent.
|
|
"""
|
|
system = platform.system()
|
|
|
|
if system == "Windows":
|
|
try:
|
|
from app.camera.uvc.windows import WindowsUvcController # noqa: PLC0415
|
|
ctrl = WindowsUvcController(device_name)
|
|
logger.info("UVC: Windows controller (duvc-ctl) loaded for '%s'", device_name)
|
|
return ctrl
|
|
except ImportError:
|
|
logger.warning(
|
|
"UVC: duvc-ctl not installed — install with: pip install duvc-ctl"
|
|
)
|
|
elif system == "Darwin":
|
|
try:
|
|
from app.camera.uvc.macos import MacUvcController # noqa: PLC0415
|
|
ctrl = MacUvcController(device_name)
|
|
logger.info("UVC: macOS controller loaded for '%s'", device_name)
|
|
return ctrl
|
|
except ImportError:
|
|
logger.warning(
|
|
"UVC: pyuvc not installed — UVC controls unavailable on macOS"
|
|
)
|
|
else:
|
|
logger.warning("UVC: platform '%s' not supported — controls unavailable", system)
|
|
|
|
from app.camera.uvc.stub import NullUvcController # noqa: PLC0415
|
|
return NullUvcController()
|
|
|
|
|
|
__all__ = ["make_uvc_controller", "UvcControllerBase", "UvcParam", "UvcParamInfo"]
|