From patchwork Thu Jul 7 09:44:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rishikesh Donadkar X-Patchwork-Id: 16568 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7E0A3BE173 for ; Thu, 7 Jul 2022 09:45:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4A03063315; Thu, 7 Jul 2022 11:45:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657187112; bh=cUgUPITQQWgiPlqqex4TkY/l3u2R4d9+4Lr45jZ1spg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=SBXoerE+mOUk8lub8g4bLeo9L/S0DJoozLhHNqoffDUrZjbGes3DQZ1KQOK2GSnQg IuqrFzhsTZsz3aCdH+vDEqHF2RCXPEI+T2fyVE/vttPQW0CLG673SS8wRFSWVDH6Ec XSJHFoAntHlgN5mupyZNkTwNYDNfbg/mCmm5fxLwbCW7Bgz37GnO01gEBNtEJLeDTj p9arSBDxggNve6rLUn3c6GSRN1O4tNfCQux7EMAdmTP2xjXO9TUot8eFDU57OKy6PS 1jx7w+fdr0mvy5uIR1GF52eOZK78MSpQJqthJYGL89Z6T5D/XswbmPw4DV7eiCxkqM r6Jr2jjZxq3gQ== Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 71AA160401 for ; Thu, 7 Jul 2022 11:45:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jRwf0Eee"; dkim-atps=neutral Received: by mail-pg1-x52d.google.com with SMTP id o18so16312512pgu.9 for ; Thu, 07 Jul 2022 02:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bNl0sT3bbTAE09VbE3LX+X/cDVAeGq77EOfMbHTB+58=; b=jRwf0EeeuLaHONc8psY0Un9w5nT/3H7O+CFqt6k/3CDZASpMsu4h6DWNUBeYCOCkmz GpHs2LjGj9b+N8WAQ+IR7eZGwNfhmUG9VCvrVfhzKKbObPUHExEgoyp/cnBly5rtBm5J yncpjWzJL/EnAG+0ox7JHMVAIzMHhAjkvChvN4g8Gx745boXOsHHgGhN2zUa/pRhv7v2 nRjbxFTcfi/P2ksgpyuELwj3+Z5wy7P5QW0heUlEBgSbkjxmKqXZg7YpVukjLsPAGouQ btaH9ARba1PEWLhBVmqZ0+bIVTMAr3vjswjG7Rh+6NEuVDmYC1CSXIoGA8+Fao9Q5hZZ 6VIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bNl0sT3bbTAE09VbE3LX+X/cDVAeGq77EOfMbHTB+58=; b=OqmEod3BKmwJZF/LNO2nmrQspJ1fAuG6MsNvu6OMwukq5s5Ca2sSN/SrHyWTIn2tjQ 4HxhYReSGl0fxCBNs3qR0IrHF3qP2yQ2G9ZVyAgy8uBeYUkcNe2DFlI0Bqwba1QY775z aCvpbhN2yR5lvqI+BpmYa3q03E2JGu6IdRXEC8hJcYxmF6ipX5Nvn66Yywpr18LPWHiM bFe+ssEenFf5BvOz2TYeOp1H5aBwbvZx5MJwj99CygK3p0L+YnvKyV9ed5fjMBkhsX5l 4Nf/LNpKXKOPNonY3Nz5V9fcGAZ9jyJjgUygRkBMhSQqyOTNO26SroLNKnaFRPVfqvVN IHuw== X-Gm-Message-State: AJIora8Q07Mp9EAEKJ0/U343oH38Zae90v/Sa3nwm7h4Ull6bqP8F4ap FhXxlstROaKyxUwpyZWt4CK/nJGEtRo= X-Google-Smtp-Source: AGRyM1uwvGRUrbaQM/+FQECgO0/C+1CGXLx7pfgllazDZpbOVDfILcvyXWu1vVTMlf1bpF7dwQk3zA== X-Received: by 2002:a63:b443:0:b0:40c:fbf9:8366 with SMTP id n3-20020a63b443000000b0040cfbf98366mr38156353pgu.308.1657187109909; Thu, 07 Jul 2022 02:45:09 -0700 (PDT) Received: from localhost.localdomain ([2402:8100:30ae:d446:13ee:d079:112a:ac10]) by smtp.googlemail.com with ESMTPSA id p2-20020a1709027ec200b00168f08d0d12sm24530712plb.89.2022.07.07.02.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 02:45:09 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 7 Jul 2022 15:14:00 +0530 Message-Id: <20220707094402.28730-3-rishikeshdonadkar@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220707094402.28730-1-rishikeshdonadkar@gmail.com> References: <20220707094402.28730-1-rishikeshdonadkar@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/4] gstreamer: Update the obtained colorimetry in caps. 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-Patchwork-Original-From: Rishikesh Donadkar via libcamera-devel From: Rishikesh Donadkar Reply-To: Rishikesh Donadkar Cc: Rishikesh Donadkar , nicolas.dufresne@collabora.com, vedantparanjape160201@gmail.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" If the colorspace is set in the StreamConfiguration, get the colorimetry as a result of conversion from the previous patch and update it into the caps. If the colorimetry corresponding to the colorspace set in the StreamConfiguration is not available in GStreamer set the colorimetry field to nullptr in the caps (this will fail the negotiation). Signed-off-by: Rishikesh Donadkar --- src/gstreamer/gstlibcamera-utils.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp index 60ac8c8e..eb9c49da 100644 --- a/src/gstreamer/gstlibcamera-utils.cpp +++ b/src/gstreamer/gstlibcamera-utils.cpp @@ -166,11 +166,26 @@ gst_libcamera_stream_configuration_to_caps(const StreamConfiguration &stream_cfg { GstCaps *caps = gst_caps_new_empty(); GstStructure *s = bare_structure_from_format(stream_cfg.pixelFormat); + gchar *colorimetry = nullptr; + std::optional colorspace = stream_cfg.colorSpace; gst_structure_set(s, "width", G_TYPE_INT, stream_cfg.size.width, "height", G_TYPE_INT, stream_cfg.size.height, nullptr); + + if (colorspace) { + colorimetry = colorimerty_from_colorspace(colorspace); + if (colorimetry) { + gst_structure_set(s, "colorimetry", G_TYPE_STRING, colorimetry, nullptr); + } else { + gst_structure_set(s, "colorimetry", G_TYPE_STRING, nullptr, nullptr); + g_free(colorimetry); + } + } else { + g_free(colorimetry); + } + gst_caps_append_structure(caps, s); return caps;