From patchwork Thu Sep 15 11:47:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rishikesh Donadkar X-Patchwork-Id: 17369 X-Patchwork-Delegate: umang.jain@ideasonboard.com 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 463A9C327D for ; Thu, 15 Sep 2022 11:47:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8FAF061FB3; Thu, 15 Sep 2022 13:47:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1663242475; bh=3PrOpcMHKuVTmV6dZUUgk0vGdiEauDJiNYP7MTKjSPU=; 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=WcFuONH6SR7DDPv2w5m0UlBiIheRCwzTePUtq/o4z38/XGPyu5hA0i5Bh1l82jssn vU+XpBiesxSPxPIldOkTaBrM7SK3Iv/qNDzOBnq5396k7nT3m/ewvzE6o9n9SzHkp6 hudlqYrr8C6HNGg83NFoH/InfwHXyNyG9a9XfnYhbZg13Xni5Ci4Z+QjOyaOYfQK0O smjz58a7MSKZTk+ctfiarADu1QOYUqC2zUI3GOFkZ9xQf4ndGWZUBK/nzc9v/Qgpad 0igqW5nmPztu6H4K5uP9I9/51OZnrb55lFZe1fb6wnwX6zIuGuPYjqaHN86ejnsmUn tA6Yglv44vasg== Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 65BC66099D for ; Thu, 15 Sep 2022 13:47:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qRJ+nyLt"; dkim-atps=neutral Received: by mail-pj1-x1030.google.com with SMTP id d64-20020a17090a6f4600b00202ce056566so12665192pjk.4 for ; Thu, 15 Sep 2022 04:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=61amfx/e5WCv0tdVn2IILwDw2qXiwc/7NBbx0UUGqzY=; b=qRJ+nyLtbtma9jHa1WKhhHyqTwfwJ7XyPw0Pn1ahoe3MYY8Aynxy6XPXuZ8lzoJEaW dc0hnyAJY3tRYTgqIW7U9jvHGWf3qxiSOrHk3ROyooQgDFPb8LyGwDW7/Etl5cU6Nd0K hTf3f0zMgJCi1SMV+d591KFSrA7bU+bkqZ5GrZxhUCvIfyPDPpMSN/yPV6k4dx7ACUOW 2Vi33oevB1Kxp7IW+9sFPXhVK5ZkixHkCuaiPNvDad99jqKbahsMHq7fUz/MxM3cfvlo TfsywfzaSsIyg6hYLLgUs+oxFXYljnCxTstdtrfWC9ZYKMr+oNSSCRH5h7tauFUZFpWt 6oGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=61amfx/e5WCv0tdVn2IILwDw2qXiwc/7NBbx0UUGqzY=; b=jpkjWOUZTUCh0kSDbUdt1Qw6iScDfCjxEZQw/eDn6mgbTwW6sNB/wZhhEemAuP5X48 Hq6NercdZOIlXN3tiNp3vvmbCsm22IedRSUEkFvcXnIoPKZHNuiZycluPXOkzHJ4G7+n 820jvtY1c9//+HegUj/7BPLvRZ7AZHIXcKSsxPQ/MBo4+bOmodlmIgL1iMzhdOwVFX7+ YZ5mquVMzgrxmb94+0+xYthdc0RXb/9A2/vpMwq3cQNpwixPkygHKVRZDjb3yOr58Mtd Sc8v0GFkLqEbNE13VUjjUE6q15d3Hko3v3Zg7kITtZIxVK+nPW9gMAYKkZYI+8sIdqv1 UswQ== X-Gm-Message-State: ACrzQf3algHx0Ykvng27sJT60yLKpWQcc06utbhNfoDmfmxo3AzFvOeT dlfP4nCSe4h7JbrP+9AykfO8BTDdxGJ93g== X-Google-Smtp-Source: AMsMyM7kAyUfuufT8z+1Co7h4si1kqEJE5ILa8Y7N2xbMilBq97RVRiX+crewi67HTzDc5kCqifhYQ== X-Received: by 2002:a17:902:ea11:b0:176:b283:9596 with SMTP id s17-20020a170902ea1100b00176b2839596mr3831907plg.69.1663242472466; Thu, 15 Sep 2022 04:47:52 -0700 (PDT) Received: from localhost.localdomain ([49.36.99.120]) by smtp.googlemail.com with ESMTPSA id x15-20020a170902a38f00b001785dddc703sm3718994pla.120.2022.09.15.04.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 04:47:52 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 15 Sep 2022 17:17:33 +0530 Message-Id: <20220915114734.115572-2-rishikeshdonadkar@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220915114734.115572-1-rishikeshdonadkar@gmail.com> References: <20220915114734.115572-1-rishikeshdonadkar@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 1/2] gstreamer: Configure the camera before exposing the 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: nicolas.dufresne@collabora.com, vedantparanjape160201@gmail.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Configure the camera before exposing the caps so that the stream configuration and valid controls values (and bounds) are available, required to expose the new caps. controls::FrameDurationLimits is one such example. Signed-off-by: Rishikesh Donadkar Tested-by: Umang Jain Reviewed-by: Umang Jain --- src/gstreamer/gstlibcamerasrc.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 16d70fea..60032236 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -515,6 +515,16 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, goto done; } + ret = state->cam_->configure(state->config_.get()); + if (ret) { + GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS, + ("Failed to configure camera: %s", g_strerror(-ret)), + ("Camera::configure() failed with error code %i", ret)); + gst_task_stop(task); + flow_ret = GST_FLOW_NOT_NEGOTIATED; + goto done; + } + /* * Regardless if it has been modified, create clean caps and push the * caps event. Downstream will decide if the caps are acceptable. @@ -535,15 +545,6 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, gst_pad_push_event(srcpad, gst_event_new_segment(&segment)); } - ret = state->cam_->configure(state->config_.get()); - if (ret) { - GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS, - ("Failed to configure camera: %s", g_strerror(-ret)), - ("Camera::configure() failed with error code %i", ret)); - gst_task_stop(task); - return; - } - self->allocator = gst_libcamera_allocator_new(state->cam_, state->config_.get()); if (!self->allocator) { GST_ELEMENT_ERROR(self, RESOURCE, NO_SPACE_LEFT,