mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-03-31 09:07:13 +09:00
Refactor capture base
This commit is contained in:
@@ -33,6 +33,8 @@ struct gsr_capture {
|
||||
typedef struct gsr_capture_base gsr_capture_base;
|
||||
|
||||
struct gsr_capture_base {
|
||||
gsr_egl *egl;
|
||||
|
||||
unsigned int input_texture;
|
||||
unsigned int target_textures[2];
|
||||
unsigned int cursor_texture;
|
||||
@@ -56,11 +58,11 @@ void gsr_capture_end(gsr_capture *cap, AVFrame *frame);
|
||||
/* Calls |gsr_capture_stop| as well */
|
||||
void gsr_capture_destroy(gsr_capture *cap, AVCodecContext *video_codec_context);
|
||||
|
||||
bool gsr_capture_base_setup_vaapi_textures(gsr_capture_base *self, AVFrame *frame, gsr_egl *egl, VADisplay va_dpy, VADRMPRIMESurfaceDescriptor *prime, gsr_color_range color_range);
|
||||
bool gsr_capture_base_setup_cuda_textures(gsr_capture_base *base, AVFrame *frame, gsr_cuda_context *cuda_context, gsr_egl *egl, gsr_color_range color_range, gsr_source_color source_color, bool hdr);
|
||||
void gsr_capture_base_stop(gsr_capture_base *self, gsr_egl *egl);
|
||||
bool gsr_capture_base_setup_vaapi_textures(gsr_capture_base *self, AVFrame *frame, VADisplay va_dpy, VADRMPRIMESurfaceDescriptor *prime, gsr_color_range color_range);
|
||||
bool gsr_capture_base_setup_cuda_textures(gsr_capture_base *self, AVFrame *frame, gsr_cuda_context *cuda_context, gsr_color_range color_range, gsr_source_color source_color, bool hdr);
|
||||
void gsr_capture_base_stop(gsr_capture_base *self);
|
||||
|
||||
bool drm_create_codec_context(const char *card_path, AVCodecContext *video_codec_context, bool hdr, VADisplay *va_dpy);
|
||||
bool cuda_create_codec_context(CUcontext cu_ctx, AVCodecContext *video_codec_context, CUstream *cuda_stream);
|
||||
bool drm_create_codec_context(const char *card_path, AVCodecContext *video_codec_context, int width, int height, bool hdr, VADisplay *va_dpy);
|
||||
bool cuda_create_codec_context(CUcontext cu_ctx, AVCodecContext *video_codec_context, int width, int height, CUstream *cuda_stream);
|
||||
|
||||
#endif /* GSR_CAPTURE_CAPTURE_H */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef GSR_CAPTURE_KMS_H
|
||||
#define GSR_CAPTURE_KMS_H
|
||||
|
||||
#include "capture.h"
|
||||
#include "../../kms/client/kms_client.h"
|
||||
#include "../color_conversion.h"
|
||||
#include "../vec2.h"
|
||||
#include "../defs.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct gsr_capture_base gsr_capture_base;
|
||||
typedef struct AVCodecContext AVCodecContext;
|
||||
typedef struct AVMasteringDisplayMetadata AVMasteringDisplayMetadata;
|
||||
typedef struct AVContentLightMetadata AVContentLightMetadata;
|
||||
@@ -23,6 +23,8 @@ typedef struct {
|
||||
} MonitorId;
|
||||
|
||||
struct gsr_capture_kms {
|
||||
gsr_capture_base base;
|
||||
|
||||
bool should_stop;
|
||||
bool stop_is_error;
|
||||
|
||||
@@ -40,9 +42,9 @@ struct gsr_capture_kms {
|
||||
};
|
||||
|
||||
/* Returns 0 on success */
|
||||
int gsr_capture_kms_start(gsr_capture_kms *self, gsr_capture_base *base, const char *display_to_capture, gsr_egl *egl, AVCodecContext *video_codec_context, AVFrame *frame);
|
||||
int gsr_capture_kms_start(gsr_capture_kms *self, const char *display_to_capture, gsr_egl *egl, AVCodecContext *video_codec_context, AVFrame *frame);
|
||||
void gsr_capture_kms_stop(gsr_capture_kms *self);
|
||||
bool gsr_capture_kms_capture(gsr_capture_kms *self, gsr_capture_base *base, AVFrame *frame, gsr_egl *egl, bool hdr, bool screen_plane_use_modifiers, bool cursor_texture_is_external);
|
||||
bool gsr_capture_kms_capture(gsr_capture_kms *self, AVFrame *frame, bool hdr, bool screen_plane_use_modifiers, bool cursor_texture_is_external);
|
||||
void gsr_capture_kms_cleanup_kms_fds(gsr_capture_kms *self);
|
||||
|
||||
#endif /* GSR_CAPTURE_KMS_H */
|
||||
|
||||
@@ -42,7 +42,7 @@ typedef struct {
|
||||
void gsr_capture_xcomposite_init(gsr_capture_xcomposite *self, const gsr_capture_xcomposite_params *params);
|
||||
|
||||
int gsr_capture_xcomposite_start(gsr_capture_xcomposite *self, AVCodecContext *video_codec_context, AVFrame *frame);
|
||||
void gsr_capture_xcomposite_stop(gsr_capture_xcomposite *self, AVCodecContext *video_codec_context);
|
||||
void gsr_capture_xcomposite_stop(gsr_capture_xcomposite *self);
|
||||
void gsr_capture_xcomposite_tick(gsr_capture_xcomposite *self, AVCodecContext *video_codec_context);
|
||||
bool gsr_capture_xcomposite_should_stop(gsr_capture_xcomposite *self, bool *err);
|
||||
int gsr_capture_xcomposite_capture(gsr_capture_xcomposite *self, AVFrame *frame);
|
||||
|
||||
Reference in New Issue
Block a user