screencast: cleanup screencopy_frame

Move duplicated information to xdpw_frame and remove them from
xdpw_screencopy_frame.
This commit is contained in:
columbarius 2021-06-17 01:37:30 +02:00
parent 4d892f2a43
commit 27d1e42ec0
3 changed files with 9 additions and 15 deletions

View file

@ -57,13 +57,7 @@ struct xdpw_screencopy_frame {
uint32_t height;
uint32_t size;
uint32_t stride;
bool y_invert;
uint64_t tv_sec;
uint32_t tv_nsec;
enum wl_shm_format format;
struct xdpw_frame_damage damage;
struct wl_buffer *buffer;
void *data;
};
struct xdpw_screencast_context {

View file

@ -208,7 +208,7 @@ void xdpw_pwr_enqueue_buffer(struct xdpw_screencast_instance *cast) {
h->dts_offset = 0;
}
if (cast->screencopy_frame.y_invert) {
if (cast->current_frame.y_invert) {
//TODO: Flip buffer or set stride negative
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: width %d", cast->screencopy_frame.width);
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, "********************");
pw_stream_queue_buffer(cast->stream, pw_buf);

View file

@ -123,7 +123,7 @@ static void wlr_frame_flags(void *data, struct zwlr_screencopy_frame_v1 *frame,
struct xdpw_screencast_instance *cast = data;
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,
@ -132,8 +132,8 @@ static void wlr_frame_ready(void *data, struct zwlr_screencopy_frame_v1 *frame,
logprint(TRACE, "wlroots: ready event handler");
cast->screencopy_frame.tv_sec = ((((uint64_t)tv_sec_hi) << 32) | tv_sec_lo);
cast->screencopy_frame.tv_nsec = tv_nsec;
cast->current_frame.tv_sec = ((((uint64_t)tv_sec_hi) << 32) | tv_sec_lo);
cast->current_frame.tv_nsec = tv_nsec;
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");
cast->screencopy_frame.damage.x = x;
cast->screencopy_frame.damage.y = y;
cast->screencopy_frame.damage.width = width;
cast->screencopy_frame.damage.height = height;
cast->current_frame.damage.x = x;
cast->current_frame.damage.y = y;
cast->current_frame.damage.width = width;
cast->current_frame.damage.height = height;
}
static const struct zwlr_screencopy_frame_v1_listener wlr_frame_listener = {