Skip to content

Commit

Permalink
screencast: cleanup screencopy_frame
Browse files Browse the repository at this point in the history
  • Loading branch information
columbarius committed Jun 17, 2021
1 parent 4bc1212 commit a110a89
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
6 changes: 0 additions & 6 deletions include/screencast_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/screencast/pipewire_screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void xdpw_pwr_export_buffer(struct xdpw_screencast_instance *cast) {
h->dts_offset = 0;
}

if (cast->screencopy_frame.y_invert) {
if (cast->simple_frame.y_invert) {
//TODO: Flip buffer or set stride negative
}

Expand All @@ -228,7 +228,7 @@ void xdpw_pwr_export_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->simple_frame.y_invert);
logprint(TRACE, "********************");

pw_stream_queue_buffer(cast->stream, pw_buf);
Expand Down
14 changes: 7 additions & 7 deletions src/screencast/wlr_screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -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->simple_frame.y_invert = flags & ZWLR_SCREENCOPY_FRAME_V1_FLAGS_Y_INVERT;
}

static void wlr_frame_ready(void *data, struct zwlr_screencopy_frame_v1 *frame,
Expand All @@ -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->simple_frame.tv_sec = ((((uint64_t)tv_sec_hi) << 32) | tv_sec_lo);
cast->simple_frame.tv_nsec = tv_nsec;

xdpw_pwr_export_buffer(cast);

Expand All @@ -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->simple_frame.damage.x = x;
cast->simple_frame.damage.y = y;
cast->simple_frame.damage.width = width;
cast->simple_frame.damage.height = height;
}

static const struct zwlr_screencopy_frame_v1_listener wlr_frame_listener = {
Expand Down

0 comments on commit a110a89

Please sign in to comment.