screencast: send transform to pw

This commit is contained in:
vaxerski 2023-04-25 17:16:21 +01:00
parent f9f08c802e
commit c0e2339555
4 changed files with 25 additions and 17 deletions

View File

@ -149,6 +149,7 @@ struct xdpw_wlr_output {
int width;
int height;
float framerate;
enum wl_output_transform transform;
};
struct xdpw_share {

View File

@ -24,7 +24,7 @@ add_project_arguments('-DSYSCONFDIR="@0@"'.format(join_paths(prefix, sysconfdir)
inc = include_directories('include')
rt = cc.find_library('rt')
pipewire = dependency('libpipewire-0.3', version: '>= 0.3.41')
pipewire = dependency('libpipewire-0.3', version: '>= 0.3.62')
hyprland_protos = dependency('hyprland-protocols', version: '>=0.2', fallback: 'hyprland-protocols')
wayland_client = dependency('wayland-client')
wayland_protos = dependency('wayland-protocols', version: '>=1.24')
@ -39,12 +39,6 @@ if (not cc.has_function('timerfd_create', prefix: '#include <sys/timerfd.h>') or
epoll = dependency('epoll-shim')
endif
if pipewire.version() == '0.3.49'
add_project_arguments(cc.get_supported_arguments([
'-D_GNU_SOURCE',
]), language: 'c')
endif
if get_option('sd-bus-provider') == 'auto'
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
sdbus = dependency('libsystemd',

View File

@ -1,19 +1,20 @@
#include "pipewire_screencast.h"
#include <pipewire/pipewire.h>
#include <spa/utils/result.h>
#include <spa/param/props.h>
#include <spa/param/format-utils.h>
#include <spa/param/video/format-utils.h>
#include <spa/pod/dynamic.h>
#include <sys/mman.h>
#include <unistd.h>
#include <assert.h>
#include <libdrm/drm_fourcc.h>
#include <pipewire/pipewire.h>
#include <spa/buffer/meta.h>
#include <spa/param/format-utils.h>
#include <spa/param/props.h>
#include <spa/param/video/format-utils.h>
#include <spa/pod/dynamic.h>
#include <spa/utils/result.h>
#include <sys/mman.h>
#include <unistd.h>
#include "logger.h"
#include "wlr_screencast.h"
#include "xdpw.h"
#include "logger.h"
static struct spa_pod *build_buffer(struct spa_pod_builder *b, uint32_t blocks, uint32_t size,
uint32_t stride, uint32_t datatype) {
@ -316,7 +317,12 @@ fixate_format:
SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header)));
params[2] = spa_pod_builder_add_object(&b[2].b,
params[2] = spa_pod_builder_add_object(&b[1].b,
SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
SPA_PARAM_META_type, SPA_POD_Id(SPA_META_VideoTransform),
SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_videotransform)));
params[3] = spa_pod_builder_add_object(&b[2].b,
SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
SPA_PARAM_META_type, SPA_POD_Id(SPA_META_VideoDamage),
SPA_PARAM_META_size, SPA_POD_CHOICE_RANGE_Int(
@ -449,6 +455,12 @@ void xdpw_pwr_enqueue_buffer(struct xdpw_screencast_instance *cast) {
logprint(TRACE, "pipewire: timestamp %"PRId64, h->pts);
}
struct spa_meta_videotransform *vt;
if ((vt = spa_buffer_find_meta_data(spa_buf, SPA_META_VideoTransform, sizeof(*vt)))) {
vt->transform = cast->target.output->transform;
logprint(TRACE, "pipewire: transform %u", vt->transform);
}
struct spa_meta *damage;
if ((damage = spa_buffer_find_meta(spa_buf, SPA_META_VideoDamage))) {
struct spa_region *d_region = spa_meta_first(damage);

View File

@ -551,6 +551,7 @@ static void wlr_output_handle_geometry(void *data, struct wl_output *wl_output,
struct xdpw_wlr_output *output = data;
output->make = strdup(make);
output->model = strdup(model);
output->transform = transform;
}
static void wlr_output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int32_t width, int32_t height, int32_t refresh) {