[libcamera-devel,v3,4/9] libcamera: Add MediaDeviceVirtual
diff mbox series

Message ID 20230105043726.679968-5-chenghaoyang@google.com
State Superseded
Headers show
Series
  • Virtual pipeline handler
Related show

Commit Message

Harvey Yang Jan. 5, 2023, 4:37 a.m. UTC
Add a dummy class MediaDeviceVirtual, which will be used in the virtual
pipeline handler and unit tests.

Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
---
 .../libcamera/internal/media_device_virtual.h | 21 ++++++++++++++++++
 include/libcamera/internal/meson.build        |  1 +
 src/libcamera/media_device_virtual.cpp        | 22 +++++++++++++++++++
 src/libcamera/meson.build                     |  1 +
 4 files changed, 45 insertions(+)
 create mode 100644 include/libcamera/internal/media_device_virtual.h
 create mode 100644 src/libcamera/media_device_virtual.cpp

Patch
diff mbox series

diff --git a/include/libcamera/internal/media_device_virtual.h b/include/libcamera/internal/media_device_virtual.h
new file mode 100644
index 00000000..f1b48b20
--- /dev/null
+++ b/include/libcamera/internal/media_device_virtual.h
@@ -0,0 +1,21 @@ 
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2022, Google Inc.
+ *
+ * media_device.h - Media device handler
+ */
+
+#pragma once
+
+#include "libcamera/internal/media_device_base.h"
+
+namespace libcamera {
+
+class MediaDeviceVirtual : public MediaDeviceBase
+{
+public:
+	MediaDeviceVirtual(const std::string &deviceNode);
+	~MediaDeviceVirtual();
+};
+
+} /* namespace libcamera */
diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build
index 826a241c..9deebd01 100644
--- a/include/libcamera/internal/meson.build
+++ b/include/libcamera/internal/meson.build
@@ -32,6 +32,7 @@  libcamera_internal_headers = files([
     'mapped_framebuffer.h',
     'media_device.h',
     'media_device_base.h',
+    'media_device_virtual.h',
     'media_object.h',
     'pipeline_handler.h',
     'process.h',
diff --git a/src/libcamera/media_device_virtual.cpp b/src/libcamera/media_device_virtual.cpp
new file mode 100644
index 00000000..ce06a0da
--- /dev/null
+++ b/src/libcamera/media_device_virtual.cpp
@@ -0,0 +1,22 @@ 
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2022, Google Inc.
+ *
+ * media_device.h - Media device handler
+ */
+
+#include "libcamera/internal/media_device_virtual.h"
+
+namespace libcamera {
+
+LOG_DEFINE_CATEGORY(MediaDeviceVirtual)
+
+MediaDeviceVirtual::MediaDeviceVirtual(const std::string &deviceNode)
+	: MediaDeviceBase(deviceNode)
+{
+	driver_ = "virtual";
+}
+
+MediaDeviceVirtual::~MediaDeviceVirtual() = default;
+
+} /* namespace libcamera */
diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index ce4c1a29..e0927aee 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -33,6 +33,7 @@  libcamera_sources = files([
     'mapped_framebuffer.cpp',
     'media_device.cpp',
     'media_device_base.cpp',
+    'media_device_virtual.cpp',
     'media_object.cpp',
     'pipeline_handler.cpp',
     'pixel_format.cpp',