From patchwork Mon Jul 11 15:37:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rishikesh Donadkar X-Patchwork-Id: 16592 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 CD146BE173 for ; Mon, 11 Jul 2022 15:38:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8F1BC6330F; Mon, 11 Jul 2022 17:38:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657553913; bh=kULF7VbtYaBkYNMW7DM8pQM1bmJ1OtrgmprKdtBkR1M=; 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=oHVdDBHv4nSSPlTC/bW2wAMIrAh3XGBTyDd9KnE80bAtFh+h2P8oOFR9EtDZ3WMU2 5Y9MfT9vEFhSVXCiKe6WAPGmzV55H7O+AnyAWpMHeQ0d2jx4sagYbiUx7pPe+EBtgD NIlPhbIqNCEy98OgD0FkaeVD3hqylPOkBMYQToNbXFszXBOrtHXP/jE6TU+tj4BZK/ asVMEtojr84TqW50J8EWWe5BwahuokIQ3KgY7C+/B4Hnb99VQEfM528AernrfuvOHy x6chcIw2tn+ciV+hgi0FZSrmnwHQCD6+ZkjuFYTla967VvecECu145/JTEGEvduwy/ z9TIqaBbg5Ang== Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 247506330B for ; Mon, 11 Jul 2022 17:38:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JBFNrrpg"; dkim-atps=neutral Received: by mail-pl1-x632.google.com with SMTP id z1so4758503plb.1 for ; Mon, 11 Jul 2022 08:38:32 -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=OaNc6z+asGLANI8tRcf6ua0YOq+0JYVVlhWAGFupSDY=; b=JBFNrrpgpoTJDZgARMKOkt68W8MQBXcna5bBPf41U7yQwYocH3brC6XbDe2l4m5fL4 hArYGmLU/WgUlYol+j6CyaQXIByRlpmY8QsOea6plHN0xbIEcMni80VcHM4psSbyccSB 5LtJzwjHD6dOkc1WCltmW6/Pkp7OHaaI46owtHcNsrSLDYuaE2j3eTzTF2Cy3XTQNJBl E55hFcjbifpKvix6eAwcdXt41XwJDdZjy0TD7eY7adNp6UHaJQdyN3swEAkrytoGliPR b39Hnmf/rwdkmkKeIhH43l9sZf+vm7GnmVaI+xt11WyHtP9j+ovk8nKe829OChApXp+9 4iag== 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=OaNc6z+asGLANI8tRcf6ua0YOq+0JYVVlhWAGFupSDY=; b=3vOr6LqZzJvG4N5Tg34x3SpwG/MV0Hn9phqWpBi6Ij6ZbNsU8WEvrSVK1XzW7xKTHa oXykKzKYXML+NEaNJG5JxfiVb1PxTBFAQrxY61e5c0hB6Rk1jrFl0QrMeCov4o59Y/QN WQlcoEiOr0eD40pc5RMeJVpDZpxr6ivEdBnO9rXg9jPqDkzLx3Hyc6h9kOrg4QaAsJ8o byuTaXxAy/V7LyXmWTMgYq7k/Oq0er9WNMaEP83GvqH4cMezAjO1H3Mf/+bfEPvQMm83 95fuddHDWluHHiYjJZLNf/lzUEm66D0eIWN5p2QL/FeQUGj5tJimAJH+kMQvvLa2udde ShSA== X-Gm-Message-State: AJIora/aAP+6MZIv+TxdR2TvHrFGxISL3scstZz21jVIxuc5wCELArYg 2Tf0/8kLMJE6jjjMXDZSTjm3CcsoUEU= X-Google-Smtp-Source: AGRyM1ssmrDqfSTYiw27oyw+Bur5uWJowdKL1cZUrI6LwwxR/IS9bvg1EbmH5xbuw42AXDXnO7H9BQ== X-Received: by 2002:a17:902:b198:b0:16c:1c13:cd8d with SMTP id s24-20020a170902b19800b0016c1c13cd8dmr19183286plr.92.1657553910529; Mon, 11 Jul 2022 08:38:30 -0700 (PDT) Received: from localhost.localdomain ([103.124.170.70]) by smtp.googlemail.com with ESMTPSA id u18-20020a17090a891200b001ef87123615sm4891268pjn.37.2022.07.11.08.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 08:38:30 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 11 Jul 2022 21:07:11 +0530 Message-Id: <20220711153711.36679-6-rishikeshdonadkar@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220711153711.36679-1-rishikeshdonadkar@gmail.com> References: <20220711153711.36679-1-rishikeshdonadkar@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 5/5] gstreamer: Reset the colorSpace if not the same after validation. 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 set in the previous patch is not same after validation, Reset the colorSpace to the previous value that was present before applying the requested colorspace. Signed-off-by: Rishikesh Donadkar --- src/gstreamer/gstlibcamerasrc.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index a7a0c440..6cb631df 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -461,6 +461,8 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, GstLibcameraSrcState *state = self->state; GstFlowReturn flow_ret = GST_FLOW_OK; gint ret; + std::vector> prevColorSpaces; + std::vector> appliedColorSpaces; GST_DEBUG_OBJECT(self, "Streaming thread has started"); @@ -501,9 +503,13 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, break; } + /*Store the colorSpaces applied pew pad. */ + prevColorSpaces.push_back(stream_cfg.colorSpace); + /* Fixate caps and configure the stream. */ caps = gst_caps_make_writable(caps); gst_libcamera_configure_stream_from_caps(stream_cfg, caps); + appliedColorSpaces.push_back(stream_cfg.colorSpace); } if (flow_ret != GST_FLOW_OK) @@ -515,6 +521,12 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, goto done; } + for (gsize i = 0; i < state->srcpads_.size(); i++) { + StreamConfiguration &stream_cfg = state->config_->at(i); + + if (stream_cfg.colorSpace != appliedColorSpaces[i]) + stream_cfg.colorSpace = prevColorSpaces[i]; + } /* * Regardless if it has been modified, create clean caps and push the * caps event. Downstream will decide if the caps are acceptable.