mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-02 05:36:31 +00:00
Initial commit
This commit is contained in:
52
src/device.h
Normal file
52
src/device.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <linux/videodev2.h>
|
||||
|
||||
|
||||
#define FORMAT_UNKNOWN -1
|
||||
#define STANDARD_UNKNOWN V4L2_STD_UNKNOWN
|
||||
|
||||
|
||||
struct buffer {
|
||||
void *start;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
struct device_runtime {
|
||||
int fd;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned format;
|
||||
unsigned n_buffers;
|
||||
struct buffer *buffers;
|
||||
bool capturing;
|
||||
};
|
||||
|
||||
struct device {
|
||||
char *path;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned format;
|
||||
v4l2_std_id standard;
|
||||
bool dv_timings;
|
||||
unsigned n_buffers;
|
||||
unsigned every_frame;
|
||||
unsigned min_frame_size;
|
||||
unsigned jpeg_quality;
|
||||
unsigned timeout;
|
||||
unsigned error_timeout;
|
||||
|
||||
struct device_runtime *run;
|
||||
bool *stop;
|
||||
};
|
||||
|
||||
|
||||
void device_init(struct device *dev, struct device_runtime *run, bool *const stop);
|
||||
|
||||
int device_parse_format(const char *const str);
|
||||
v4l2_std_id device_parse_standard(const char *const str);
|
||||
|
||||
int device_open(struct device *dev);
|
||||
void device_close(struct device *dev);
|
||||
Reference in New Issue
Block a user