{"id":1461,"url":"https://patchwork.libcamera.org/api/1.1/patches/1461/?format=json","web_url":"https://patchwork.libcamera.org/patch/1461/","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":"<20190619025129.21164-12-niklas.soderlund@ragnatech.se>","date":"2019-06-19T02:51:24","name":"[libcamera-devel,v4,11/16] libcamera: stream: StreamConfiguration: Add StreamFormats information","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"84fc835dd0dedad78e82546c16bdd78f41f7895b","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/1.1/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1461/mbox/","series":[{"id":361,"url":"https://patchwork.libcamera.org/api/1.1/series/361/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=361","date":"2019-06-19T02:51:13","name":"libcamera: Add support for format information and validation","version":4,"mbox":"https://patchwork.libcamera.org/series/361/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1461/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1461/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B611261A2C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Jun 2019 04:52:30 +0200 (CEST)","from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 3f65d020-923d-11e9-8ab4-005056917a89;\n\tWed, 19 Jun 2019 04:52:17 +0200 (CEST)"],"X-Halon-ID":"3f65d020-923d-11e9-8ab4-005056917a89","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 19 Jun 2019 04:51:24 +0200","Message-Id":"<20190619025129.21164-12-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190619025129.21164-1-niklas.soderlund@ragnatech.se>","References":"<20190619025129.21164-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 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":"Wed, 19 Jun 2019 02:52:30 -0000"},"content":"Allow StreamFormats to be associated to a StreamConfiguration. The\nintention is that pipeline handlers should associate formats to a\nStreamConfiguration when it's created in generateConfiguration().\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/stream.h |  8 ++++----\n src/libcamera/stream.cpp   | 25 +++++++++++++++++++++++++\n 2 files changed, 29 insertions(+), 4 deletions(-)","diff":"diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\nindex 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 {\ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex bfb072d691ae0e25..cfa7a327fdd0f1a8 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -270,6 +270,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@@ -310,6 +323,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+ * This method retrieves information about the pixel formats and sizes supported\n+ * by the stream configuration. The sizes are advisory and not all of them are\n+ * guaranteed to be supported by the stream. Users shall always inspect the size\n+ * in the stream configuration after calling CameraConfiguration::validate().\n+ *\n+ * \\return Stream formats information\n+ */\n+\n /**\n  * \\brief Assemble and return a string describing the configuration\n  *\n","prefixes":["libcamera-devel","v4","11/16"]}