From 201d98f63131242bb8871ed0c4a3ae9ebd4ef030 Mon Sep 17 00:00:00 2001 From: Nikita Kostovsky Date: Sun, 12 Jan 2025 17:57:45 +0100 Subject: start refactoring. non-working commit --- src/camera/ov9281.h | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/camera/ov9281.h (limited to 'src/camera/ov9281.h') diff --git a/src/camera/ov9281.h b/src/camera/ov9281.h new file mode 100644 index 0000000..f70db2f --- /dev/null +++ b/src/camera/ov9281.h @@ -0,0 +1,68 @@ +#pragma once + +#include +#include +#include + +#include +#include + +namespace libcamera { +class Camera; +class CameraConfiguration; +class CameraManager; +class FrameBufferAllocator; +class Request; +} // namespace libcamera + +class Image; +class Pixels; + +class OV9281 +{ +public: + ~OV9281(); + +public: + static std::vector> search( + std::unique_ptr &manager); + + // public functions +public: + bool startStream(); + void printControls(); + + // signals +public: + // TODO: image->pixels in separate thread + // TODO: respect sender/receiver threads + libcamera::Signal> newPixels; + +private: + explicit OV9281(const std::shared_ptr &camera); + + // private functions +private: + bool init(); + bool validateConfig(); + bool applyConfig(); + + void onRequestCompleted(libcamera::Request *completed_request); + + // constants +private: + static inline constexpr auto pixelFormat{libcamera::formats::R16}; + static inline constexpr unsigned int bufferCount{2}; + static inline constexpr size_t desiredFPS{144}; + + // member variables +private: + std::shared_ptr m_camera{nullptr}; + std::unique_ptr m_config{nullptr}; + std::map> m_mappedBuffers; + std::vector> m_requests; + std::unique_ptr m_allocator{nullptr}; + + // TODO: set exposureTime from outside + int32_t m_exposureTime{1000}; +}; -- cgit v1.2.3-70-g09d2