summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/device_enumerator.h1
-rw-r--r--include/libcamera/internal/media_device.h10
-rw-r--r--include/libcamera/internal/pipeline_handler.h2
3 files changed, 13 insertions, 0 deletions
diff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h
index db3532a9..4bc3a27d 100644
--- a/include/libcamera/internal/device_enumerator.h
+++ b/include/libcamera/internal/device_enumerator.h
@@ -42,6 +42,7 @@ public:
virtual int enumerate() = 0;
std::shared_ptr<MediaDevice> search(const DeviceMatch &dm);
+ std::shared_ptr<MediaDevice> searchNonExclusive(const DeviceMatch &dm);
Signal<> devicesAdded;
diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h
index 992184ed..bcbedf5c 100644
--- a/include/libcamera/internal/media_device.h
+++ b/include/libcamera/internal/media_device.h
@@ -29,9 +29,14 @@ public:
~MediaDevice();
bool acquire();
+ bool acquireNonExclusive();
void release();
bool busy() const { return acquired_; }
+ /* HACKS */
+ unsigned int get() { return ++users_; }
+ unsigned int put() { return --users_; }
+
bool lock();
void unlock();
@@ -55,6 +60,8 @@ public:
int disableLinks();
int fd() const { return fd_.get(); }
+ int fd(unsigned int context) const { return fds_[context - 1].get(); }
+ unsigned int numContexts() const { return fds_.size(); }
Signal<> disconnected;
@@ -63,6 +70,7 @@ protected:
private:
int open();
+ int openMultiple();
void close();
MediaObject *object(unsigned int id);
@@ -86,8 +94,10 @@ private:
unsigned int hwRevision_;
UniqueFD fd_;
+ std::vector<UniqueFD> fds_;
bool valid_;
bool acquired_;
+ unsigned int users_;
std::map<unsigned int, MediaObject *> objects_;
std::vector<MediaEntity *> entities_;
diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
index 746a34f8..7c316cb9 100644
--- a/include/libcamera/internal/pipeline_handler.h
+++ b/include/libcamera/internal/pipeline_handler.h
@@ -44,6 +44,8 @@ public:
virtual bool match(DeviceEnumerator *enumerator) = 0;
MediaDevice *acquireMediaDevice(DeviceEnumerator *enumerator,
const DeviceMatch &dm);
+ MediaDevice *acquireMediaDeviceNonExclusive(DeviceEnumerator *enumerator,
+ const DeviceMatch &dm);
bool acquire();
void release(Camera *camera);