{"id":835,"url":"https://patchwork.libcamera.org/api/patches/835/?format=json","web_url":"https://patchwork.libcamera.org/patch/835/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20190402005332.25018-5-niklas.soderlund@ragnatech.se>","date":"2019-04-02T00:53:31","name":"[libcamera-devel,RFC,4/5] libcamera: stream: Add basic stream usage hints definitions","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f87222e5077eeaf4743319ded17a6c6ecec8a1a9","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":{"id":16,"url":"https://patchwork.libcamera.org/api/users/16/?format=json","username":"neg","first_name":"Niklas","last_name":"Söderlund","email":"niklas.soderlund@ragnatech.se"},"mbox":"https://patchwork.libcamera.org/patch/835/mbox/","series":[{"id":227,"url":"https://patchwork.libcamera.org/api/series/227/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=227","date":"2019-04-02T00:53:27","name":"libcamera: camera: Add support for stream usage hint","version":1,"mbox":"https://patchwork.libcamera.org/series/227/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/835/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/835/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A4B73610BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Apr 2019 02:54:02 +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 cde5a054-54e1-11e9-846a-005056917a89;\n\tTue, 02 Apr 2019 02:54:01 +0200 (CEST)"],"X-Halon-ID":"cde5a054-54e1-11e9-846a-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":"Tue,  2 Apr 2019 02:53:31 +0200","Message-Id":"<20190402005332.25018-5-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190402005332.25018-1-niklas.soderlund@ragnatech.se>","References":"<20190402005332.25018-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC 4/5] libcamera: stream: Add basic stream\n\tusage hints definitions","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, 02 Apr 2019 00:54:02 -0000"},"content":"In preparation of reworking how a default configuration is retrieved\nfrom a camera add stream usage hints. The hints will be used by\napplications to describe how it intends to use a camera and replace the\nStream IDs role when retrieving default configuration from the camera\nusing streamConfiguration().\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/libcamera/stream.h | 39 ++++++++++++++++++\n src/libcamera/stream.cpp   | 84 ++++++++++++++++++++++++++++++++++++++\n 2 files changed, 123 insertions(+)","diff":"diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\nindex 3e8e83a2ff245879..445b80de66217934 100644\n--- a/include/libcamera/stream.h\n+++ b/include/libcamera/stream.h\n@@ -35,7 +35,46 @@ private:\n \tStreamConfiguration configuration_;\n };\n \n+class StreamHint\n+{\n+public:\n+\tenum Type {\n+\t\tViewfinder,\n+\t\tVideo,\n+\t\tStill,\n+\t};\n \n+\tType type() const { return type_; }\n+\n+protected:\n+\tStreamHint(Type type);\n+\tStreamHint(Type type, StreamConfiguration hints);\n+\n+private:\n+\tType type_;\n+\tStreamConfiguration hints_;\n+};\n+\n+class Viewfinder : public StreamHint\n+{\n+public:\n+\tViewfinder(unsigned int width, unsigned int height);\n+\n+private:\n+\tstatic StreamConfiguration initHints(unsigned int width, unsigned int height);\n+};\n+\n+class Video : public StreamHint\n+{\n+public:\n+\tVideo();\n+};\n+\n+class Still : public StreamHint\n+{\n+public:\n+\tStill();\n+};\n \n } /* namespace libcamera */\n \ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex c4943c91b2e6ce13..32f26a1f8e6adb2c 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -102,4 +102,88 @@ Stream::Stream()\n  * \\return The active configuration of the stream\n  */\n \n+/**\n+ * \\class StreamHint\n+ * \\brief Stream usage hint information\n+ *\n+ * The StreamHint class carries information about stream usage hints from the\n+ * application to a specific pipeline handler implementation. The pipeline\n+ * handler shall take the usage hints into account when select which stream\n+ * to use for the desired operation.\n+ */\n+\n+/**\n+ * \\enum StreamHint::Type\n+ * \\brief List of types of usage hints\n+ */\n+\n+/**\n+ * \\fn StreamHint::type()\n+ * \\brief Retrieve the usage hint type\n+ * \\return The hint type\n+ */\n+\n+/**\n+ * \\brief Create a stream hint\n+ * \\param[in] type Stream hint type\n+ */\n+StreamHint::StreamHint(Type type)\n+\t: type_(type), hints_()\n+{\n+}\n+\n+/**\n+ * \\brief Create a stream hint with parameters\n+ * \\param[in] type Stream hint type\n+ * \\param[in] hints Stream hint parameters\n+ */\n+StreamHint::StreamHint(Type type, StreamConfiguration hints)\n+\t: type_(type), hints_(hints)\n+{\n+}\n+\n+/**\n+ * \\class Viewfinder\n+ * \\brief Stream usage hint for viewfinder\n+ */\n+\n+/**\n+ * \\brief Create a viewfinder stream hint\n+ * \\param[in] width Desired view finder width\n+ * \\param[in] height Desired view finder height\n+ */\n+Viewfinder::Viewfinder(unsigned int width, unsigned int height)\n+\t: StreamHint(Type::Viewfinder, initHints(width, height))\n+{\n+}\n+\n+StreamConfiguration Viewfinder::initHints(unsigned int width,\n+\t\t\t\t\t  unsigned int height)\n+{\n+\tStreamConfiguration hints = {};\n+\n+\thints.width = width;\n+\thints.height = height;\n+\n+\treturn hints;\n+}\n+\n+/**\n+ * \\class Video\n+ * \\brief Stream usage hint for video\n+ */\n+Video::Video()\n+\t: StreamHint(Type::Video)\n+{\n+}\n+\n+/**\n+ * \\class Still\n+ * \\brief Stream usage hint for still images\n+ */\n+Still::Still()\n+\t: StreamHint(Type::Still)\n+{\n+}\n+\n } /* namespace libcamera */\n","prefixes":["libcamera-devel","RFC","4/5"]}