diff --git a/cmake/modules/FindPipeWire.cmake b/cmake/modules/FindPipeWire.cmake --- a/cmake/modules/FindPipeWire.cmake +++ b/cmake/modules/FindPipeWire.cmake @@ -32,7 +32,7 @@ #============================================================================= # Copyright 2014 Alex Merry # Copyright 2014 Martin Gräßlin -# Copyright 2018 Jan Grulich +# Copyright 2018-2020 Jan Grulich # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -61,21 +61,29 @@ # Use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig QUIET) -pkg_check_modules(PKG_PipeWire QUIET libpipewire-0.2 libpipewire-0.3) -set(PipeWire_DEFINITIONS "${PKG_PipeWire_CFLAGS_OTHER}") +pkg_search_module(PKG_PipeWire QUIET libpipewire-0.3 libpipewire-0.2) +pkg_search_module(PKG_Spa QUIET libspa-0.2 libspa-0.1) + +set(PipeWire_DEFINITIONS "${PKG_PipeWire_CFLAGS}" "${PKG_Spa_CFLAGS}") set(PipeWire_VERSION "${PKG_PipeWire_VERSION}") find_path(PipeWire_INCLUDE_DIRS NAMES + pipewire-0.3/pipewire/pipewire.h + spa-0.2/spa/param/props.h + # Old PipeWire locations pipewire/pipewire.h + spa/param/props.h HINTS ${PKG_PipeWire_INCLUDE_DIRS} + ${PKG_Spa_INCLUDE_DIRS} ) find_library(PipeWire_LIBRARIES NAMES - pipewire-0.2 pipewire-0.3 + pipewire-0.3 + pipewire-0.2 HINTS ${PKG_PipeWire_LIBRARIES_DIRS} ) diff --git a/src/screencaststream.cpp b/src/screencaststream.cpp --- a/src/screencaststream.cpp +++ b/src/screencaststream.cpp @@ -249,7 +249,6 @@ int32_t width, height, stride, size; struct spa_pod_builder pod_builder; const struct spa_pod *params[1]; - const int bpp = 4; #if PW_CHECK_VERSION(0, 2, 90) if (!format || id != SPA_PARAM_Format) { @@ -268,7 +267,7 @@ width = pw->videoFormat.size.width; height =pw->videoFormat.size.height; - stride = SPA_ROUND_UP_N (width * bpp, 4); + stride = SPA_ROUND_UP_N (width * BITS_PER_PIXEL, 4); size = height * stride; pod_builder = SPA_POD_BUILDER_INIT (paramsBuffer, sizeof (paramsBuffer)); @@ -518,7 +517,9 @@ memcpy(data, screenData, BITS_PER_PIXEL * videoFormat.size.height * videoFormat.size.width * sizeof(uint8_t)); + spa_buffer->datas[0].chunk->offset = 0; spa_buffer->datas[0].chunk->size = spa_buffer->datas[0].maxsize; + spa_buffer->datas[0].chunk->stride = SPA_ROUND_UP_N (videoFormat.size.width * BITS_PER_PIXEL, 4); pw_stream_queue_buffer(pwStream, buffer); return true;