mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 14:35:57 +01:00
screencast: create pwr_update_stream_param
This will let us notify pipewire that our buffer has changed and trigger a renegotiation cycle which will take care of reallocating the buffers
This commit is contained in:
parent
50cb55ed1d
commit
f2d08cc5b5
2 changed files with 17 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
||||||
#define XDPW_PWR_BUFFERS 1
|
#define XDPW_PWR_BUFFERS 1
|
||||||
#define XDPW_PWR_ALIGN 16
|
#define XDPW_PWR_ALIGN 16
|
||||||
|
|
||||||
|
void pwr_update_stream_param(struct xdpw_screencast_instance *cast);
|
||||||
void xdpw_pwr_stream_create(struct xdpw_screencast_instance *cast);
|
void xdpw_pwr_stream_create(struct xdpw_screencast_instance *cast);
|
||||||
void xdpw_pwr_stream_destroy(struct xdpw_screencast_instance *cast);
|
void xdpw_pwr_stream_destroy(struct xdpw_screencast_instance *cast);
|
||||||
int xdpw_pwr_context_create(struct xdpw_state *state);
|
int xdpw_pwr_context_create(struct xdpw_state *state);
|
||||||
|
|
|
@ -169,6 +169,22 @@ static const struct pw_stream_events pwr_stream_events = {
|
||||||
.param_changed = pwr_handle_stream_param_changed,
|
.param_changed = pwr_handle_stream_param_changed,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void pwr_update_stream_param(struct xdpw_screencast_instance *cast) {
|
||||||
|
logprint(TRACE, "pipewire: stream update parameters");
|
||||||
|
struct pw_stream *stream = cast->stream;
|
||||||
|
uint8_t params_buffer[1024];
|
||||||
|
struct spa_pod_builder b =
|
||||||
|
SPA_POD_BUILDER_INIT(params_buffer, sizeof(params_buffer));
|
||||||
|
const struct spa_pod *params[1];
|
||||||
|
|
||||||
|
enum spa_video_format format = xdpw_format_pw_from_wl_shm(cast->simple_frame.format);
|
||||||
|
|
||||||
|
params[0] = build_format(&b, format,
|
||||||
|
cast->simple_frame.width, cast->simple_frame.height, cast->framerate);
|
||||||
|
|
||||||
|
pw_stream_update_params(stream, params, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void xdpw_pwr_stream_create(struct xdpw_screencast_instance *cast) {
|
void xdpw_pwr_stream_create(struct xdpw_screencast_instance *cast) {
|
||||||
struct xdpw_screencast_context *ctx = cast->ctx;
|
struct xdpw_screencast_context *ctx = cast->ctx;
|
||||||
struct xdpw_state *state = ctx->state;
|
struct xdpw_state *state = ctx->state;
|
||||||
|
|
Loading…
Reference in a new issue