MediaX v1.0.0rc7 [7e6cb74]
Video streaming for military vehicles
Loading...
Searching...
No Matches
v4l2_source.h
Go to the documentation of this file.
1//
2// Copyright (c) 2025, Astute Systems PTY LTD
3//
4// This file is part of the VivoeX project developed by Astute Systems.
5//
6// Licensed under the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
7// License. See the LICENSE file in the project root for full license details.
8//
14
15#ifndef V4L2_V4L2_SOURCE_H_
16#define V4L2_V4L2_SOURCE_H_
17
18#include <fcntl.h>
19#include <linux/videodev2.h>
20#include <stdint.h>
21#include <sys/ioctl.h>
22#include <unistd.h>
23
24#include <iostream>
25#include <string>
26
29 public:
37 V4L2Capture(std::string_view device, int width, int height);
38
45
51
57 int Initalise();
58
66 bool CaptureFrame(uint8_t* buffer) const;
67
69 V4L2Capture(const V4L2Capture&) = delete;
70
71 private:
77 void PrintCaps(const v4l2_capability* cap) const;
78
80 int fd_ = -1;
82 std::string device_;
84 int width_;
88 uint8_t* buffer_ = nullptr;
89};
90
91#endif // V4L2_V4L2_SOURCE_H_
Class for Video 4 Linux 2 (V4L2) capture.
Definition v4l2_source.h:28
std::string device_
The video capture device.
Definition v4l2_source.h:82
bool CaptureFrame(uint8_t *buffer) const
Capture a frame from the V4L2 device.
Definition v4l2_source.cc:138
V4L2Capture & operator=(const V4L2Capture &)=delete
Delete the assignment operator.
int fd_
The file descriptor for the V4L2 device.
Definition v4l2_source.h:80
void PrintCaps(const v4l2_capability *cap) const
Print the capabilities of the V4L2 device.
Definition v4l2_source.cc:22
int Initalise()
Initalise the V4L2 device.
Definition v4l2_source.cc:35
uint8_t * buffer_
The buffer to store the frame in.
Definition v4l2_source.h:88
int width_
The width of the frame.
Definition v4l2_source.h:84
V4L2Capture(const V4L2Capture &)=delete
Delete the copy constructor.
int height_
The height of the frame.
Definition v4l2_source.h:86
~V4L2Capture()
Destroy the V4L2Capture::V4L2Capture object.
Definition v4l2_source.cc:125
The buffer structure.
Definition capture_yuyv.c:81