mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
source: add GError to get_formats
Add GError to get_formats to get more error information. Update the source possible formats when source-output is active
This commit is contained in:
parent
0378dcd4b7
commit
7cf87d902e
4 changed files with 109 additions and 68 deletions
|
|
@ -199,7 +199,8 @@ client_set_state (PinosSource *source,
|
|||
|
||||
static GBytes *
|
||||
client_get_formats (PinosSource *source,
|
||||
GBytes *filter)
|
||||
GBytes *filter,
|
||||
GError **error)
|
||||
{
|
||||
GstCaps *caps, *cfilter;
|
||||
gchar *str;
|
||||
|
|
@ -207,18 +208,35 @@ client_get_formats (PinosSource *source,
|
|||
if (filter) {
|
||||
cfilter = gst_caps_from_string (g_bytes_get_data (filter, NULL));
|
||||
if (cfilter == NULL)
|
||||
return NULL;
|
||||
goto invalid_filter;
|
||||
} else {
|
||||
cfilter = NULL;
|
||||
}
|
||||
|
||||
caps = collect_caps (source, cfilter);
|
||||
if (caps == NULL)
|
||||
return NULL;
|
||||
goto no_format;
|
||||
|
||||
str = gst_caps_to_string (caps);
|
||||
|
||||
return g_bytes_new_take (str, strlen (str) + 1);
|
||||
|
||||
invalid_filter:
|
||||
{
|
||||
if (error)
|
||||
*error = g_error_new (G_IO_ERROR,
|
||||
G_IO_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid filter received");
|
||||
return NULL;
|
||||
}
|
||||
no_format:
|
||||
{
|
||||
if (error)
|
||||
*error = g_error_new (G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"No compatible format found");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue