lcameraDev: Add session mgr lib for libcamera device binding
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#ifndef LCAMERA_DEV_CAMERA_SESSION_H
|
||||
#define LCAMERA_DEV_CAMERA_SESSION_H
|
||||
|
||||
#include <cameraIdentity.h>
|
||||
#include <libcamera/camera.h>
|
||||
#include <memory>
|
||||
#include <spinscale/co/coQutex.h>
|
||||
#include <spinscale/sharedResourceGroup.h>
|
||||
|
||||
namespace lcamera_dev {
|
||||
|
||||
struct CameraSessionResources
|
||||
{
|
||||
CameraSessionResources(
|
||||
const CameraIdentityRecord& identity,
|
||||
const std::shared_ptr<libcamera::Camera>& camera)
|
||||
: identity(identity), camera(camera)
|
||||
{}
|
||||
|
||||
int refcount = 0;
|
||||
CameraIdentityRecord identity;
|
||||
std::shared_ptr<libcamera::Camera> camera;
|
||||
};
|
||||
|
||||
class CameraSession
|
||||
{
|
||||
public:
|
||||
CameraSession(
|
||||
const CameraIdentityRecord& identity,
|
||||
const std::shared_ptr<libcamera::Camera>& camera);
|
||||
|
||||
const CameraIdentityRecord& getIdentityRecord() const
|
||||
{ return s.rsrc.identity; }
|
||||
|
||||
const std::shared_ptr<libcamera::Camera>& getCamera() const
|
||||
{ return s.rsrc.camera; }
|
||||
|
||||
void incrementRefcount();
|
||||
bool decrementRefcount();
|
||||
|
||||
sscl::SharedResourceGroup<sscl::co::CoQutex, CameraSessionResources> s;
|
||||
};
|
||||
|
||||
} // namespace lcamera_dev
|
||||
|
||||
#endif // LCAMERA_DEV_CAMERA_SESSION_H
|
||||
Reference in New Issue
Block a user