summaryrefslogtreecommitdiff
path: root/src/v4l2/v4l2_camera.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/v4l2/v4l2_camera.h')
-rw-r--r--src/v4l2/v4l2_camera.h39
1 files changed, 14 insertions, 25 deletions
diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h
index 06eab0e1..f1f04d9e 100644
--- a/src/v4l2/v4l2_camera.h
+++ b/src/v4l2/v4l2_camera.h
@@ -9,50 +9,38 @@
#define __V4L2_CAMERA_H__
#include <deque>
-#include <linux/videodev2.h>
#include <mutex>
+#include <utility>
#include <libcamera/buffer.h>
#include <libcamera/camera.h>
#include <libcamera/file_descriptor.h>
+#include <libcamera/framebuffer_allocator.h>
#include "semaphore.h"
using namespace libcamera;
-class V4L2FrameMetadata
+class V4L2Camera : public Object
{
public:
- V4L2FrameMetadata(Buffer *buffer);
-
- int index() const { return index_; }
-
- unsigned int bytesused() const { return bytesused_; }
- uint64_t timestamp() const { return timestamp_; }
- unsigned int sequence() const { return sequence_; }
-
- FrameMetadata::Status status() const { return status_; }
-
-private:
- int index_;
+ struct Buffer {
+ Buffer(unsigned int index, const FrameMetadata &data)
+ : index(index), data(data)
+ {
+ }
- unsigned int bytesused_;
- uint64_t timestamp_;
- unsigned int sequence_;
+ unsigned int index;
+ FrameMetadata data;
+ };
- FrameMetadata::Status status_;
-};
-
-class V4L2Camera : public Object
-{
-public:
V4L2Camera(std::shared_ptr<Camera> camera);
~V4L2Camera();
int open();
void close();
void getStreamConfig(StreamConfiguration *streamConfig);
- std::vector<V4L2FrameMetadata> completedBuffers();
+ std::vector<Buffer> completedBuffers();
int configure(StreamConfiguration *streamConfigOut,
const Size &size, PixelFormat pixelformat,
@@ -78,9 +66,10 @@ private:
bool isRunning_;
std::mutex bufferLock_;
+ FrameBufferAllocator *bufferAllocator_;
std::deque<std::unique_ptr<Request>> pendingRequests_;
- std::deque<std::unique_ptr<V4L2FrameMetadata>> completedBuffers_;
+ std::deque<std::unique_ptr<Buffer>> completedBuffers_;
};
#endif /* __V4L2_CAMERA_H__ */