mirror of
https://github.com/opencv/opencv.git
synced 2026-11-19 15:55:28 -06:00
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>