From d4eee094e684806dbdb54fbe1bc02c9c590aa7f4 Mon Sep 17 00:00:00 2001 From: Xavier Roumegue Date: Fri, 15 Jul 2022 17:16:07 +0200 Subject: libcamera: pipeline: simple: converter: Handle unsupported input format SimpleConverter::formats() should return an empty vector if the input format is not supported by the converter. Signed-off-by: Xavier Roumegue Reviewed-by: Laurent Pinchart Reviewed-by: Umang Jain Signed-off-by: Laurent Pinchart --- src/libcamera/pipeline/simple/converter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libcamera') diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 77c44fc8..62d173bb 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -220,6 +220,12 @@ std::vector SimpleConverter::formats(PixelFormat input) return {}; } + if (v4l2Format.fourcc != V4L2PixelFormat::fromPixelFormat(input)) { + LOG(SimplePipeline, Debug) + << "Input format " << input << " not supported."; + return {}; + } + std::vector pixelFormats; for (const auto &format : m2m_->capture()->formats()) { -- cgit v1.2.1