Files
opencv-MIRROR/modules/videoio
paneendrakumar0 0a5c96c832 videoio: avoid false-positive unsupported mode warning on capture failure (#26519)
In VideoCapture::open(), PR #22700 added checks to log warnings when a requested
backend cannot perform a capture mode (e.g. capturing by index with CAP_FFMPEG).
However, the condition only tested if (isBackendBuiltIn(apiPreference)), which
evaluates to true for all built-in backends regardless of whether they support the mode.

As a result, whenever a camera or file failed to open (e.g., camera not connected,
invalid camera index, missing or unreadable file), OpenCV emitted false-positive
warnings:
- VIDEOIO(V4L2): backend is generally available but can't be used to capture by index
- VIDEOIO(FFMPEG): backend is generally available but can't be used to capture by name
even though V4L2 and FFMPEG natively support those respective modes.

Track whether apiPreference matches an available backend for the requested mode in
getAvailableBackends_CaptureByIndex, getAvailableBackends_CaptureByFilename, and
getAvailableBackends_CaptureByStream. Only log the warning when the backend is
genuinely absent from the supported list for that mode while being available on the system.

Resolves #26519

Signed-off-by: paneendrakumar0 <paneendra100@gmail.com>
2026-10-21 16:59:39 +05:30
..
2025-09-05 01:00:28 +08:00