1
0
mirror of https://invent.kde.org/network/krfb synced 2024-06-29 06:24:57 +00:00

pw: Fix build with last released KPipeWire release

This commit is contained in:
Aleix Pol 2024-05-01 23:04:49 +02:00
parent 8ee8075f82
commit 0d3a38f39e
2 changed files with 17 additions and 0 deletions

View File

@ -38,6 +38,12 @@ add_library(krfb_framebuffer_pw
MODULE
${krfb_framebuffer_pw_SRCS}
)
if (KPipeWire_VERSION VERSION_LESS "6.0.80")
target_compile_definitions(krfb_framebuffer_pw PRIVATE -DKPIPEWIRE60=1)
else()
target_compile_definitions(krfb_framebuffer_pw PRIVATE -DKPIPEWIRE60=0)
endif()
set_property(TARGET krfb_framebuffer_pw PROPERTY C_STANDARD 99)
target_link_libraries(krfb_framebuffer_pw

View File

@ -340,17 +340,28 @@ void PWFrameBuffer::Private::handleFrame(const PipeWireFrame &frame)
{
cursor = frame.cursor;
#if KPIPEWIRE60
if (!frame.dmabuf && !frame.image) {
#else
if (!frame.dmabuf && !frame.dataFrame) {
#endif
qCDebug(KRFB_FB_PIPEWIRE) << "Got empty buffer. The buffer possibly carried only "
"information about the mouse cursor.";
return;
}
#if KPIPEWIRE60
if (frame.image) {
memcpy(q->fb, frame.image->constBits(), frame.image->sizeInBytes());
setVideoSize(frame.image->size());
}
#else
if (frame.dataFrame) {
// FIXME: Assuming stride == width * 4, not sure to which extent this holds
setVideoSize(frame.dataFrame->size);
memcpy(q->fb, frame.dataFrame->data, frame.dataFrame->size.width() * frame.dataFrame->stride);
}
#endif
else if (frame.dmabuf) {
// FIXME: Assuming stride == width * 4, not sure to which extent this holds
const QSize size = { frame.dmabuf->width, frame.dmabuf->height };