From patchwork Thu Jun 23 23:22:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16350 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 D0047BD808 for ; Thu, 23 Jun 2022 23:22:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 95F6661FB2; Fri, 24 Jun 2022 01:22:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656026558; bh=U5uDoigSLXuYOtlGcXh59NjMvxX+p5+F2ubYAla5zD0=; 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=YJ0QplKSXSFSeqDQSb1ehj6UoodtM/xYiudtMi16nb/KrNLXOfD4unsVncJqhLjQ5 M22hGNlp0yreP1+w8Xc5GKbWgvZgS2xu34EfvRONy0foIwsg3/HMqkr6UrlQTDC5AX K6RNbiFkcwmtpYR8lVV9kyerb2utpJMknfdzMFyPshulakfGFWccgtBvv/6QypdzOe h3mAsi5BKNVQxLpvFaI9pIV5Jb5oq4MjovUASu0/Sn8+wC7CDHCryq2TGl2scosW1Z K/ogZGQKkceGuj4IzLfuBEtHC0Yrf07M7QIP42GpbWHi/dVGxl6W/An36mL7GDfFdH SVVwiUORcXRoQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E9EA165639 for ; Fri, 24 Jun 2022 01:22:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="e0ubcb2Z"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2EFDADD; Fri, 24 Jun 2022 01:22:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656026550; bh=U5uDoigSLXuYOtlGcXh59NjMvxX+p5+F2ubYAla5zD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e0ubcb2ZSR7TWPTr3PmHd1prA6wZ/hyBReKs/d26vEQHSDlgJPc7UtVKdrWYw/fMO zhqz5Ceh7mgILnAbry6KqD+8gjBbmyrgEbVDxRqq9leYL00Z5/wIglLFzGrsxMVAgC k4+QNLUpqCQwvGVJdleaHKJwpSgr+2v3ONk1LgyA= To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Jun 2022 02:22:01 +0300 Message-Id: <20220623232210.18742-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220623232210.18742-1-laurent.pinchart@ideasonboard.com> References: <20220623232210.18742-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 04/13] gstreamer: Pass Stream to RequestWrap::addBuffer() 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: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Cc: Nicolas Dufresne , Vedant Paranjape Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" For symmetry with RequestWrap::removeBuffer(), pass the Stream pointer to addBuffer(). This handles streams at the GstPad level instead of the GstBuffer level, which allows making the GstLibcameraPool API a bit cleaner by removing the gst_libcamera_buffer_get_stream() helper function. Signed-off-by: Laurent Pinchart Reviewed-by: Nicolas Dufresne Reviewed-by: Umang Jain --- src/gstreamer/gstlibcamerapool.cpp | 7 ------- src/gstreamer/gstlibcamerapool.h | 2 -- src/gstreamer/gstlibcamerasrc.cpp | 8 ++++---- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/gstreamer/gstlibcamerapool.cpp b/src/gstreamer/gstlibcamerapool.cpp index 118bc6db7067..c7b7fe54cbe1 100644 --- a/src/gstreamer/gstlibcamerapool.cpp +++ b/src/gstreamer/gstlibcamerapool.cpp @@ -133,10 +133,3 @@ gst_libcamera_pool_get_stream(GstLibcameraPool *self) { return self->stream; } - -Stream * -gst_libcamera_buffer_get_stream(GstBuffer *buffer) -{ - auto *self = (GstLibcameraPool *)buffer->pool; - return self->stream; -} diff --git a/src/gstreamer/gstlibcamerapool.h b/src/gstreamer/gstlibcamerapool.h index 06b38cb296fc..0ad14be4adf3 100644 --- a/src/gstreamer/gstlibcamerapool.h +++ b/src/gstreamer/gstlibcamerapool.h @@ -24,5 +24,3 @@ GstLibcameraPool *gst_libcamera_pool_new(GstLibcameraAllocator *allocator, libcamera::Stream *stream); libcamera::Stream *gst_libcamera_pool_get_stream(GstLibcameraPool *self); - -libcamera::Stream *gst_libcamera_buffer_get_stream(GstBuffer *buffer); diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index dea143961d69..700bee2bf877 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -51,7 +51,7 @@ struct RequestWrap { RequestWrap(std::unique_ptr request); ~RequestWrap(); - void attachBuffer(GstBuffer *buffer); + void attachBuffer(Stream *stream, GstBuffer *buffer); GstBuffer *detachBuffer(Stream *stream); std::unique_ptr request_; @@ -71,10 +71,9 @@ RequestWrap::~RequestWrap() } } -void RequestWrap::attachBuffer(GstBuffer *buffer) +void RequestWrap::attachBuffer(Stream *stream, GstBuffer *buffer) { FrameBuffer *fb = gst_libcamera_buffer_get_frame_buffer(buffer); - Stream *stream = gst_libcamera_buffer_get_stream(buffer); request_->addBuffer(stream, fb); @@ -275,6 +274,7 @@ gst_libcamera_src_task_run(gpointer user_data) std::make_unique(std::move(request)); for (GstPad *srcpad : state->srcpads_) { + Stream *stream = gst_libcamera_pad_get_stream(srcpad); GstLibcameraPool *pool = gst_libcamera_pad_get_pool(srcpad); GstBuffer *buffer; GstFlowReturn ret; @@ -290,7 +290,7 @@ gst_libcamera_src_task_run(gpointer user_data) break; } - wrap->attachBuffer(buffer); + wrap->attachBuffer(stream, buffer); } if (wrap) {