Refactor nvfbc into abstract capture api

This commit is contained in:
dec05eba
2022-10-14 01:16:31 +02:00
parent 9d65552d05
commit 93d46b9767
11 changed files with 525 additions and 306 deletions

25
include/capture/capture.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef GSR_CAPTURE_CAPTURE_H
#define GSR_CAPTURE_CAPTURE_H
#include <stdbool.h>
typedef struct AVFrame AVFrame;
typedef struct gsr_capture gsr_capture;
struct gsr_capture {
int (*start)(gsr_capture *cap);
void (*stop)(gsr_capture *cap);
int (*capture)(gsr_capture *cap, AVFrame *frame);
void (*destroy)(gsr_capture *cap);
void *priv;
};
int gsr_capture_start(gsr_capture *cap);
void gsr_capture_stop(gsr_capture *cap);
int gsr_capture_capture(gsr_capture *cap, AVFrame *frame);
/* Calls |gsr_capture_stop| as well */
void gsr_capture_destroy(gsr_capture *cap);
#endif /* GSR_CAPTURE_CAPTURE_H */

17
include/capture/nvfbc.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef GSR_CAPTURE_NVFBC_H
#define GSR_CAPTURE_NVFBC_H
#include "capture.h"
#include "../vec2.h"
typedef struct {
const char *display_to_capture; /* if this is "screen", then the entire x11 screen is captured (all displays) */
int fps;
vec2i pos;
vec2i size;
bool direct_capture; /* temporary disabled */
} gsr_capture_nvfbc_params;
gsr_capture* gsr_capture_nvfbc_create(const gsr_capture_nvfbc_params *params);
#endif /* GSR_CAPTURE_NVFBC_H */