[libcamera-devel] [PATCH 04/13] gstreamer: Pass Stream to RequestWrap::addBuffer()
Nicolas Dufresne
nicolas.dufresne at collabora.com
Mon Jun 27 22:48:56 CEST 2022
Le vendredi 24 juin 2022 à 02:22 +0300, Laurent Pinchart a écrit :
> 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 <laurent.pinchart at ideasonboard.com>
Agreed, thanks.
Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
> ---
> 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> request);
> ~RequestWrap();
>
> - void attachBuffer(GstBuffer *buffer);
> + void attachBuffer(Stream *stream, GstBuffer *buffer);
> GstBuffer *detachBuffer(Stream *stream);
>
> std::unique_ptr<Request> 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<RequestWrap>(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) {
More information about the libcamera-devel
mailing list