[{"id":1921,"web_url":"https://patchwork.libcamera.org/comment/1921/","msgid":"<20190618234429.GS23556@pendragon.ideasonboard.com>","date":"2019-06-18T23:44:29","subject":"Re: [libcamera-devel] [PATCH v3 11/16] libcamera: stream:\n\tStreamConfiguration: Add StreamFormats information","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Sun, Jun 16, 2019 at 03:33:57PM +0200, Niklas Söderlund wrote:\n> Allow StreamFormats to be associated to a StreamConfiguration. The\n> intention is that pipeline handlers should associate formats to a\n> StreamConfiguration when it's created in generateConfiguration().\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  include/libcamera/stream.h |  8 ++++----\n>  src/libcamera/stream.cpp   | 25 +++++++++++++++++++++++++\n>  2 files changed, 29 insertions(+), 4 deletions(-)\n> \n> diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\n> index 48daf5ac23f55d85..5b4fea324ce449b1 100644\n> --- a/include/libcamera/stream.h\n> +++ b/include/libcamera/stream.h\n> @@ -35,10 +35,8 @@ private:\n>  };\n>  \n>  struct StreamConfiguration {\n> -\tStreamConfiguration()\n> -\t\t: stream_(nullptr)\n> -\t{\n> -\t}\n> +\tStreamConfiguration();\n> +\tStreamConfiguration(const StreamFormats &formats);\n>  \n>  \tunsigned int pixelFormat;\n>  \tSize size;\n> @@ -47,11 +45,13 @@ struct StreamConfiguration {\n>  \n>  \tStream *stream() const { return stream_; }\n>  \tvoid setStream(Stream *stream) { stream_ = stream; }\n> +\tconst StreamFormats &formats() const { return formats_; }\n>  \n>  \tstd::string toString() const;\n>  \n>  private:\n>  \tStream *stream_;\n> +\tStreamFormats formats_;\n>  };\n>  \n>  enum StreamRole {\n> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> index 27fde5fe29eeb340..a0d77348d418917a 100644\n> --- a/src/libcamera/stream.cpp\n> +++ b/src/libcamera/stream.cpp\n> @@ -266,6 +266,19 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const\n>   * configured for a single video stream.\n>   */\n>  \n> +StreamConfiguration::StreamConfiguration()\n> +\t: stream_(nullptr)\n> +{\n> +}\n> +\n> +/**\n> + * \\brief Construct a configuration with stream formats\n> + */\n> +StreamConfiguration::StreamConfiguration(const StreamFormats &formats)\n> +\t: stream_(nullptr), formats_(formats)\n> +{\n> +}\n> +\n>  /**\n>   * \\var StreamConfiguration::size\n>   * \\brief Stream size in pixels\n> @@ -306,6 +319,18 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const\n>   * \\param[in] stream The stream\n>   */\n>  \n> +/**\n> + * \\fn StreamConfiguration::formats()\n> + * \\brief Retrieve advisory stream format information\n> + *\n> + * Retrieve information about pixel formats and sizes for possible stream\n> + * configuration. The size information is advisory and not guaranteed to\n> + * be supported by the hardware, users should always inspect the actual\n> + * size applied on the device after a camera has been configured.\n\nThis method retrieves information about the pixel formats and sizes\nsupported by the stream configuration. The sizes are advisory and not\nall of them are guaranteed to be supported by the stream. Users shall\nalways inspect the size in the stream configuration after calling\nCameraConfiguration::validate().\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> + *\n> + * \\return Stream formats information\n> + */\n> +\n>  /**\n>   * \\brief Assemble and return a string describing the configuration\n>   *","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 A6F0661A27\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Jun 2019 01:44:47 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3264AD5;\n\tWed, 19 Jun 2019 01:44:47 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1560901487;\n\tbh=3I5x7dnBjp551tt6lfiiqU4TXkQLT01w51kgvQkRurs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Dt/BBYOEuPI8brLbcB2Jie+fOcHS8yZ95DFS4SlJOHf7NgBCblIkNlEuXEbcBMqbK\n\tXW6SU+cOVIM0ECqhm+zJ5hZJzOchVN8DLwujbMDcSibx2ra49k0a+OI9dairAoeB1d\n\tjZCGJhqc4XQxUx2EKTpRIgx3KLCZy9QjCDxMAnVg=","Date":"Wed, 19 Jun 2019 02:44:29 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190618234429.GS23556@pendragon.ideasonboard.com>","References":"<20190616133402.21934-1-niklas.soderlund@ragnatech.se>\n\t<20190616133402.21934-12-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190616133402.21934-12-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v3 11/16] libcamera: stream:\n\tStreamConfiguration: Add StreamFormats information","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":"Tue, 18 Jun 2019 23:44:47 -0000"}}]