From patchwork Mon Oct 21 16:45:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaslo Ziska X-Patchwork-Id: 21722 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 305EDBD808 for ; Mon, 21 Oct 2024 16:50:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DCD9C6538B; Mon, 21 Oct 2024 18:50:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ziska.de header.i=@ziska.de header.b="m710lVeX"; dkim=permerror (0-bit key) header.d=ziska.de header.i=@ziska.de header.b="xpZqeDqr"; dkim-atps=neutral Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.51]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9A27865393 for ; Mon, 21 Oct 2024 18:50:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; t=1729529425; cv=none; d=strato.com; s=strato-dkim-0002; b=qwaFzV6LAw4i/yC45mHNLmqUxk9VGcL65Dw2/UZqt+kJv1V9n5AuThMpykrc8Mm4cS 4LuLs/RRCNpoo7iZvpdCe0MzgAqbF2nF7V8dMKfv2H9jfElL/BIzib8R3VlVbG8l+hGL NCm/AZRAe69Vj3/mgQFJOjMppxuZg2vf9viHy/Gem0e85oxjPuVgn/59Y33zSw/NjBmb MUh6KCy3CcnsKjg+YoN0j8AUivcyYkBlewxv3aLjRiZkKJS5WI3S2kWgbBW6iaF4qoBl 66L9jtzgIwK2C4LXV6Onolvnkj5tWsW8eC7WPfKn1Tz3A/ZgwbRpqk39uANwc8AB5NuH 85Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1729529425; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=uO2vpQC7FEHevnqhfg6TMwrXpF5yoNqnsB+djCdaeYE=; b=UuNN+QmXolhLo2L1te3q06hteiPSEzr3jwt+ASfJr2s6ezPdBBt4lnaIK56ZWTbrvA Ql62/bXf5cH3D06yQINGYNaITl2SQ7iaFU4C40KDTF5sD0Dyjs+ysLz2L4QXnsINWVIk SSeGMSOewQjwF5bMW7eWt1V5OzxgbUXUPuNsew1yB20S9EHuAXMWLJ65VWOxvgFDzMR8 RZjU0EamBwedq/ge/ipCu0IMV7nSxKoBPKkdDGwqkZ8TuZaBRsYQPwKsr5gxkPND4MlO mi4rmHDmhHPJ5L0vrhwjg2XO+OTInku63Zs9d/slSGe9qfLZhIT4JMb2GXYIzsibHGnw bt8g== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1729529425; s=strato-dkim-0002; d=ziska.de; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=uO2vpQC7FEHevnqhfg6TMwrXpF5yoNqnsB+djCdaeYE=; b=m710lVeXZWzVttigD7yFOO2l+o6mrFwtSA1ka8el3KEbumPS85xGqThyWzxyU2N3Eu UBI9VbBp/818aHOGurKgqo4SZXSCX0tpQBSHp5jjvjNP0FWWzYA5ohpTCXCSkXW30h+f T9kuU5qryBK+KsTqOXJI+ajPg3r1bVSGhxRAdaLt/tBGobNj7dcs0qVW5MKKgDG+D6H/ fnqK9zAe+i7LuQV7K+y2Zl2GE4R6I5iB4EC2Ek2ftuDBapZr7s404KG3ijQt/TDGk8As 5mJDWRFTVqh+N8jFAEw/ygsq5sWbpHvdh45Ldcz9OXfF/sQz1TlADTfrGrsq6IXT9SS0 /pJw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1729529425; s=strato-dkim-0003; d=ziska.de; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=uO2vpQC7FEHevnqhfg6TMwrXpF5yoNqnsB+djCdaeYE=; b=xpZqeDqrp1C7CWcCnA78Bu4+FMM8A/7DU2D7qEkYDBlkC30GQNDLzjbXdGxSGpDOCX qOQS7luBkwmtFbcp4/DA== X-RZG-AUTH: ":Jm0XeU+IYfb0x77LHmrjN5Wlb7TBwusDqIM6Hizy8VdfzvKi4yoFC9cEiIqwXfJa0UVFIOBpUYAtVOpHIoJG1qZybSPb" Received: from archlinux.fritz.box by smtp.strato.de (RZmta 51.2.11 AUTH) with ESMTPSA id zf9ba109LGoPVdD (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 21 Oct 2024 18:50:25 +0200 (CEST) From: Jaslo Ziska To: libcamera-devel@lists.libcamera.org Cc: Jaslo Ziska , Laurent Pinchart , Kieran Bingham Subject: [PATCH v4 2/3] gstreamer: Remove auto-focus-mode property from libcamerasrc Date: Mon, 21 Oct 2024 18:45:32 +0200 Message-ID: <20241021164946.11111-3-jaslo@ziska.de> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241021164946.11111-1-jaslo@ziska.de> References: <20241021164946.11111-1-jaslo@ziska.de> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In preparation for generic support of all libcamera controls, remove the manual handling of the auto-focus-mode property from the libcamerasrc element. Signed-off-by: Jaslo Ziska Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/gstreamer/gstlibcamerasrc.cpp | 28 ---------------------------- src/gstreamer/gstlibcamerasrc.h | 31 ------------------------------- 2 files changed, 59 deletions(-) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 912a8d55..40b787c8 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -142,7 +142,6 @@ struct _GstLibcameraSrc { GstTask *task; gchar *camera_name; - controls::AfModeEnum auto_focus_mode = controls::AfModeManual; std::atomic pending_eos; @@ -154,7 +153,6 @@ struct _GstLibcameraSrc { enum { PROP_0, PROP_CAMERA_NAME, - PROP_AUTO_FOCUS_MODE, }; static void gst_libcamera_src_child_proxy_init(gpointer g_iface, @@ -663,18 +661,6 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, gst_pad_push_event(srcpad, gst_event_new_segment(&segment)); } - if (self->auto_focus_mode != controls::AfModeManual) { - const ControlInfoMap &infoMap = state->cam_->controls(); - if (infoMap.find(&controls::AfMode) != infoMap.end()) { - state->initControls_.set(controls::AfMode, self->auto_focus_mode); - } else { - GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS, - ("Failed to enable auto focus"), - ("AfMode not supported by this camera, " - "please retry with 'auto-focus-mode=AfModeManual'")); - } - } - ret = state->cam_->start(&state->initControls_); if (ret) { GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS, @@ -742,9 +728,6 @@ gst_libcamera_src_set_property(GObject *object, guint prop_id, g_free(self->camera_name); self->camera_name = g_value_dup_string(value); break; - case PROP_AUTO_FOCUS_MODE: - self->auto_focus_mode = static_cast(g_value_get_enum(value)); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -762,9 +745,6 @@ gst_libcamera_src_get_property(GObject *object, guint prop_id, GValue *value, case PROP_CAMERA_NAME: g_value_set_string(value, self->camera_name); break; - case PROP_AUTO_FOCUS_MODE: - g_value_set_enum(value, static_cast(self->auto_focus_mode)); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -967,14 +947,6 @@ gst_libcamera_src_class_init(GstLibcameraSrcClass *klass) | G_PARAM_STATIC_STRINGS)); g_object_class_install_property(object_class, PROP_CAMERA_NAME, spec); - spec = g_param_spec_enum("auto-focus-mode", - "Set auto-focus mode", - "Available options: AfModeManual, " - "AfModeAuto or AfModeContinuous.", - gst_libcamera_auto_focus_get_type(), - static_cast(controls::AfModeManual), - G_PARAM_WRITABLE); - g_object_class_install_property(object_class, PROP_AUTO_FOCUS_MODE, spec); } /* GstChildProxy implementation */ diff --git a/src/gstreamer/gstlibcamerasrc.h b/src/gstreamer/gstlibcamerasrc.h index fd1f8193..a27db9ca 100644 --- a/src/gstreamer/gstlibcamerasrc.h +++ b/src/gstreamer/gstlibcamerasrc.h @@ -8,8 +8,6 @@ #pragma once -#include - #include G_BEGIN_DECLS @@ -19,32 +17,3 @@ G_DECLARE_FINAL_TYPE(GstLibcameraSrc, gst_libcamera_src, GST_LIBCAMERA, SRC, GstElement) G_END_DECLS - -inline GType -gst_libcamera_auto_focus_get_type() -{ - static GType type = 0; - static const GEnumValue values[] = { - { - static_cast(libcamera::controls::AfModeManual), - "AfModeManual", - "manual-focus", - }, - { - static_cast(libcamera::controls::AfModeAuto), - "AfModeAuto", - "automatic-auto-focus", - }, - { - static_cast(libcamera::controls::AfModeContinuous), - "AfModeContinuous", - "continuous-auto-focus", - }, - { 0, NULL, NULL } - }; - - if (!type) - type = g_enum_register_static("GstLibcameraAutoFocus", values); - - return type; -}