[{"id":1278,"web_url":"https://patchwork.libcamera.org/comment/1278/","msgid":"<20190405113433.GZ23466@bigcity.dyn.berto.se>","date":"2019-04-05T11:34:33","subject":"Re: [libcamera-devel] [PATCH v3 5/8] libcamera: request: Add\n\tstreams() method","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2019-04-03 17:07:32 +0200, Jacopo Mondi wrote:\n> Add a method to retrieve the list of streams contained in a requests.\n> \n> This is useful for pipeline handler willing to cycle on all the streams\n> a request contains at queueRequest() time.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  include/libcamera/request.h |  3 +++\n>  src/libcamera/request.cpp   | 15 +++++++++++++++\n>  2 files changed, 18 insertions(+)\n> \n> diff --git a/include/libcamera/request.h b/include/libcamera/request.h\n> index 0dbd425115e8..5ac4d20d1d9f 100644\n> --- a/include/libcamera/request.h\n> +++ b/include/libcamera/request.h\n> @@ -7,6 +7,7 @@\n>  #ifndef __LIBCAMERA_REQUEST_H__\n>  #define __LIBCAMERA_REQUEST_H__\n>  \n> +#include <list>\n>  #include <map>\n>  #include <unordered_set>\n>  \n> @@ -35,6 +36,8 @@ public:\n>  \tint setBuffers(const std::map<Stream *, Buffer *> &streamMap);\n>  \tBuffer *findBuffer(Stream *stream) const;\n>  \n> +\tconst std::list<Stream *> streams() const;\n> +\n>  \tStatus status() const { return status_; }\n>  \n>  private:\n> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> index e0e77e972411..3a7841fb2bb3 100644\n> --- a/src/libcamera/request.cpp\n> +++ b/src/libcamera/request.cpp\n> @@ -93,6 +93,21 @@ Buffer *Request::findBuffer(Stream *stream) const\n>  \treturn it->second;\n>  }\n>  \n> +/**\n> + * \\brief Retrieve the set of streams contained in the request\n> + *\n> + * \\return The set of streams contained in the request\n> + */\n> +const std::list<Stream *> Request::streams() const\n\nI would make this std::set<Stream *> to have a API guarantee there are \nno duplicated Stream *. Whit this fixed,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> +{\n> +\tstd::list<Stream *> streams = {};\n> +\n> +\tfor (auto const &it : bufferMap_)\n> +\t\tstreams.push_front(it.first);\n> +\n> +\treturn streams;\n> +}\n> +\n>  /**\n>   * \\fn Request::status()\n>   * \\brief Retrieve the request completion status\n> -- \n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x142.google.com (mail-lf1-x142.google.com\n\t[IPv6:2a00:1450:4864:20::142])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6B73560DB3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Apr 2019 13:34:35 +0200 (CEST)","by mail-lf1-x142.google.com with SMTP id t15so282760lfl.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 05 Apr 2019 04:34:35 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\td4sm321635lfn.11.2019.04.05.04.34.34\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 05 Apr 2019 04:34:34 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=YDhV8+XF7JZos6P4fUVIFIAHFIOTdyzm3YWPskLcdKg=;\n\tb=s4XDSyGkNG24bbboe9bwtM2pf+IVlmQO9p+OArLXey2pYIgt6m7xWJDyldPeVOHf0R\n\t7naQiTF27YSvHvh3ptlXyK6RnCXdlxcIhFjbOEUDh33NqPhI74Ms4j50Jfefl1IyYkkf\n\tRs7Js6Ygu2hV+4wpuABvrhxtYuQmqHbCm2uc2wAJFPqwq+0JfxREJ5Bh4G3soV9tDfZk\n\t2qn7Nl7J7lYpuoM8uDJ/YYT2kCOdHx5XeCpMlLgTpFOukg3wD90y6577adIgruUt36l0\n\t3Cy6iWJjb5RBxwDTVolVK0btoqazNJBwIque3kHYHkkcPhOWbzYT5/w2QZOw4xn3XU6f\n\t7GYA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=YDhV8+XF7JZos6P4fUVIFIAHFIOTdyzm3YWPskLcdKg=;\n\tb=oiLDa4SUq8uA/d71rzkS7Y3CUgkjHE4sP66tno0PVRw9gw1bwK3r/+WkHmuNuICI+r\n\tC48do1eu4+q7tzZ0WNgMtso+kVmpVmzmW9GUHumASjcbF7mnyvm+nw8rH6P4rTHkxboa\n\t+JCnf26ya6R259LMwgbvhSNaBKe9ejthEZGbd3Yco/1prLJccS8ytltlLD5bMOiD7w8W\n\tojrcG6xjW0aosoMscY0xj4OJQEVr5S1YuDHa3JfZEIHu3ChSbIzmrLRM+NCTA458nrnt\n\tn9YVkUGqAVqYjdwaCuR0j+BRjOj1sSFHaT2/oJrHvxgzxERS2iYeAgoCPBLoKtv7LMy/\n\taBFw==","X-Gm-Message-State":"APjAAAW1x/eaT5zt//6J93kAJa32a+leD+5TRvUTshmHPVIilTOxPYTL\n\teLiFdEW42ErbvmoXTDfRYFt/k+PyJ60=","X-Google-Smtp-Source":"APXvYqzU6v5EzoqSFTGeGSpeTThC3GiYlmLVir6lp8Gufo2uDW+B2rf1EK1IJzfmia7QHpRBpvfu5w==","X-Received":"by 2002:ac2:52a6:: with SMTP id r6mr6338843lfm.27.1554464074850; \n\tFri, 05 Apr 2019 04:34:34 -0700 (PDT)","Date":"Fri, 5 Apr 2019 13:34:33 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190405113433.GZ23466@bigcity.dyn.berto.se>","References":"<20190403150735.27580-1-jacopo@jmondi.org>\n\t<20190403150735.27580-6-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190403150735.27580-6-jacopo@jmondi.org>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH v3 5/8] libcamera: request: Add\n\tstreams() method","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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, 05 Apr 2019 11:34:35 -0000"}},{"id":1287,"web_url":"https://patchwork.libcamera.org/comment/1287/","msgid":"<20190405154507.GD4636@pendragon.ideasonboard.com>","date":"2019-04-05T15:45:07","subject":"Re: [libcamera-devel] [PATCH v3 5/8] libcamera: request: Add\n\tstreams() method","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Fri, Apr 05, 2019 at 01:34:33PM +0200, Niklas Söderlund wrote:\n> On 2019-04-03 17:07:32 +0200, Jacopo Mondi wrote:\n> > Add a method to retrieve the list of streams contained in a requests.\n\ns/requests/request/\n\n> > \n> > This is useful for pipeline handler willing to cycle on all the streams\n\ns/handler/handlers/\ns/willing/that need to/\n\n> > a request contains at queueRequest() time.\n\nWouldn't it be better to expose the streams to buffers map instead ?\nThe findBuffer() method doesn't seem very nice to use.\n\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  include/libcamera/request.h |  3 +++\n> >  src/libcamera/request.cpp   | 15 +++++++++++++++\n> >  2 files changed, 18 insertions(+)\n> > \n> > diff --git a/include/libcamera/request.h b/include/libcamera/request.h\n> > index 0dbd425115e8..5ac4d20d1d9f 100644\n> > --- a/include/libcamera/request.h\n> > +++ b/include/libcamera/request.h\n> > @@ -7,6 +7,7 @@\n> >  #ifndef __LIBCAMERA_REQUEST_H__\n> >  #define __LIBCAMERA_REQUEST_H__\n> >  \n> > +#include <list>\n> >  #include <map>\n> >  #include <unordered_set>\n> >  \n> > @@ -35,6 +36,8 @@ public:\n> >  \tint setBuffers(const std::map<Stream *, Buffer *> &streamMap);\n> >  \tBuffer *findBuffer(Stream *stream) const;\n> >  \n> > +\tconst std::list<Stream *> streams() const;\n> > +\n> >  \tStatus status() const { return status_; }\n> >  \n> >  private:\n> > diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> > index e0e77e972411..3a7841fb2bb3 100644\n> > --- a/src/libcamera/request.cpp\n> > +++ b/src/libcamera/request.cpp\n> > @@ -93,6 +93,21 @@ Buffer *Request::findBuffer(Stream *stream) const\n> >  \treturn it->second;\n> >  }\n> >  \n> > +/**\n> > + * \\brief Retrieve the set of streams contained in the request\n> > + *\n> > + * \\return The set of streams contained in the request\n> > + */\n> > +const std::list<Stream *> Request::streams() const\n> \n> I would make this std::set<Stream *> to have a API guarantee there are \n> no duplicated Stream *. Whit this fixed,\n> \n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> \n> > +{\n> > +\tstd::list<Stream *> streams = {};\n> > +\n> > +\tfor (auto const &it : bufferMap_)\n> > +\t\tstreams.push_front(it.first);\n> > +\n> > +\treturn streams;\n> > +}\n> > +\n> >  /**\n> >   * \\fn Request::status()\n> >   * \\brief Retrieve the request completion status","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4237060DB3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Apr 2019 17:45:18 +0200 (CEST)","from pendragon.ideasonboard.com (unknown [109.140.214.47])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 88DAAE2;\n\tFri,  5 Apr 2019 17:45:17 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554479118;\n\tbh=27ro7tHN2mmQ3kX+Y56q9O5AYY1y60Wep06nUjRaPRc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hSRAcstaHaFdc9WlCiAmDUMyAzu1GBrl5161lQbG2uYf/a8IPIh9vgK5Pd0Jeq4m2\n\t0T0lTMG9PoLk5lvyOEPT8tMsMfyMS+v745Xnqd9KVxCqd1cJMRqnifY3NqASK5sJq6\n\tR39qL1ie+xxohgnFBgxhOjCxgygtT/fxayhbz1ZA=","Date":"Fri, 5 Apr 2019 18:45:07 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<20190405154507.GD4636@pendragon.ideasonboard.com>","References":"<20190403150735.27580-1-jacopo@jmondi.org>\n\t<20190403150735.27580-6-jacopo@jmondi.org>\n\t<20190405113433.GZ23466@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190405113433.GZ23466@bigcity.dyn.berto.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v3 5/8] libcamera: request: Add\n\tstreams() method","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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, 05 Apr 2019 15:45:18 -0000"}}]