mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
955adc4564
Adding a uri interface enables plugging in RFB/VNC sources to anything that makes use of uridecodebin: gst-play-1.0 rfb://:password@10.40.216.180:5903?shared=1 Use userinfo to pass user (ignored) and password, other key/value pairs can be encoded in the query part of the URI (see shared) Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1963>
56 lines
1.7 KiB
C
56 lines
1.7 KiB
C
/* GStreamer
|
|
* Copyright (C) <2022> Marc Leeman <marc.leeman@gmail.com>
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Library General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
* Boston, MA 02110-1301, USA.
|
|
*
|
|
* See: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/226
|
|
*/
|
|
|
|
#include "gstrfb-utils.h"
|
|
|
|
static void
|
|
gst_rfb_utils_uri_query_foreach (const gchar * key, const gchar * value,
|
|
GObject * src)
|
|
{
|
|
if (key == NULL) {
|
|
GST_WARNING_OBJECT (src, "Refusing to use empty key.");
|
|
return;
|
|
}
|
|
|
|
if (value == NULL) {
|
|
GST_WARNING_OBJECT (src, "Refusing to use NULL for key %s.", key);
|
|
return;
|
|
}
|
|
|
|
GST_DEBUG_OBJECT (src, "Setting property '%s' to '%s'", key, value);
|
|
gst_util_set_object_arg (src, key, value);
|
|
}
|
|
|
|
void
|
|
gst_rfb_utils_set_properties_from_uri_query (GObject * obj, const GstUri * uri)
|
|
{
|
|
GHashTable *hash_table;
|
|
|
|
g_return_if_fail (uri != NULL);
|
|
hash_table = gst_uri_get_query_table (uri);
|
|
|
|
if (hash_table) {
|
|
g_hash_table_foreach (hash_table,
|
|
(GHFunc) gst_rfb_utils_uri_query_foreach, obj);
|
|
|
|
g_hash_table_unref (hash_table);
|
|
}
|
|
}
|