diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2021-06-19 12:10:54 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo@jmondi.org> | 2021-06-23 09:04:15 +0200 |
commit | 4bb81dfcc4a7d2134986bb64b733c41388b8060d (patch) | |
tree | 9f88225c3110d3eb32e05abfd6047019e1a6cb0d /src/android/camera_device.h | |
parent | d7041114d3b00f87a4bf6deb2d1d0c85c61830a0 (diff) |
android: Introduce CameraCapabilties class
The camera_device.cpp has grown a little too much, and it has quickly
become hard to maintain. Break out the handling of the static
information collected at camera initialization time to a new
CameraCapabilities class.
Break out from the camera_device.cpp file all the functions related to:
- Initialization of supported stream configurations
- Initialization of static metadata
- Initialization of request templates
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Diffstat (limited to 'src/android/camera_device.h')
-rw-r--r-- | src/android/camera_device.h | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 4aadb27c..090fe28a 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -10,14 +10,12 @@ #include <map> #include <memory> #include <mutex> -#include <tuple> #include <vector> #include <hardware/camera3.h> #include <libcamera/buffer.h> #include <libcamera/camera.h> -#include <libcamera/geometry.h> #include <libcamera/request.h> #include <libcamera/stream.h> @@ -26,6 +24,7 @@ #include "libcamera/internal/message.h" #include "libcamera/internal/thread.h" +#include "camera_capabilities.h" #include "camera_metadata.h" #include "camera_stream.h" #include "camera_worker.h" @@ -57,7 +56,7 @@ public: const std::string &model() const { return model_; } int facing() const { return facing_; } int orientation() const { return orientation_; } - unsigned int maxJpegBufferSize() const { return maxJpegBufferSize_; } + unsigned int maxJpegBufferSize() const; void setCallbacks(const camera3_callback_ops_t *callbacks); const camera_metadata_t *getStaticMetadata(); @@ -86,11 +85,6 @@ private: std::unique_ptr<CaptureRequest> request_; }; - struct Camera3StreamConfiguration { - libcamera::Size resolution; - int androidFormat; - }; - enum class State { Stopped, Flushing, @@ -99,22 +93,11 @@ private: void stop(); - int initializeStreamConfigurations(); - std::vector<libcamera::Size> - getYUVResolutions(libcamera::CameraConfiguration *cameraConfig, - const libcamera::PixelFormat &pixelFormat, - const std::vector<libcamera::Size> &resolutions); - std::vector<libcamera::Size> - getRawResolutions(const libcamera::PixelFormat &pixelFormat); - libcamera::FrameBuffer *createFrameBuffer(const buffer_handle_t camera3buffer); void abortRequest(camera3_capture_request_t *request); void notifyShutter(uint32_t frameNumber, uint64_t timestamp); void notifyError(uint32_t frameNumber, camera3_stream_t *stream, camera3_error_msg_code code); - std::unique_ptr<CameraMetadata> requestTemplatePreview(); - std::unique_ptr<CameraMetadata> requestTemplateVideo(); - libcamera::PixelFormat toPixelFormat(int format) const; int processControls(Camera3RequestDescriptor *descriptor); std::unique_ptr<CameraMetadata> getResultMetadata( const Camera3RequestDescriptor &descriptor) const; @@ -129,13 +112,11 @@ private: std::shared_ptr<libcamera::Camera> camera_; std::unique_ptr<libcamera::CameraConfiguration> config_; + CameraCapabilities capabilities_; - std::unique_ptr<CameraMetadata> staticMetadata_; std::map<unsigned int, std::unique_ptr<CameraMetadata>> requestTemplates_; const camera3_callback_ops_t *callbacks_; - std::vector<Camera3StreamConfiguration> streamConfigurations_; - std::map<int, libcamera::PixelFormat> formatsMap_; std::vector<CameraStream> streams_; libcamera::Mutex descriptorsMutex_; /* Protects descriptors_. */ @@ -147,8 +128,6 @@ private: int facing_; int orientation_; - unsigned int maxJpegBufferSize_; - CameraMetadata lastSettings_; }; |