android: camera_device: Make CameraDevice a shared object

CameraDevice needs to be wrapper into the std::shared_ptr instead
of std::unique_ptr to enable refcounting. The refcounting will help
us to support hotplug and hot-unplug CameraHalManager operations
in the subsequent commit.

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Umang Jain
2020-08-21 14:46:08 +00:00
committed by Laurent Pinchart
parent 7197fd9d67
commit f8e2813ffe
4 changed files with 14 additions and 4 deletions

View File

@@ -47,7 +47,8 @@ struct CameraStream {
class CameraDevice : protected libcamera::Loggable
{
public:
CameraDevice(unsigned int id, const std::shared_ptr<libcamera::Camera> &camera);
static std::shared_ptr<CameraDevice> create(unsigned int id,
const std::shared_ptr<libcamera::Camera> &cam);
~CameraDevice();
int initialize();
@@ -72,6 +73,8 @@ protected:
std::string logPrefix() const override;
private:
CameraDevice(unsigned int id, const std::shared_ptr<libcamera::Camera> &camera);
struct Camera3RequestDescriptor {
Camera3RequestDescriptor(unsigned int frameNumber,
unsigned int numBuffers);