@@ -15,6 +15,7 @@
namespace libcamera {
+class Buffer;
class PipelineHandler;
class Stream;
class StreamConfiguration;
@@ -41,6 +42,9 @@ public:
streamConfiguration(std::vector<Stream *> &streams);
int configureStreams(std::map<Stream *, StreamConfiguration> &config);
+ int start();
+ int stop();
+
private:
Camera(PipelineHandler *pipe, const std::string &name);
~Camera();
@@ -6,6 +6,7 @@
*/
#include <libcamera/camera.h>
+#include <libcamera/request.h>
#include <libcamera/stream.h>
#include "log.h"
@@ -248,4 +249,51 @@ int Camera::configureStreams(std::map<Stream *, StreamConfiguration> &config)
return pipe_->configureStreams(this, config);
}
+/**
+ * \brief Start capture from camera
+ *
+ * Start the camera capture session. Once the camera is started the application
+ * can queue requests to the camera to process and return to the application
+ * until the capture session is terminated with \a stop().
+ *
+ * \return 0 on success or a negative error code on error.
+ * \retval -ENODEV The camera is not connected to any hardware
+ * \retval -EACCES The user has not acquired exclusive access to the camera
+ */
+int Camera::start()
+{
+ if (disconnected_)
+ return -ENODEV;
+
+ if (!acquired_)
+ return -EACCES;
+
+ return pipe_->start(this);
+}
+
+/**
+ * \brief Stop capture from camera
+ *
+ * Stop the running capture session. Once the camera is stooped the may not
+ * queue any new requests and any already queued requests might that have not
+ * been queued to the hardware might be returned to the application not
+ * fulfilled.
+ *
+ * \return 0 on success or a negative error code on error.
+ * \retval -ENODEV The camera is not connected to any hardware
+ * \retval -EACCES The user has not acquired exclusive access to the camera
+ */
+int Camera::stop()
+{
+ if (disconnected_)
+ return -ENODEV;
+
+ if (!acquired_)
+ return -EACCES;
+
+ pipe_->stop(this);
+
+ return 0;
+}
+
} /* namespace libcamera */
Add an interface for the application to start and stop a camera. Once a camera is started the pipeline handler of the camera will begin processing request queued to the camera by the application until it's stopped. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> --- include/libcamera/camera.h | 4 ++++ src/libcamera/camera.cpp | 48 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+)