/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Copyright (C) 2019, Google Inc. * * v4l2_camera.h - V4L2 compatibility camera */ #pragma once #include #include #include #include #include #include #include #include class V4L2Camera { public: struct Buffer { Buffer(unsigned int index, const libcamera::FrameMetadata &data) : index_(index), data_(data) { } unsigned int index_; libcamera::FrameMetadata data_; }; V4L2Camera(std::shared_ptr camera); ~V4L2Camera(); int open(libcamera::StreamConfiguration *streamConfig); void close(); void bind(int efd); void unbind(); std::vector completedBuffers(); int configure(libcamera::StreamConfiguration *streamConfigOut, const libcamera::Size &size, const libcamera::PixelFormat &pixelformat, unsigned int bufferCount); int validateConfiguration(const libcamera::PixelFormat &pixelformat, const libcamera::Size &size, libcamera::StreamConfiguration *streamConfigOut); int allocBuffers(unsigned int count); void freeBuffers(); int getBufferFd(unsigned int index); int streamOn(); int streamOff(); int qbuf(unsigned int index); void waitForBufferAvailable(); bool isBufferAvailable(); bool isRunning(); private: void requestComplete(libcamera::Request *request); std::shared_ptr camera_; std::unique_ptr config_; bool isRunning_; libcamera::Mutex bufferLock_; libcamera::FrameBufferAllocator *bufferAllocator_; std::vector> requestPool_; std::deque pendingRequests_; std::deque> completedBuffers_; int efd_; libcamera::Mutex bufferMutex_; libcamera::ConditionVariable bufferCV_; unsigned int bufferAvailableCount_; }; cons/battery-charging.svg?h=vivid-pre-a07968bed276&id=f71c76ceff7ad13490fd77800059ab2bd2a61498'>diff
blob: 644cb59cb67a99eac85c6032d6802df1be3302f0 (plain)
1
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-battery-charging"><path d="M5 18H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3.19M15 6h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-3.19"></path><line x1="23" y1="13" x2="23" y2="11"></line><polyline points="11 6 7 12 13 12 9 18"></polyline></svg>