From patchwork Wed Jul 6 08:00:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rishikesh Donadkar X-Patchwork-Id: 16554 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 C789FBE173 for ; Wed, 6 Jul 2022 08:01:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 93B9363313; Wed, 6 Jul 2022 10:01:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657094470; bh=urL573M7ZJB65es0bfiX8bMi9EWtxAR4MosajrRkJg0=; 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=3fH+bwpFXGwoHxw+lW9OKGlM9oHyJg45C6y1sy/JDkCD03kQwbHfR0KoRDtoASAoU opCYFeLp0c0xso1VQMe5/DNRYGPpmVy5fkZVhcvZJEyIXjW/aMzpwWtph3w7Nbjs4P pIg3fOK656Q6T7cOJ8AJQCcBBszNn9b7lvV/dpkU/hKkVis7Hv6qyJZ79826ti/YZV uiJRUYrcKemubw0oBxkkI/vZ3fI+/BHLqIIdpWNKxzEefbd54hga5gaNqbrN00nFP1 FH3kHbZ2e3tYxcuHlURL3sWIdgnkRPzde238x5Mp+S+Ocwy3HjN4mKDXQCDTN0mwVJ 9avi+2uZ3KDDA== Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A75A60400 for ; Wed, 6 Jul 2022 10:01:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Wc/bHTPu"; dkim-atps=neutral Received: by mail-pg1-x52b.google.com with SMTP id bf13so357657pgb.11 for ; Wed, 06 Jul 2022 01:01:09 -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=OGXpw4fZPKOP+bWSilv5kaumz+JHKfmnJqHFwEvTFys=; b=Wc/bHTPuTRS4mLtBB/4ON9OwaZ/7q/yWMWO35dmuPGmbe1N3bnaBVBjkKvrzPoJ5x3 Fha3tfW8n/dOGbI1LGadVCs0rUS9c6VGbMdDRdD0ya0hLz6pNncu0p6Ex94L/Hv+UZrn rG8erzf8cjbdzFuJ9WAKBwtlWGpwkeTygCZCn7gR3P3yiCsEVyonNiTFG5n5S6IXKVwt d2c6T2Y839tIA8vzvMiLGyHGEQ9JOE1AUvG1akXb2HdS+LpfQq0Tj3eTOtTDX+eY5zgd QKsDrgO/g1bTAU/VQNGmE5wsnc9AWRQ/WwGHgdXGTBnzVlojPmGtnxVRrG9j345GReJi datQ== 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=OGXpw4fZPKOP+bWSilv5kaumz+JHKfmnJqHFwEvTFys=; b=Tqz5+WZXnCtKUzw/ghykZfBx5cOlXM2XJ4Yz0d98fT/YL2m2N6sqZFWvnpfBkwWxNP pnL5dMOZlaicXRMRDf4dinNtx1XlwL/Vh6nhBS+bbp9JMMAI7m4zQrKyZSfte/wrKg4p EM/B5DJPqJofVdmSqL8z6MtKrn8n8lTWOVWxKAkzLE4kdAEbJk6FkvGfqhg8phWSH5uh hsMb3d7QpDoh2GXDqnbpoyiuovpQYTAVhHiGXzEQmt0lFCHmaPjxm7FCM6k0s/vrcZHL monfMNLDYFyQHN93/IFkgFPBqe+GJvLwT6POas4xt5DyiihvBSL4p8hrjOZD1jL58DUn y5pA== X-Gm-Message-State: AJIora8ESoT3yT0SSZqoYeCcvya8/A3w/TwWTUa86fAcKvFIsNHbrVFD hxPquQCwEdW3oS0NoFvN9STK2Hh1s7Y= X-Google-Smtp-Source: AGRyM1v6goG8wCq1TDXoBSfdg3gcwPIO4jVkmFYvSw4JUEkCMlauibo037PwHYKixHM7eJPgMQHJUw== X-Received: by 2002:a63:f256:0:b0:40d:5509:2126 with SMTP id d22-20020a63f256000000b0040d55092126mr32435147pgk.566.1657094467631; Wed, 06 Jul 2022 01:01:07 -0700 (PDT) Received: from localhost.localdomain ([103.124.170.117]) by smtp.googlemail.com with ESMTPSA id b16-20020a170903229000b001696751796asm25013049plh.139.2022.07.06.01.01.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:01:07 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 6 Jul 2022 13:30:30 +0530 Message-Id: <20220706080030.30929-2-rishikeshdonadkar@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220706080030.30929-1-rishikeshdonadkar@gmail.com> References: <20220706080030.30929-1-rishikeshdonadkar@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/5] 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. Signed-off-by: Rishikesh Donadkar --- src/gstreamer/gstlibcamera-utils.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp index 60ac8c8e..c155dd0c 100644 --- a/src/gstreamer/gstlibcamera-utils.cpp +++ b/src/gstreamer/gstlibcamera-utils.cpp @@ -166,11 +166,23 @@ 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 { + g_free(colorimetry); + } + gst_caps_append_structure(caps, s); return caps;