summaryrefslogtreecommitdiff
path: root/package/gentoo/media-libs
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-10-06 17:56:50 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-10-14 20:11:26 +0200
commit4b1aa21db09df16d1a23d074e1b1c915b1b36ae4 (patch)
tree5f5126b6ca339bb27171034f1787c1ac96d356bf /package/gentoo/media-libs
parent8806863b0bc4498d098e16dda657ab6f8293d208 (diff)
android: camera_device: Queue request using Worker
Add a CameraWorker class member to the CameraDevice class and queue capture requests to it to delegate its handling. Start and stop the CameraWorker when the libcamera::Camera is started or stopped. Tie the CaptureRequest lifetime to the Camera3RequestDescriptor's one by storing it as unique_ptr<> in the descriptor to simplify handling of request creation and deletion. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'package/gentoo/media-libs')
0 files changed, 0 insertions, 0 deletions
kwc">class V4L2Camera { public: struct Buffer { Buffer(unsigned int index, const FrameMetadata &data) : index(index), data(data) { } unsigned int index; FrameMetadata data; }; V4L2Camera(std::shared_ptr<Camera> camera); ~V4L2Camera(); int open(); void close(); void bind(int efd); void unbind(); void getStreamConfig(StreamConfiguration *streamConfig); std::vector<Buffer> completedBuffers(); int configure(StreamConfiguration *streamConfigOut, const Size &size, const PixelFormat &pixelformat, unsigned int bufferCount); int validateConfiguration(const PixelFormat &pixelformat, const Size &size, StreamConfiguration *streamConfigOut); int allocBuffers(unsigned int count); void freeBuffers(); FileDescriptor getBufferFd(unsigned int index); int streamOn(); int streamOff(); int qbuf(unsigned int index); void waitForBufferAvailable(); bool isBufferAvailable(); bool isRunning(); private: void requestComplete(Request *request); std::shared_ptr<Camera> camera_; std::unique_ptr<CameraConfiguration> config_; bool isRunning_; std::mutex bufferLock_; FrameBufferAllocator *bufferAllocator_; std::deque<std::unique_ptr<Request>> pendingRequests_; std::deque<std::unique_ptr<Buffer>> completedBuffers_; int efd_; Mutex bufferMutex_; std::condition_variable bufferCV_; unsigned int bufferAvailableCount_; }; #endif /* __V4L2_CAMERA_H__ */