From patchwork Wed Jun 4 13:07:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 23468 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 8B02EC31E9 for ; Wed, 4 Jun 2025 13:08:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 83D4368DCC; Wed, 4 Jun 2025 15:08:07 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AHP5W7Wc"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2100068DC4 for ; Wed, 4 Jun 2025 15:08:01 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 148B9E9B; Wed, 4 Jun 2025 15:07:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1749042478; bh=ngJzRp2goVAmlgmuUmxkDuVfDCLV776dIXKMxzo4xI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AHP5W7Wcd6n++H4ZamyNMtcSarZjLAdZmtLFB+Ak6VxwKCKbvSGolGp3YqCTpoYIP BftRM/dZ8Ejbq8HsMqEQZpGe7Evwf1pumDc9V9/rzznhZ2+sPgEuObnpPBARzH8phh WLVRIB1Supuyulkw2RTHUN+B4+4tRkzT67KyTaN0= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Hou Qi , Nicolas Dufresne Subject: [PATCH v2 7/7] gstreamer: Replace NULL with nullptr Date: Wed, 4 Jun 2025 16:07:41 +0300 Message-ID: <20250604130741.9228-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250604130741.9228-1-laurent.pinchart@ideasonboard.com> References: <20250604130741.9228-1-laurent.pinchart@ideasonboard.com> 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" Usage of NULL has slowly crept in the libcamerasrc sources. Replace it with nullptr. Signed-off-by: Laurent Pinchart Reviewed-by: Barnabás Pőcze Reported-by: Nicolas Dufresne Reviewed-by: Nicolas Dufresne --- src/gstreamer/gstlibcamera-controls.cpp.in | 2 +- src/gstreamer/gstlibcamerapad.cpp | 2 +- src/gstreamer/gstlibcamerasrc.cpp | 23 +++++++++++----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/gstreamer/gstlibcamera-controls.cpp.in b/src/gstreamer/gstlibcamera-controls.cpp.in index 89c530da0b4a..2a16b39a93d9 100644 --- a/src/gstreamer/gstlibcamera-controls.cpp.in +++ b/src/gstreamer/gstlibcamera-controls.cpp.in @@ -68,7 +68,7 @@ static const GEnumValue {{ ctrl.name|snake_case }}_types[] = { "{{ enum.gst_name }}" }, {%- endfor %} - {0, NULL, NULL} + {0, nullptr, nullptr} }; #define TYPE_{{ ctrl.name|snake_case|upper }} \ diff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp index 3bc2bc87e773..81a0ef44cc6f 100644 --- a/src/gstreamer/gstlibcamerapad.cpp +++ b/src/gstreamer/gstlibcamerapad.cpp @@ -102,7 +102,7 @@ gst_libcamera_stream_role_get_type() "libcamera::Viewfinder", "view-finder", }, - { 0, NULL, NULL } + { 0, nullptr, nullptr } }; if (!type) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index eec8163e88e7..16b1d08b3053 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -367,10 +367,10 @@ int GstLibcameraSrcState::processRequest() if (video_pool) { /* Only set video pool when a copy is needed. */ - GstBuffer *copy = NULL; + GstBuffer *copy = nullptr; const GstVideoInfo info = gst_libcamera_pad_get_video_info(srcpad); - ret = gst_buffer_pool_acquire_buffer(video_pool, ©, NULL); + ret = gst_buffer_pool_acquire_buffer(video_pool, ©, nullptr); if (ret != GST_FLOW_OK) { gst_buffer_unref(buffer); GST_ELEMENT_ERROR(src_, RESOURCE, SETTINGS, @@ -541,8 +541,8 @@ static std::tuple gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad, GstCaps *caps, const GstVideoInfo *info) { - g_autoptr(GstQuery) query = NULL; - g_autoptr(GstBufferPool) pool = NULL; + g_autoptr(GstQuery) query = nullptr; + g_autoptr(GstBufferPool) pool = nullptr; const gboolean need_pool = true; /* @@ -554,8 +554,8 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad, if (!gst_pad_peer_query(srcpad, query)) GST_DEBUG_OBJECT(self, "Didn't get downstream ALLOCATION hints"); - else if (gst_query_find_allocation_meta(query, GST_VIDEO_META_API_TYPE, NULL)) - return { NULL, 0 }; + else if (gst_query_find_allocation_meta(query, GST_VIDEO_META_API_TYPE, nullptr)) + return { nullptr, 0 }; GST_WARNING_OBJECT(self, "Downstream doesn't support video meta, need to copy frame."); @@ -564,7 +564,8 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad, * create a new pool. */ if (gst_query_get_n_allocation_pools(query) > 0) - gst_query_parse_nth_allocation_pool(query, 0, &pool, NULL, NULL, NULL); + gst_query_parse_nth_allocation_pool(query, 0, &pool, nullptr, + nullptr, nullptr); if (!pool) { GstStructure *config; @@ -583,7 +584,7 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad, GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS, ("Failed to active buffer pool"), ("gst_libcamera_src_negotiate() failed.")); - return { NULL, -EINVAL }; + return { nullptr, -EINVAL }; } return { reinterpret_cast(g_steal_pointer(&pool)), 0 }; @@ -660,7 +661,7 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self) for (gsize i = 0; i < state->srcpads_.size(); i++) { GstPad *srcpad = state->srcpads_[i]; const StreamConfiguration &stream_cfg = state->config_->at(i); - GstBufferPool *video_pool = NULL; + GstBufferPool *video_pool = nullptr; GstVideoInfo info; g_autoptr(GstCaps) caps = gst_libcamera_stream_configuration_to_caps(stream_cfg, transfer[i]); @@ -1065,7 +1066,7 @@ gst_libcamera_src_request_new_pad(GstElement *element, GstPadTemplate *templ, const gchar *name, [[maybe_unused]] const GstCaps *caps) { GstLibcameraSrc *self = GST_LIBCAMERA_SRC(element); - g_autoptr(GstPad) pad = NULL; + g_autoptr(GstPad) pad = nullptr; GST_DEBUG_OBJECT(self, "new request pad created"); @@ -1079,7 +1080,7 @@ gst_libcamera_src_request_new_pad(GstElement *element, GstPadTemplate *templ, GST_ELEMENT_ERROR(element, STREAM, FAILED, ("Internal data stream error."), ("Could not add pad to element")); - return NULL; + return nullptr; } gst_child_proxy_child_added(GST_CHILD_PROXY(self), G_OBJECT(pad), GST_OBJECT_NAME(pad));