mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-03-31 09:07:13 +09:00
Prepare for pipewire audio routing
This commit is contained in:
4
include/pipewire_audio.h
Normal file
4
include/pipewire_audio.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef GSR_PIPEWIRE_AUDIO_H
|
||||
#define GSR_PIPEWIRE_AUDIO_H
|
||||
|
||||
#endif /* GSR_PIPEWIRE_AUDIO_H */
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef GSR_PIPEWIRE_H
|
||||
#define GSR_PIPEWIRE_H
|
||||
#ifndef GSR_PIPEWIRE_VIDEO_H
|
||||
#define GSR_PIPEWIRE_VIDEO_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@@ -8,9 +8,9 @@
|
||||
#include <spa/utils/hook.h>
|
||||
#include <spa/param/video/format.h>
|
||||
|
||||
#define GSR_PIPEWIRE_MAX_MODIFIERS 1024
|
||||
#define GSR_PIPEWIRE_NUM_VIDEO_FORMATS 6
|
||||
#define GSR_PIPEWIRE_DMABUF_MAX_PLANES 4
|
||||
#define GSR_PIPEWIRE_VIDEO_MAX_MODIFIERS 1024
|
||||
#define GSR_PIPEWIRE_VIDEO_NUM_VIDEO_FORMATS 6
|
||||
#define GSR_PIPEWIRE_VIDEO_DMABUF_MAX_PLANES 4
|
||||
|
||||
typedef struct gsr_egl gsr_egl;
|
||||
|
||||
@@ -18,23 +18,23 @@ typedef struct {
|
||||
int major;
|
||||
int minor;
|
||||
int micro;
|
||||
} gsr_pipewire_data_version;
|
||||
} gsr_pipewire_video_data_version;
|
||||
|
||||
typedef struct {
|
||||
uint32_t fps_num;
|
||||
uint32_t fps_den;
|
||||
} gsr_pipewire_video_info;
|
||||
} gsr_pipewire_video_video_info;
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
uint32_t offset;
|
||||
int32_t stride;
|
||||
} gsr_pipewire_dmabuf_data;
|
||||
} gsr_pipewire_video_dmabuf_data;
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
int width, height;
|
||||
} gsr_pipewire_region;
|
||||
} gsr_pipewire_video_region;
|
||||
|
||||
typedef struct {
|
||||
enum spa_video_format format;
|
||||
@@ -82,31 +82,31 @@ typedef struct {
|
||||
uint32_t width, height;
|
||||
} crop;
|
||||
|
||||
gsr_video_format supported_video_formats[GSR_PIPEWIRE_NUM_VIDEO_FORMATS];
|
||||
gsr_video_format supported_video_formats[GSR_PIPEWIRE_VIDEO_NUM_VIDEO_FORMATS];
|
||||
|
||||
gsr_pipewire_data_version server_version;
|
||||
gsr_pipewire_video_info video_info;
|
||||
gsr_pipewire_dmabuf_data dmabuf_data[GSR_PIPEWIRE_DMABUF_MAX_PLANES];
|
||||
gsr_pipewire_video_data_version server_version;
|
||||
gsr_pipewire_video_video_info video_info;
|
||||
gsr_pipewire_video_dmabuf_data dmabuf_data[GSR_PIPEWIRE_VIDEO_DMABUF_MAX_PLANES];
|
||||
size_t dmabuf_num_planes;
|
||||
|
||||
bool no_modifiers_fallback;
|
||||
bool external_texture_fallback;
|
||||
|
||||
uint64_t modifiers[GSR_PIPEWIRE_MAX_MODIFIERS];
|
||||
uint64_t modifiers[GSR_PIPEWIRE_VIDEO_MAX_MODIFIERS];
|
||||
size_t num_modifiers;
|
||||
} gsr_pipewire;
|
||||
} gsr_pipewire_video;
|
||||
|
||||
/*
|
||||
|capture_cursor| only applies to when capturing a window or region.
|
||||
In other cases |pipewire_node|'s setup will determine if the cursor is included.
|
||||
Note that the cursor is not guaranteed to be shown even if set to true, it depends on the wayland compositor.
|
||||
*/
|
||||
bool gsr_pipewire_init(gsr_pipewire *self, int pipewire_fd, uint32_t pipewire_node, int fps, bool capture_cursor, gsr_egl *egl);
|
||||
void gsr_pipewire_deinit(gsr_pipewire *self);
|
||||
bool gsr_pipewire_video_init(gsr_pipewire_video *self, int pipewire_fd, uint32_t pipewire_node, int fps, bool capture_cursor, gsr_egl *egl);
|
||||
void gsr_pipewire_video_deinit(gsr_pipewire_video *self);
|
||||
|
||||
/* |dmabuf_data| should be at least GSR_PIPEWIRE_DMABUF_MAX_PLANES in size */
|
||||
bool gsr_pipewire_map_texture(gsr_pipewire *self, gsr_texture_map texture_map, gsr_pipewire_region *region, gsr_pipewire_region *cursor_region, gsr_pipewire_dmabuf_data *dmabuf_data, int *num_dmabuf_data, uint32_t *fourcc, uint64_t *modifiers, bool *using_external_image);
|
||||
bool gsr_pipewire_is_damaged(gsr_pipewire *self);
|
||||
void gsr_pipewire_clear_damage(gsr_pipewire *self);
|
||||
/* |dmabuf_data| should be at least GSR_PIPEWIRE_VIDEO_DMABUF_MAX_PLANES in size */
|
||||
bool gsr_pipewire_video_map_texture(gsr_pipewire_video *self, gsr_texture_map texture_map, gsr_pipewire_video_region *region, gsr_pipewire_video_region *cursor_region, gsr_pipewire_video_dmabuf_data *dmabuf_data, int *num_dmabuf_data, uint32_t *fourcc, uint64_t *modifiers, bool *using_external_image);
|
||||
bool gsr_pipewire_video_is_damaged(gsr_pipewire_video *self);
|
||||
void gsr_pipewire_video_clear_damage(gsr_pipewire_video *self);
|
||||
|
||||
#endif /* GSR_PIPEWIRE_H */
|
||||
#endif /* GSR_PIPEWIRE_VIDEO_H */
|
||||
Reference in New Issue
Block a user