mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-29 09:25:57 +01:00
screencast: cleanup screencopy_frame
Move duplicated information to xdpw_frame and remove them from xdpw_screencopy_frame.
This commit is contained in:
parent
4d892f2a43
commit
27d1e42ec0
3 changed files with 9 additions and 15 deletions
|
@ -57,13 +57,7 @@ struct xdpw_screencopy_frame {
|
||||||
uint32_t height;
|
uint32_t height;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
uint32_t stride;
|
uint32_t stride;
|
||||||
bool y_invert;
|
|
||||||
uint64_t tv_sec;
|
|
||||||
uint32_t tv_nsec;
|
|
||||||
enum wl_shm_format format;
|
enum wl_shm_format format;
|
||||||
struct xdpw_frame_damage damage;
|
|
||||||
struct wl_buffer *buffer;
|
|
||||||
void *data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xdpw_screencast_context {
|
struct xdpw_screencast_context {
|
||||||
|
|
|
@ -208,7 +208,7 @@ void xdpw_pwr_enqueue_buffer(struct xdpw_screencast_instance *cast) {
|
||||||
h->dts_offset = 0;
|
h->dts_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cast->screencopy_frame.y_invert) {
|
if (cast->current_frame.y_invert) {
|
||||||
//TODO: Flip buffer or set stride negative
|
//TODO: Flip buffer or set stride negative
|
||||||
cast->err = 1;
|
cast->err = 1;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ void xdpw_pwr_enqueue_buffer(struct xdpw_screencast_instance *cast) {
|
||||||
logprint(TRACE, "pipewire: stride %d", d[0].chunk->stride);
|
logprint(TRACE, "pipewire: stride %d", d[0].chunk->stride);
|
||||||
logprint(TRACE, "pipewire: width %d", cast->screencopy_frame.width);
|
logprint(TRACE, "pipewire: width %d", cast->screencopy_frame.width);
|
||||||
logprint(TRACE, "pipewire: height %d", cast->screencopy_frame.height);
|
logprint(TRACE, "pipewire: height %d", cast->screencopy_frame.height);
|
||||||
logprint(TRACE, "pipewire: y_invert %d", cast->screencopy_frame.y_invert);
|
logprint(TRACE, "pipewire: y_invert %d", cast->current_frame.y_invert);
|
||||||
logprint(TRACE, "********************");
|
logprint(TRACE, "********************");
|
||||||
|
|
||||||
pw_stream_queue_buffer(cast->stream, pw_buf);
|
pw_stream_queue_buffer(cast->stream, pw_buf);
|
||||||
|
|
|
@ -123,7 +123,7 @@ static void wlr_frame_flags(void *data, struct zwlr_screencopy_frame_v1 *frame,
|
||||||
struct xdpw_screencast_instance *cast = data;
|
struct xdpw_screencast_instance *cast = data;
|
||||||
|
|
||||||
logprint(TRACE, "wlroots: flags event handler");
|
logprint(TRACE, "wlroots: flags event handler");
|
||||||
cast->screencopy_frame.y_invert = flags & ZWLR_SCREENCOPY_FRAME_V1_FLAGS_Y_INVERT;
|
cast->current_frame.y_invert = flags & ZWLR_SCREENCOPY_FRAME_V1_FLAGS_Y_INVERT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_frame_ready(void *data, struct zwlr_screencopy_frame_v1 *frame,
|
static void wlr_frame_ready(void *data, struct zwlr_screencopy_frame_v1 *frame,
|
||||||
|
@ -132,8 +132,8 @@ static void wlr_frame_ready(void *data, struct zwlr_screencopy_frame_v1 *frame,
|
||||||
|
|
||||||
logprint(TRACE, "wlroots: ready event handler");
|
logprint(TRACE, "wlroots: ready event handler");
|
||||||
|
|
||||||
cast->screencopy_frame.tv_sec = ((((uint64_t)tv_sec_hi) << 32) | tv_sec_lo);
|
cast->current_frame.tv_sec = ((((uint64_t)tv_sec_hi) << 32) | tv_sec_lo);
|
||||||
cast->screencopy_frame.tv_nsec = tv_nsec;
|
cast->current_frame.tv_nsec = tv_nsec;
|
||||||
|
|
||||||
xdpw_pwr_enqueue_buffer(cast);
|
xdpw_pwr_enqueue_buffer(cast);
|
||||||
|
|
||||||
|
@ -158,10 +158,10 @@ static void wlr_frame_damage(void *data, struct zwlr_screencopy_frame_v1 *frame,
|
||||||
|
|
||||||
logprint(TRACE, "wlroots: damage event handler");
|
logprint(TRACE, "wlroots: damage event handler");
|
||||||
|
|
||||||
cast->screencopy_frame.damage.x = x;
|
cast->current_frame.damage.x = x;
|
||||||
cast->screencopy_frame.damage.y = y;
|
cast->current_frame.damage.y = y;
|
||||||
cast->screencopy_frame.damage.width = width;
|
cast->current_frame.damage.width = width;
|
||||||
cast->screencopy_frame.damage.height = height;
|
cast->current_frame.damage.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct zwlr_screencopy_frame_v1_listener wlr_frame_listener = {
|
static const struct zwlr_screencopy_frame_v1_listener wlr_frame_listener = {
|
||||||
|
|
Loading…
Reference in a new issue