mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 11:00:54 -05:00
screen-cast-stream-src: Always advertise support for BGRA
Some clients - notably the Gstreamer vapostproc element when using Intel GPUs - only support BGRA, not BGRx. We already assume that we can support this format for window screen casts, and even in case of failure we now have a re-negotiation fallback in place. Thus it's pretty safe to support it for all screen cast types. The possible duplication in case of window screen casts doesn't seem to be a problem for either Pipewire or existing clients like OBS. Note that the implementation lays the foundation to make it easy to add more formats in the future. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3617>
This commit is contained in:
parent
77186c2063
commit
037077bb56
@ -992,10 +992,9 @@ build_format_params (MetaScreenCastStreamSrc *src,
|
|||||||
MetaScreenCast *screen_cast =
|
MetaScreenCast *screen_cast =
|
||||||
meta_screen_cast_session_get_screen_cast (session);
|
meta_screen_cast_session_get_screen_cast (session);
|
||||||
GArray *modifiers;
|
GArray *modifiers;
|
||||||
CoglPixelFormat preferred_cogl_format =
|
CoglPixelFormat preferred_cogl_format;
|
||||||
meta_screen_cast_stream_src_get_preferred_format (src);
|
enum spa_video_format preferred_spa_video_format = 0;
|
||||||
enum spa_video_format preferred_spa_video_format;
|
enum spa_video_format spa_video_formats[G_N_ELEMENTS (supported_formats)];
|
||||||
enum spa_video_format spa_video_formats[2];
|
|
||||||
int n_spa_video_formats = 0;
|
int n_spa_video_formats = 0;
|
||||||
struct spa_rectangle default_size = DEFAULT_SIZE;
|
struct spa_rectangle default_size = DEFAULT_SIZE;
|
||||||
struct spa_rectangle min_size = MIN_SIZE;
|
struct spa_rectangle min_size = MIN_SIZE;
|
||||||
@ -1022,14 +1021,16 @@ build_format_params (MetaScreenCastStreamSrc *src,
|
|||||||
min_size = max_size = default_size = SPA_RECTANGLE (width, height);
|
min_size = max_size = default_size = SPA_RECTANGLE (width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferred_cogl_format != DEFAULT_COGL_PIXEL_FORMAT &&
|
preferred_cogl_format = meta_screen_cast_stream_src_get_preferred_format (src);
|
||||||
spa_video_format_from_cogl_pixel_format (preferred_cogl_format,
|
if (spa_video_format_from_cogl_pixel_format (preferred_cogl_format,
|
||||||
&preferred_spa_video_format))
|
&preferred_spa_video_format))
|
||||||
{
|
|
||||||
spa_video_formats[n_spa_video_formats++] = preferred_spa_video_format;
|
spa_video_formats[n_spa_video_formats++] = preferred_spa_video_format;
|
||||||
}
|
|
||||||
|
|
||||||
spa_video_formats[n_spa_video_formats++] = SPA_VIDEO_FORMAT_BGRx;
|
for (i = 0; i < G_N_ELEMENTS (supported_formats); i++)
|
||||||
|
{
|
||||||
|
if (supported_formats[i].spa_video_format != preferred_spa_video_format)
|
||||||
|
spa_video_formats[n_spa_video_formats++] = supported_formats[i].spa_video_format;
|
||||||
|
}
|
||||||
|
|
||||||
g_assert (n_spa_video_formats > 0 &&
|
g_assert (n_spa_video_formats > 0 &&
|
||||||
n_spa_video_formats <= G_N_ELEMENTS (spa_video_formats));
|
n_spa_video_formats <= G_N_ELEMENTS (spa_video_formats));
|
||||||
|
Loading…
Reference in New Issue
Block a user