{"id":11373,"url":"https://patchwork.libcamera.org/api/1.1/patches/11373/?format=json","web_url":"https://patchwork.libcamera.org/patch/11373/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210224171926.31470-1-dafna.hirschfeld@collabora.com>","date":"2021-02-24T17:19:26","name":"[libcamera-devel] src: gstreamer: use the streams of CameraConfiguration when allocating buffers","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5f8c8b81ff9213e648577aa6199b19ea520eee9d","submitter":{"id":46,"url":"https://patchwork.libcamera.org/api/1.1/people/46/?format=json","name":"Dafna Hirschfeld","email":"dafna.hirschfeld@collabora.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11373/mbox/","series":[{"id":1724,"url":"https://patchwork.libcamera.org/api/1.1/series/1724/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1724","date":"2021-02-24T17:19:26","name":"[libcamera-devel] src: gstreamer: use the streams of CameraConfiguration when allocating buffers","version":1,"mbox":"https://patchwork.libcamera.org/series/1724/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11373/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11373/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 49853BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Feb 2021 17:19:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D20B768A3B;\n\tWed, 24 Feb 2021 18:19:38 +0100 (CET)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F10CD68A1E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Feb 2021 18:19:37 +0100 (CET)","from guri.fritz.box (unknown\n\t[IPv6:2a02:810a:880:f54:509f:5b33:999:477c])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits))\n\t(No client certificate requested) (Authenticated sender: dafna)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id 4DFBB1F45BF1;\n\tWed, 24 Feb 2021 17:19:37 +0000 (GMT)"],"From":"Dafna Hirschfeld <dafna.hirschfeld@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 24 Feb 2021 18:19:26 +0100","Message-Id":"<20210224171926.31470-1-dafna.hirschfeld@collabora.com>","X-Mailer":"git-send-email 2.17.1","Subject":"[libcamera-devel] [PATCH] src: gstreamer: use the streams of\n\tCameraConfiguration when allocating buffers","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"kernel@collabora.com, nicolas.dufresne@collabora.com","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Currently, when allocating buffers, the streams of\nthe Camera object are used. Instead the streams of\nthe CameraConfiguration object should be used.\n\nSigned-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>\n---\n src/gstreamer/gstlibcameraallocator.cpp | 6 ++++--\n src/gstreamer/gstlibcameraallocator.h   | 4 +++-\n src/gstreamer/gstlibcamerasrc.cpp       | 2 +-\n 3 files changed, 8 insertions(+), 4 deletions(-)","diff":"diff --git a/src/gstreamer/gstlibcameraallocator.cpp b/src/gstreamer/gstlibcameraallocator.cpp\nindex 13c6b493..7bd8ba2d 100644\n--- a/src/gstreamer/gstlibcameraallocator.cpp\n+++ b/src/gstreamer/gstlibcameraallocator.cpp\n@@ -183,13 +183,15 @@ gst_libcamera_allocator_class_init(GstLibcameraAllocatorClass *klass)\n }\n \n GstLibcameraAllocator *\n-gst_libcamera_allocator_new(std::shared_ptr<Camera> camera)\n+gst_libcamera_allocator_new(std::shared_ptr<Camera> camera,\n+\t\t\t    CameraConfiguration *config_)\n {\n \tauto *self = GST_LIBCAMERA_ALLOCATOR(g_object_new(GST_TYPE_LIBCAMERA_ALLOCATOR,\n \t\t\t\t\t\t\t  nullptr));\n \n \tself->fb_allocator = new FrameBufferAllocator(camera);\n-\tfor (Stream *stream : camera->streams()) {\n+\tfor (StreamConfiguration &streamCfg : *config_) {\n+\t\tStream *stream = streamCfg.stream();\n \t\tgint ret;\n \n \t\tret = self->fb_allocator->allocate(stream);\ndiff --git a/src/gstreamer/gstlibcameraallocator.h b/src/gstreamer/gstlibcameraallocator.h\nindex befdcad6..f7fa6acd 100644\n--- a/src/gstreamer/gstlibcameraallocator.h\n+++ b/src/gstreamer/gstlibcameraallocator.h\n@@ -13,12 +13,14 @@\n #include <gst/allocators/allocators.h>\n \n #include <libcamera/stream.h>\n+#include <libcamera/camera.h>\n \n #define GST_TYPE_LIBCAMERA_ALLOCATOR gst_libcamera_allocator_get_type()\n G_DECLARE_FINAL_TYPE(GstLibcameraAllocator, gst_libcamera_allocator,\n \t\t     GST_LIBCAMERA, ALLOCATOR, GstDmaBufAllocator)\n \n-GstLibcameraAllocator *gst_libcamera_allocator_new(std::shared_ptr<libcamera::Camera> camera);\n+GstLibcameraAllocator *gst_libcamera_allocator_new(std::shared_ptr<libcamera::Camera> camera,\n+\t\t\t\t\t\t   libcamera::CameraConfiguration *config_);\n \n bool gst_libcamera_allocator_prepare_buffer(GstLibcameraAllocator *self,\n \t\t\t\t\t    libcamera::Stream *stream,\ndiff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex 636c14df..7b13667b 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -429,7 +429,7 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread,\n \t\treturn;\n \t}\n \n-\tself->allocator = gst_libcamera_allocator_new(state->cam_);\n+\tself->allocator = gst_libcamera_allocator_new(state->cam_, state->config_.get());\n \tif (!self->allocator) {\n \t\tGST_ELEMENT_ERROR(self, RESOURCE, NO_SPACE_LEFT,\n \t\t\t\t  (\"Failed to allocate memory\"),\n","prefixes":["libcamera-devel"]}