android: camera_request: Turn struct into a class
The Camera3RequestDescriptor structure is growing into an object with member functions. Turn it into a class, uninline the destructor to reduce code size, explicitly disable copy as requests are not copyable, and delete the default constructor to force all instances to be fully constructed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
parent
109a98e8c0
commit
030c8f1a7e
3 changed files with 15 additions and 8 deletions
|
@ -33,7 +33,7 @@
|
||||||
#include "camera_worker.h"
|
#include "camera_worker.h"
|
||||||
#include "jpeg/encoder.h"
|
#include "jpeg/encoder.h"
|
||||||
|
|
||||||
struct Camera3RequestDescriptor;
|
class Camera3RequestDescriptor;
|
||||||
struct CameraConfigData;
|
struct CameraConfigData;
|
||||||
|
|
||||||
class CameraDevice : protected libcamera::Loggable
|
class CameraDevice : protected libcamera::Loggable
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \struct Camera3RequestDescriptor
|
* \class Camera3RequestDescriptor
|
||||||
*
|
*
|
||||||
* A utility structure that groups information about a capture request to be
|
* A utility class that groups information about a capture request to be later
|
||||||
* later re-used at request complete time to notify the framework.
|
* reused at request complete time to notify the framework.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Camera3RequestDescriptor::Camera3RequestDescriptor(
|
Camera3RequestDescriptor::Camera3RequestDescriptor(
|
||||||
|
@ -43,3 +43,5 @@ Camera3RequestDescriptor::Camera3RequestDescriptor(
|
||||||
request_ = std::make_unique<CaptureRequest>(camera,
|
request_ = std::make_unique<CaptureRequest>(camera,
|
||||||
reinterpret_cast<uint64_t>(this));
|
reinterpret_cast<uint64_t>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Camera3RequestDescriptor::~Camera3RequestDescriptor() = default;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <libcamera/base/class.h>
|
||||||
|
|
||||||
#include <libcamera/camera.h>
|
#include <libcamera/camera.h>
|
||||||
#include <libcamera/framebuffer.h>
|
#include <libcamera/framebuffer.h>
|
||||||
|
|
||||||
|
@ -18,18 +20,18 @@
|
||||||
#include "camera_metadata.h"
|
#include "camera_metadata.h"
|
||||||
#include "camera_worker.h"
|
#include "camera_worker.h"
|
||||||
|
|
||||||
struct Camera3RequestDescriptor {
|
class Camera3RequestDescriptor
|
||||||
|
{
|
||||||
|
public:
|
||||||
enum class Status {
|
enum class Status {
|
||||||
Pending,
|
Pending,
|
||||||
Success,
|
Success,
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
Camera3RequestDescriptor() = default;
|
|
||||||
~Camera3RequestDescriptor() = default;
|
|
||||||
Camera3RequestDescriptor(libcamera::Camera *camera,
|
Camera3RequestDescriptor(libcamera::Camera *camera,
|
||||||
const camera3_capture_request_t *camera3Request);
|
const camera3_capture_request_t *camera3Request);
|
||||||
Camera3RequestDescriptor &operator=(Camera3RequestDescriptor &&) = default;
|
~Camera3RequestDescriptor();
|
||||||
|
|
||||||
bool isPending() const { return status_ == Status::Pending; }
|
bool isPending() const { return status_ == Status::Pending; }
|
||||||
|
|
||||||
|
@ -41,6 +43,9 @@ struct Camera3RequestDescriptor {
|
||||||
|
|
||||||
camera3_capture_result_t captureResult_ = {};
|
camera3_capture_result_t captureResult_ = {};
|
||||||
Status status_ = Status::Pending;
|
Status status_ = Status::Pending;
|
||||||
|
|
||||||
|
private:
|
||||||
|
LIBCAMERA_DISABLE_COPY(Camera3RequestDescriptor)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ANDROID_CAMERA_REQUEST_H__ */
|
#endif /* __ANDROID_CAMERA_REQUEST_H__ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue