[{"id":3867,"web_url":"https://patchwork.libcamera.org/comment/3867/","msgid":"<20200229140237.GN18738@pendragon.ideasonboard.com>","date":"2020-02-29T14:02:37","subject":"Re: [libcamera-devel] [PATCH v2 12/27] gst: libcamerasrc: Store the\n\tsrcpad in a vector","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Nicolas,\n\nThank you for the patch.\n\nOn Thu, Feb 27, 2020 at 03:03:52PM -0500, Nicolas Dufresne wrote:\n> This will allow implementing generic algorithm even if we cannot\n> request pads yet.\n> \n> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++---\n>  1 file changed, 4 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\n> index 53ece26..5a86a6d 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -12,6 +12,7 @@\n>  \n>  #include <libcamera/camera.h>\n>  #include <libcamera/camera_manager.h>\n> +#include <vector>\n\nAs documented in coding-style.rst:\n\n # The header declaring the API being implemented (if any)\n # The C and C++ system and standard library headers\n # Other libraries' headers, with one group per library\n # Other project's headers\n\nthis should be\n\n#include <vector>\n\n#include <libcamera/camera.h>\n#include <libcamera/camera_manager.h>\n\nand looking at gstlibcamerasrc.cpp as a whole at the end of the series,\nI would write:\n\n#include \"gstlibcamerasrc.h\"\n\n#include <queue>\n#include <vector>\n\n#include <gst/base/base.h>\n\n#include <libcamera/camera.h>\n#include <libcamera/camera_manager.h>\n\n#include \"gstlibcamera-utils.h\"\n#include \"gstlibcameraallocator.h\"\n#include \"gstlibcamerapad.h\"\n#include \"gstlibcamerapool.h\"\n\nIncludeing gstlibcamerasrc.h first is especially important to test that\nthe header is self-contained and avoid future issues. Would you be able\nto give it a go through this series ?\n\n>  using namespace libcamera;\n>  \n> @@ -22,6 +23,7 @@ GST_DEBUG_CATEGORY_STATIC(source_debug);\n>  struct GstLibcameraSrcState {\n>  \tstd::unique_ptr<CameraManager> cm;\n>  \tstd::shared_ptr<Camera> cam;\n> +\tstd::vector<GstPad *> srcpads;\n>  };\n>  \n>  struct _GstLibcameraSrc {\n> @@ -29,7 +31,6 @@ struct _GstLibcameraSrc {\n>  \n>  \tGRecMutex stream_lock;\n>  \tGstTask *task;\n> -\tGstPad *srcpad;\n>  \n>  \tgchar *camera_name;\n>  \n> @@ -262,8 +263,8 @@ gst_libcamera_src_init(GstLibcameraSrc *self)\n>  \tgst_task_set_leave_callback(self->task, gst_libcamera_src_task_leave, self, nullptr);\n>  \tgst_task_set_lock(self->task, &self->stream_lock);\n>  \n> -\tself->srcpad = gst_pad_new_from_template(templ, \"src\");\n> -\tgst_element_add_pad(GST_ELEMENT(self), self->srcpad);\n> +\tstate->srcpads.push_back(gst_pad_new_from_template(templ, \"src\"));\n> +\tgst_element_add_pad(GST_ELEMENT(self), state->srcpads[0]);\n>  \tself->state = state;\n>  }\n>","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EA25962689\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 29 Feb 2020 15:03:00 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5AC0C2AF;\n\tSat, 29 Feb 2020 15:03:00 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1582984980;\n\tbh=V7pDmcMqLBaeSUH+1dpgB4o5+3xSK+SVAdMVcajFN64=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=SIpPyDIP+ELcREwzDAL/Nf0+B39XscU6wUWl6oe6cI2x+K9oyqoBDbT+xqPcPbHXO\n\thlv2Rar8PSrH0C3qdqTMFlxqbgyQgHKSUfmMqUm0aciQePVOS92rXRatnVQRM3hBQ9\n\t/+e6L5RQIhHyqYA20a1/RW6lziJfrGTP6bRSH+WI=","Date":"Sat, 29 Feb 2020 16:02:37 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200229140237.GN18738@pendragon.ideasonboard.com>","References":"<20200227200407.490616-1-nicolas.dufresne@collabora.com>\n\t<20200227200407.490616-13-nicolas.dufresne@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200227200407.490616-13-nicolas.dufresne@collabora.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 12/27] gst: libcamerasrc: Store the\n\tsrcpad in a vector","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>","X-List-Received-Date":"Sat, 29 Feb 2020 14:03:01 -0000"}},{"id":3967,"web_url":"https://patchwork.libcamera.org/comment/3967/","msgid":"<a3aad39d184b13a30c1cbdfc7c2622ce117e96e0.camel@collabora.com>","date":"2020-03-06T17:26:47","subject":"Re: [libcamera-devel] [PATCH v2 12/27] gst: libcamerasrc: Store the\n\tsrcpad in a vector","submitter":{"id":31,"url":"https://patchwork.libcamera.org/api/people/31/","name":"Nicolas Dufresne","email":"nicolas.dufresne@collabora.com"},"content":"Le samedi 29 février 2020 à 16:02 +0200, Laurent Pinchart a écrit :\n> Hi Nicolas,\n> \n> Thank you for the patch.\n> \n> On Thu, Feb 27, 2020 at 03:03:52PM -0500, Nicolas Dufresne wrote:\n> > This will allow implementing generic algorithm even if we cannot\n> > request pads yet.\n> > \n> > Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++---\n> >  1 file changed, 4 insertions(+), 3 deletions(-)\n> > \n> > diff --git a/src/gstreamer/gstlibcamerasrc.cpp\n> > b/src/gstreamer/gstlibcamerasrc.cpp\n> > index 53ece26..5a86a6d 100644\n> > --- a/src/gstreamer/gstlibcamerasrc.cpp\n> > +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> > @@ -12,6 +12,7 @@\n> >  \n> >  #include <libcamera/camera.h>\n> >  #include <libcamera/camera_manager.h>\n> > +#include <vector>\n> \n> As documented in coding-style.rst:\n> \n>  # The header declaring the API being implemented (if any)\n>  # The C and C++ system and standard library headers\n>  # Other libraries' headers, with one group per library\n>  # Other project's headers\n> \n> this should be\n> \n> #include <vector>\n> \n> #include <libcamera/camera.h>\n> #include <libcamera/camera_manager.h>\n> \n> and looking at gstlibcamerasrc.cpp as a whole at the end of the series,\n> I would write:\n> \n> #include \"gstlibcamerasrc.h\"\n> \n> #include <queue>\n> #include <vector>\n> \n> #include <gst/base/base.h>\n> \n> #include <libcamera/camera.h>\n> #include <libcamera/camera_manager.h>\n> \n> #include \"gstlibcamera-utils.h\"\n> #include \"gstlibcameraallocator.h\"\n> #include \"gstlibcamerapad.h\"\n> #include \"gstlibcamerapool.h\"\n> \n> Includeing gstlibcamerasrc.h first is especially important to test that\n> the header is self-contained and avoid future issues. Would you be able\n> to give it a go through this series ?\n\nYep, I also fixed other GstObject to follow this.\n\n> \n> >  using namespace libcamera;\n> >  \n> > @@ -22,6 +23,7 @@ GST_DEBUG_CATEGORY_STATIC(source_debug);\n> >  struct GstLibcameraSrcState {\n> >  \tstd::unique_ptr<CameraManager> cm;\n> >  \tstd::shared_ptr<Camera> cam;\n> > +\tstd::vector<GstPad *> srcpads;\n> >  };\n> >  \n> >  struct _GstLibcameraSrc {\n> > @@ -29,7 +31,6 @@ struct _GstLibcameraSrc {\n> >  \n> >  \tGRecMutex stream_lock;\n> >  \tGstTask *task;\n> > -\tGstPad *srcpad;\n> >  \n> >  \tgchar *camera_name;\n> >  \n> > @@ -262,8 +263,8 @@ gst_libcamera_src_init(GstLibcameraSrc *self)\n> >  \tgst_task_set_leave_callback(self->task, gst_libcamera_src_task_leave,\n> > self, nullptr);\n> >  \tgst_task_set_lock(self->task, &self->stream_lock);\n> >  \n> > -\tself->srcpad = gst_pad_new_from_template(templ, \"src\");\n> > -\tgst_element_add_pad(GST_ELEMENT(self), self->srcpad);\n> > +\tstate->srcpads.push_back(gst_pad_new_from_template(templ, \"src\"));\n> > +\tgst_element_add_pad(GST_ELEMENT(self), state->srcpads[0]);\n> >  \tself->state = state;\n> >  }\n> >","headers":{"Return-Path":"<nicolas.dufresne@collabora.com>","Received":["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 84DD260424\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Mar 2020 18:26:57 +0100 (CET)","from nicolas-tpx395.localdomain (unknown [IPv6:2610:98:8005::527])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits))\n\t(No client certificate requested) (Authenticated sender: nicolas)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id C5191297146;\n\tFri,  6 Mar 2020 17:26:56 +0000 (GMT)"],"Message-ID":"<a3aad39d184b13a30c1cbdfc7c2622ce117e96e0.camel@collabora.com>","From":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Date":"Fri, 06 Mar 2020 12:26:47 -0500","In-Reply-To":"<20200229140237.GN18738@pendragon.ideasonboard.com>","References":"<20200227200407.490616-1-nicolas.dufresne@collabora.com>\n\t<20200227200407.490616-13-nicolas.dufresne@collabora.com>\n\t<20200229140237.GN18738@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","User-Agent":"Evolution 3.34.4 (3.34.4-1.fc31) ","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH v2 12/27] gst: libcamerasrc: Store the\n\tsrcpad in a vector","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>","X-List-Received-Date":"Fri, 06 Mar 2020 17:26:57 -0000"}}]