feat: video auto reconnect
Clang Lint CI / lint-no-video (push) Successful in 56s
Clang Build CI / run-no-video (push) Successful in 59s
Clang Build CI / run-video (push) Successful in 1m15s
Clang Build CI / build-release (push) Successful in 2m23s
Clang Lint CI / lint-video (push) Successful in 2m14s
Clang Lint CI / lint-no-video (push) Successful in 56s
Clang Build CI / run-no-video (push) Successful in 59s
Clang Build CI / run-video (push) Successful in 1m15s
Clang Build CI / build-release (push) Successful in 2m23s
Clang Lint CI / lint-video (push) Successful in 2m14s
This commit is contained in:
+65
-41
@@ -135,34 +135,6 @@ typedef struct ShaderProgram {
|
||||
#endif /* VIDEO_IN */
|
||||
} ShaderProgram;
|
||||
|
||||
// video.c
|
||||
|
||||
typedef struct VideoCapture {
|
||||
char name[STR_LEN];
|
||||
bool error;
|
||||
bool disconnected;
|
||||
bool needs_reload;
|
||||
bool with_swap;
|
||||
bool swap;
|
||||
unsigned int fps;
|
||||
int fd;
|
||||
int exp_fd;
|
||||
int exp_fd_swap;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int pixelformat;
|
||||
unsigned int bytesperline;
|
||||
#ifdef VIDEO_IN
|
||||
struct v4l2_buffer buf;
|
||||
struct v4l2_buffer buf_swap;
|
||||
#endif /* VIDEO_IN */
|
||||
} VideoCapture;
|
||||
|
||||
typedef struct VideoCaptureArray {
|
||||
VideoCapture values[MAX_VIDEO];
|
||||
unsigned int length;
|
||||
} VideoCaptureArray;
|
||||
|
||||
// window.c
|
||||
|
||||
typedef GLFWwindow Window;
|
||||
@@ -182,11 +154,16 @@ typedef struct Tempo {
|
||||
|
||||
// context.c
|
||||
|
||||
typedef struct SharedContext {
|
||||
typedef struct Context {
|
||||
int fd;
|
||||
vec2 resolution;
|
||||
vec2 tex_resolution;
|
||||
#ifdef VIDEO_IN
|
||||
vec2 input_resolutions[MAX_VIDEO];
|
||||
unsigned int input_formats[MAX_VIDEO];
|
||||
unsigned int input_fps[MAX_VIDEO];
|
||||
bool input_swap[MAX_VIDEO];
|
||||
#endif /* VIDEO_IN */
|
||||
double time;
|
||||
Tempo tempo;
|
||||
double tempo_total;
|
||||
@@ -200,9 +177,59 @@ typedef struct SharedContext {
|
||||
unsigned int auto_random_cycle;
|
||||
unsigned int seeds[MAX_FRAG];
|
||||
unsigned int fps;
|
||||
VideoCaptureArray inputs;
|
||||
bool stop;
|
||||
} SharedContext;
|
||||
_Atomic bool stop;
|
||||
} Context;
|
||||
|
||||
// video.c
|
||||
|
||||
#ifdef VIDEO_IN
|
||||
|
||||
typedef struct VideoCapture {
|
||||
char name[STR_LEN];
|
||||
_Atomic bool error;
|
||||
_Atomic bool disconnected;
|
||||
_Atomic bool needs_reload;
|
||||
bool with_swap;
|
||||
_Atomic bool swap;
|
||||
int fd;
|
||||
int exp_fd;
|
||||
int exp_fd_swap;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int pixelformat;
|
||||
unsigned int bytesperline;
|
||||
struct v4l2_buffer buf;
|
||||
struct v4l2_buffer buf_swap;
|
||||
} VideoCapture;
|
||||
|
||||
typedef struct VideoCaptureArray {
|
||||
VideoCapture values[MAX_VIDEO];
|
||||
unsigned int length;
|
||||
} VideoCaptureArray;
|
||||
|
||||
typedef struct VideoBackgroundReadArgs {
|
||||
VideoCapture *capture;
|
||||
Context *context;
|
||||
int input_index;
|
||||
bool trace_fps;
|
||||
} VideoBackgroundReadArgs;
|
||||
|
||||
#endif /* VIDEO_IN */
|
||||
|
||||
// midi.c
|
||||
|
||||
typedef struct MidiDevice {
|
||||
bool error;
|
||||
char name[STR_LEN];
|
||||
snd_rawmidi_t *input;
|
||||
snd_rawmidi_t *output;
|
||||
} MidiDevice;
|
||||
|
||||
typedef struct MidiBackgroundListenArgs {
|
||||
MidiDevice *device;
|
||||
Context *context;
|
||||
void (*event_callback)(unsigned char code, unsigned char value);
|
||||
} MidiBackgroundReadArgs;
|
||||
|
||||
// state.c
|
||||
|
||||
@@ -240,6 +267,12 @@ typedef struct StateConfig {
|
||||
UintArray hotkey_save;
|
||||
} StateConfig;
|
||||
|
||||
typedef struct StateBackgroundWriteArgs {
|
||||
Context *context;
|
||||
StateConfig state_config;
|
||||
MidiDevice *midi;
|
||||
} StateBackgroundWriteArgs;
|
||||
|
||||
// timer.c
|
||||
|
||||
typedef struct Timer {
|
||||
@@ -260,15 +293,6 @@ typedef struct ConfigFileItem {
|
||||
char value[STR_LEN];
|
||||
} ConfigFileItem;
|
||||
|
||||
// midi.c
|
||||
|
||||
typedef struct MidiDevice {
|
||||
bool error;
|
||||
char name[STR_LEN];
|
||||
snd_rawmidi_t *input;
|
||||
snd_rawmidi_t *output;
|
||||
} MidiDevice;
|
||||
|
||||
// project.c
|
||||
|
||||
typedef struct Project {
|
||||
|
||||
Reference in New Issue
Block a user