[gnome-remote-desktop] rdp-pipewire-stream: Add API to resize stream



commit 37f655cba65c0548534194b7f05c21199d73a81e
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Thu Jan 20 13:18:42 2022 +0100

    rdp-pipewire-stream: Add API to resize stream
    
    Virtual monitors can be resized. As RDP allows to update the monitor
    configuration in an existing remote desktop session, add an API to
    cover this use case.

 src/grd-rdp-pipewire-stream.c | 24 ++++++++++++++++++++++++
 src/grd-rdp-pipewire-stream.h |  3 +++
 2 files changed, 27 insertions(+)
---
diff --git a/src/grd-rdp-pipewire-stream.c b/src/grd-rdp-pipewire-stream.c
index ff14dd6f..c36aab98 100644
--- a/src/grd-rdp-pipewire-stream.c
+++ b/src/grd-rdp-pipewire-stream.c
@@ -180,6 +180,30 @@ grd_rdp_frame_unref (GrdRdpFrame *frame)
     }
 }
 
+void
+grd_rdp_pipewire_stream_resize (GrdRdpPipeWireStream *stream,
+                                GrdRdpVirtualMonitor *virtual_monitor)
+{
+  struct spa_rectangle virtual_monitor_rect;
+  uint8_t params_buffer[1024];
+  struct spa_pod_builder pod_builder;
+  const struct spa_pod *params[1];
+
+  virtual_monitor_rect = SPA_RECTANGLE (virtual_monitor->width,
+                                        virtual_monitor->height);
+
+  pod_builder = SPA_POD_BUILDER_INIT (params_buffer, sizeof (params_buffer));
+
+  params[0] = spa_pod_builder_add_object (
+    &pod_builder,
+    SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
+    SPA_FORMAT_VIDEO_size, SPA_POD_Rectangle (&virtual_monitor_rect),
+    0);
+
+  pw_stream_update_params (stream->pipewire_stream,
+                           params, G_N_ELEMENTS (params));
+}
+
 static gboolean
 do_render (gpointer user_data)
 {
diff --git a/src/grd-rdp-pipewire-stream.h b/src/grd-rdp-pipewire-stream.h
index 5df72fae..407b922d 100644
--- a/src/grd-rdp-pipewire-stream.h
+++ b/src/grd-rdp-pipewire-stream.h
@@ -39,4 +39,7 @@ GrdRdpPipeWireStream *grd_rdp_pipewire_stream_new (GrdSessionRdp               *
                                                    uint32_t                     src_node_id,
                                                    GError                     **error);
 
+void grd_rdp_pipewire_stream_resize (GrdRdpPipeWireStream *stream,
+                                     GrdRdpVirtualMonitor *virtual_monitor);
+
 #endif /* GRD_RDP_PIPEWIRE_STREAM_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]