screen-cast-stream: Embed the wayland output name to streams

If a screencast session is screencasting from multiple monitors,
it is not possible to distinguish which stream (or PipeWire stream
node id) belongs to which connected monitor (such information may be useful
to the caller e.g. caller might want to embed the stream in a window
and name it after the monitor connector, for example). This change adds
optional metadata for monitor streams to also return the wayland output
name with the stream.

Ideally, this metadata should equip the caller to get more information about
display from the following Wayland interfaces:

https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output
https://wayland.app/protocols/xdg-output-unstable-v1

Related:
- https://github.com/flatpak/xdg-desktop-portal/pull/832
- https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/48

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2540>
This commit is contained in:
Salman Malik 2022-08-02 17:08:10 +00:00 committed by salmanmlk
parent dcd3bccae5
commit e2d4da8562
2 changed files with 8 additions and 0 deletions

View File

@ -221,6 +221,9 @@
compositor coordinate space.
* "size" (ii): Size of the source of the stream in the compositor
coordinate space.
* "output-name" s: Xrandr name of the output in case of X11 and
wl_output.name in case of Wayland. Available only
for monitor streams.
-->
<property name="Parameters" type="a{sv}" access="read" />

View File

@ -168,6 +168,7 @@ meta_screen_cast_monitor_stream_set_parameters (MetaScreenCastStream *stream,
MetaScreenCastMonitorStream *monitor_stream =
META_SCREEN_CAST_MONITOR_STREAM (stream);
MetaRectangle logical_monitor_layout;
const char *output_name;
logical_monitor_layout =
meta_logical_monitor_get_layout (monitor_stream->logical_monitor);
@ -182,6 +183,10 @@ meta_screen_cast_monitor_stream_set_parameters (MetaScreenCastStream *stream,
g_variant_new ("(ii)",
logical_monitor_layout.width,
logical_monitor_layout.height));
output_name = meta_monitor_get_connector (monitor_stream->monitor);
g_variant_builder_add (parameters_builder, "{sv}", "output-name",
g_variant_new ("s", output_name));
}
static gboolean