summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2025-04-02 16:39:17 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2025-04-29 02:45:21 +0900
commitf1721c2f9fb04840a63ca173949d137bda1fa47b (patch)
tree80328107f876431ee42b0bc42f2dd8c36fa77226 /include
parent0785f5f99acb6d41149394b28a1e9c79d39a4484 (diff)
libcamera: internal: Add MediaPipeline helper
Provide a MediaPipeline class to help identifing and managing pipelines across a MediaDevice graph. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/media_pipeline.h59
-rw-r--r--include/libcamera/internal/meson.build1
2 files changed, 60 insertions, 0 deletions
diff --git a/include/libcamera/internal/media_pipeline.h b/include/libcamera/internal/media_pipeline.h
new file mode 100644
index 00000000..a7a4b8c5
--- /dev/null
+++ b/include/libcamera/internal/media_pipeline.h
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2024, Ideas on Board Oy
+ *
+ * Media pipeline support
+ */
+
+#pragma once
+
+#include <list>
+#include <string>
+
+#include <libcamera/base/log.h>
+
+namespace libcamera {
+
+class CameraSensor;
+class MediaEntity;
+class MediaLink;
+class MediaPad;
+struct V4L2SubdeviceFormat;
+
+class MediaPipeline
+{
+public:
+ int init(MediaEntity *source, std::string_view sink);
+ int initLinks();
+ int configure(CameraSensor *sensor, V4L2SubdeviceFormat *);
+
+private:
+ struct Entity {
+ /* The media entity, always valid. */
+ MediaEntity *entity;
+ /*
+ * Whether or not the entity is a subdev that supports the
+ * routing API.
+ */
+ bool supportsRouting;
+ /*
+ * The local sink pad connected to the upstream entity, null for
+ * the camera sensor at the beginning of the pipeline.
+ */
+ const MediaPad *sink;
+ /*
+ * The local source pad connected to the downstream entity, null
+ * for the video node at the end of the pipeline.
+ */
+ const MediaPad *source;
+ /*
+ * The link on the source pad, to the downstream entity, null
+ * for the video node at the end of the pipeline.
+ */
+ MediaLink *sourceLink;
+ };
+
+ std::list<Entity> entities_;
+};
+
+} /* namespace libcamera */
diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build
index 45408b31..33f318b2 100644
--- a/include/libcamera/internal/meson.build
+++ b/include/libcamera/internal/meson.build
@@ -32,6 +32,7 @@ libcamera_internal_headers = files([
'matrix.h',
'media_device.h',
'media_object.h',
+ 'media_pipeline.h',
'pipeline_handler.h',
'process.h',
'pub_key.h',