{"id":506,"url":"https://patchwork.libcamera.org/api/1.1/patches/506/?format=json","web_url":"https://patchwork.libcamera.org/patch/506/","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":"<20190205000702.15370-4-niklas.soderlund@ragnatech.se>","date":"2019-02-05T00:06:58","name":"[libcamera-devel,RFC,3/7] libcamera: camera: implement start and stop of a camera","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"dc5e947fb2c820071391b590ddf2a3dedbbae49e","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":{"id":16,"url":"https://patchwork.libcamera.org/api/1.1/users/16/?format=json","username":"neg","first_name":"Niklas","last_name":"Söderlund","email":"niklas.soderlund@ragnatech.se"},"mbox":"https://patchwork.libcamera.org/patch/506/mbox/","series":[{"id":168,"url":"https://patchwork.libcamera.org/api/1.1/series/168/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=168","date":"2019-02-05T00:06:55","name":"libcamera: extend camera and pipeline to support requests","version":1,"mbox":"https://patchwork.libcamera.org/series/168/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/506/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/506/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7068E60DC2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Feb 2019 01:07:56 +0100 (CET)","from localhost.localdomain (unknown [81.164.19.127])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 14d7db0e-28da-11e9-b530-005056917a89;\n\tTue, 05 Feb 2019 01:07:53 +0100 (CET)"],"X-Halon-ID":"14d7db0e-28da-11e9-b530-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,  5 Feb 2019 01:06:58 +0100","Message-Id":"<20190205000702.15370-4-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190205000702.15370-1-niklas.soderlund@ragnatech.se>","References":"<20190205000702.15370-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC 3/7] libcamera: camera: implement start and\n\tstop of a camera","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, 05 Feb 2019 00:07:56 -0000"},"content":"Add an interface for the application to start and stop a camera. Once a\ncamera is started the pipeline handler of the camera will begin\nprocessing request queued to the camera by the application until it's\nstopped.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/libcamera/camera.h |  4 ++++\n src/libcamera/camera.cpp   | 48 ++++++++++++++++++++++++++++++++++++++\n 2 files changed, 52 insertions(+)","diff":"diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 4940c344440e2ca2..de338c616641c074 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -15,6 +15,7 @@\n \n namespace libcamera {\n \n+class Buffer;\n class PipelineHandler;\n class Stream;\n class StreamConfiguration;\n@@ -41,6 +42,9 @@ public:\n \tstreamConfiguration(std::vector<Stream *> &streams);\n \tint configureStreams(std::map<Stream *, StreamConfiguration> &config);\n \n+\tint start();\n+\tint stop();\n+\n private:\n \tCamera(PipelineHandler *pipe, const std::string &name);\n \t~Camera();\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex bcf3d54ab1c3eb29..bf09acfdb9cd0007 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -6,6 +6,7 @@\n  */\n \n #include <libcamera/camera.h>\n+#include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n #include \"log.h\"\n@@ -248,4 +249,51 @@ int Camera::configureStreams(std::map<Stream *, StreamConfiguration> &config)\n \treturn pipe_->configureStreams(this, config);\n }\n \n+/**\n+ * \\brief Start capture from camera\n+ *\n+ * Start the camera capture session. Once the camera is started the application\n+ * can queue requests to the camera to process and return to the application\n+ * until the capture session is terminated with \\a stop().\n+ *\n+ * \\return 0 on success or a negative error code on error.\n+ * \\retval -ENODEV The camera is not connected to any hardware\n+ * \\retval -EACCES The user has not acquired exclusive access to the camera\n+ */\n+int Camera::start()\n+{\n+\tif (disconnected_)\n+\t\treturn -ENODEV;\n+\n+\tif (!acquired_)\n+\t\treturn -EACCES;\n+\n+\treturn pipe_->start(this);\n+}\n+\n+/**\n+ * \\brief Stop capture from camera\n+ *\n+ * Stop the running capture session. Once the camera is stooped the may not\n+ * queue any new requests and any already queued requests might that have not\n+ * been queued to the hardware might be returned to the application not\n+ * fulfilled.\n+ *\n+ * \\return 0 on success or a negative error code on error.\n+ * \\retval -ENODEV The camera is not connected to any hardware\n+ * \\retval -EACCES The user has not acquired exclusive access to the camera\n+ */\n+int Camera::stop()\n+{\n+\tif (disconnected_)\n+\t\treturn -ENODEV;\n+\n+\tif (!acquired_)\n+\t\treturn -EACCES;\n+\n+\tpipe_->stop(this);\n+\n+\treturn 0;\n+}\n+\n } /* namespace libcamera */\n","prefixes":["libcamera-devel","RFC","3/7"]}