summaryrefslogtreecommitdiff
path: root/src/libcamera/camera.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-01-26 20:43:22 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-02-01 08:11:33 +0100
commit75476f86d2eb5074e3e6713b193f7a31a6b8ac52 (patch)
tree5deee8cb0d32fcef13b4b08889df5871fc50634c /src/libcamera/camera.cpp
parentff96eb2ebb714cef37de8e2ff19c3e56ba8bc91b (diff)
libcamera: camera: extend camera object to support streams
A camera consists of one or more video streams originating from the same video source. The different streams could for example have access to different hardware blocks in the video pipeline and therefore be able to process the video source in different ways. All static information describing each stream need to be recorded at camera creation. After a camera is created an application can retrieve the static information about its streams at any time. Update all pipeline handlers to register one stream per camera, this will be extended in the future for some of the pipelines. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/camera.cpp')
-rw-r--r--src/libcamera/camera.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 500976b2..49f49fb7 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -6,6 +6,7 @@
*/
#include <libcamera/camera.h>
+#include <libcamera/stream.h>
#include "log.h"
#include "pipeline_handler.h"
@@ -56,13 +57,15 @@ LOG_DECLARE_CATEGORY(Camera)
* \brief Create a camera instance
* \param[in] name The name of the camera device
* \param[in] pipe The pipeline handler responsible for the camera device
+ * \param[in] streams Array of streams the camera provides
*
* The caller is responsible for guaranteeing unicity of the camera name.
*
* \return A shared pointer to the newly created camera object
*/
std::shared_ptr<Camera> Camera::create(PipelineHandler *pipe,
- const std::string &name)
+ const std::string &name,
+ const std::vector<Stream *> &streams)
{
struct Allocator : std::allocator<Camera> {
void construct(void *p, PipelineHandler *pipe,
@@ -76,7 +79,12 @@ std::shared_ptr<Camera> Camera::create(PipelineHandler *pipe,
}
};
- return std::allocate_shared<Camera>(Allocator(), pipe, name);
+ std::shared_ptr<Camera> camera =
+ std::allocate_shared<Camera>(Allocator(), pipe, name);
+
+ camera->streams_ = streams;
+
+ return camera;
}
/**
@@ -164,4 +172,18 @@ void Camera::release()
acquired_ = false;
}
+/**
+ * \brief Retrieve all the camera's stream information
+ *
+ * Retrieve all of the camera's static stream information. The static
+ * information describes among other things how many streams the camera
+ * supports and the capabilities of each stream.
+ *
+ * \return An array of all the camera's streams.
+ */
+const std::vector<Stream *> &Camera::streams() const
+{
+ return streams_;
+}
+
} /* namespace libcamera */