From patchwork Tue Mar 17 03:52:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 3135 Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D9D662928 for ; Tue, 17 Mar 2020 04:53:38 +0100 (CET) X-Halon-ID: db0c5851-6802-11ea-aa6d-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de [79.202.35.146]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id db0c5851-6802-11ea-aa6d-005056917f90; Tue, 17 Mar 2020 04:53:26 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 17 Mar 2020 04:52:35 +0100 Message-Id: <20200317035239.2697679-5-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200317035239.2697679-1-niklas.soderlund@ragnatech.se> References: <20200317035239.2697679-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/8] libcamera: pipeline: uvcvideo: Translate from V4L2 to DRM pixel formats X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2020 03:53:39 -0000 When generating a camera configuration pixel formats directly from the video device are used that contains V4L2 pixel formats. Translate the pixel formats to DRM before using them i the camera configuration. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/uvcvideo.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index 320da2685795c041..14f7ddb18a765834 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -154,7 +154,14 @@ CameraConfiguration *PipelineHandlerUVC::generateConfiguration(Camera *camera, return config; ImageFormats v4l2formats = data->video_->formats(); - StreamFormats formats(v4l2formats.data()); + std::map> deviceformats; + for (const auto &it : v4l2formats.data()) { + PixelFormat pixelformat = V4L2VideoDevice::toPixelFormat(it.first); + const std::vector &ranges = it.second; + deviceformats[pixelformat] = ranges; + } + + StreamFormats formats(deviceformats); StreamConfiguration cfg(formats); cfg.pixelFormat = formats.pixelformats().front();