rename device -> video capture
This commit is contained in:
+21
-19
@@ -19,7 +19,7 @@ static Context context;
|
||||
static ShaderProgram program;
|
||||
static Window *window_output;
|
||||
static Window *window_monitor;
|
||||
static VideoDevice *devices;
|
||||
static VideoCapture *video_captures;
|
||||
static File *fragment_shaders;
|
||||
static File common_shader_code;
|
||||
static Timer timer;
|
||||
@@ -145,37 +145,38 @@ static void free_files(unsigned int frag_count) {
|
||||
file_free(&common_shader_code, true);
|
||||
}
|
||||
|
||||
static void init_devices(char *video_in[MAX_VIDEO], unsigned int video_count,
|
||||
unsigned int internal_size) {
|
||||
static void init_video_captures(char *video_in[MAX_VIDEO],
|
||||
unsigned int video_count,
|
||||
unsigned int internal_size) {
|
||||
unsigned int i;
|
||||
|
||||
devices = malloc(video_count * sizeof(VideoDevice));
|
||||
video_captures = malloc(video_count * sizeof(VideoCapture));
|
||||
|
||||
for (i = 0; i < video_count; i++) {
|
||||
devices[i] = video_init(video_in[i], internal_size);
|
||||
video_captures[i] = video_init(video_in[i], internal_size);
|
||||
}
|
||||
}
|
||||
|
||||
static void start_devices(unsigned int video_count) {
|
||||
static void start_video_captures(unsigned int video_count) {
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < video_count; i++) {
|
||||
if (!devices[i].error) {
|
||||
video_background_read(&devices[i], &stop);
|
||||
if (!video_captures[i].error) {
|
||||
video_background_read(&video_captures[i], &stop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void free_devices(unsigned int video_count) {
|
||||
static void free_video_captures(unsigned int video_count) {
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < video_count; i++) {
|
||||
shaders_free_video(program, devices[i]);
|
||||
shaders_free_video(program, video_captures[i]);
|
||||
|
||||
video_free(devices[i]);
|
||||
video_free(video_captures[i]);
|
||||
}
|
||||
|
||||
free(devices);
|
||||
free(video_captures);
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char *description) {
|
||||
@@ -243,7 +244,8 @@ void forge_run(Parameters params) {
|
||||
|
||||
context.internal_height = params.internal_size;
|
||||
|
||||
init_devices(params.video_in, params.video_count, params.internal_size);
|
||||
init_video_captures(params.video_in, params.video_count,
|
||||
params.internal_size);
|
||||
|
||||
if (params.output) {
|
||||
window_output = window_init(PACKAGE " " VERSION, params.output_screen,
|
||||
@@ -251,8 +253,8 @@ void forge_run(Parameters params) {
|
||||
|
||||
window_use(window_output, &context);
|
||||
|
||||
program = shaders_init(fragment_shaders, shader_config, context, devices,
|
||||
params.video_count, NULL);
|
||||
program = shaders_init(fragment_shaders, shader_config, context,
|
||||
video_captures, params.video_count, NULL);
|
||||
} else {
|
||||
window_output = NULL;
|
||||
}
|
||||
@@ -264,8 +266,8 @@ void forge_run(Parameters params) {
|
||||
|
||||
window_use(window_monitor, &context);
|
||||
|
||||
program = shaders_init(fragment_shaders, shader_config, context, devices,
|
||||
params.video_count,
|
||||
program = shaders_init(fragment_shaders, shader_config, context,
|
||||
video_captures, params.video_count,
|
||||
window_output != NULL ? &program : NULL);
|
||||
} else {
|
||||
window_monitor = NULL;
|
||||
@@ -280,7 +282,7 @@ void forge_run(Parameters params) {
|
||||
|
||||
timer = timer_init(30);
|
||||
|
||||
start_devices(params.video_count);
|
||||
start_video_captures(params.video_count);
|
||||
|
||||
log_info("Initialized");
|
||||
|
||||
@@ -307,7 +309,7 @@ void forge_run(Parameters params) {
|
||||
shaders_free_window(program, params.output);
|
||||
}
|
||||
|
||||
free_devices(params.video_count);
|
||||
free_video_captures(params.video_count);
|
||||
|
||||
free_context();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user