#pragma once #include "image.hpp" #include #include #include #include #include namespace cms { struct CameraConfig { std::string device{"/dev/video5"}; int width{1920},height{1536},fps{30},buffers{4},timeout_ms{2000}; }; struct CapturedFrame { CaptureMetadata metadata; std::shared_ptr image; // Present only for offline replay; keeps original timestamps and context. std::shared_ptr replay_record; }; // The capture thread exclusively owns read(); requestStop() is thread safe. class Camera { public: explicit Camera(CameraConfig config); ~Camera(); Camera(Camera const&)=delete; Camera& operator=(Camera const&)=delete; std::optional read(); void requestStop() noexcept; private: struct Impl; std::unique_ptr impl_; }; std::uint64_t monotonicNs(); }