mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
srt: Accepts URIs without host to go into listener mode
Just setting a URI without a hostname should directly go into listener mode.
This commit is contained in:
parent
5fee3a87c1
commit
73c6530d40
3 changed files with 35 additions and 29 deletions
|
@ -440,8 +440,8 @@ gst_srt_object_install_properties_helper (GObjectClass * gobject_class)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_srt_object_set_enum_value (GstStructure * s, GType enum_type, gpointer key,
|
||||
gpointer value)
|
||||
gst_srt_object_set_enum_value (GstStructure * s, GType enum_type,
|
||||
gconstpointer key, gconstpointer value)
|
||||
{
|
||||
GEnumClass *enum_class;
|
||||
GEnumValue *enum_value;
|
||||
|
@ -517,6 +517,7 @@ gst_srt_object_set_uri (GstSRTObject * srtobject, const gchar * uri,
|
|||
GHashTable *query_table = NULL;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
const char *addr_str;
|
||||
|
||||
if (srtobject->opened) {
|
||||
g_warning
|
||||
|
@ -544,29 +545,34 @@ gst_srt_object_set_uri (GstSRTObject * srtobject, const gchar * uri,
|
|||
gst_uri_get_host (srtobject->uri), gst_uri_get_port (srtobject->uri),
|
||||
query_table == NULL ? 0 : g_hash_table_size (query_table));
|
||||
|
||||
if (!query_table) {
|
||||
GST_DEBUG_OBJECT (srtobject->element, "No parameters from uri");
|
||||
return TRUE;
|
||||
}
|
||||
addr_str = gst_uri_get_host (srtobject->uri);
|
||||
if (addr_str)
|
||||
gst_srt_object_set_enum_value (srtobject->parameters,
|
||||
GST_TYPE_SRT_CONNECTION_MODE, "mode", "caller");
|
||||
else
|
||||
gst_srt_object_set_enum_value (srtobject->parameters,
|
||||
GST_TYPE_SRT_CONNECTION_MODE, "mode", "listener");
|
||||
|
||||
g_hash_table_iter_init (&iter, query_table);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||
if (!g_strcmp0 ("mode", key)) {
|
||||
gst_srt_object_set_enum_value (srtobject->parameters,
|
||||
GST_TYPE_SRT_CONNECTION_MODE, key, value);
|
||||
} else if (!g_strcmp0 ("localaddress", key)) {
|
||||
gst_srt_object_set_string_value (srtobject->parameters, key, value);
|
||||
} else if (!g_strcmp0 ("localport", key)) {
|
||||
gst_srt_object_set_uint_value (srtobject->parameters, key, value);
|
||||
} else if (!g_strcmp0 ("passphrase", key)) {
|
||||
gst_srt_object_set_string_value (srtobject->parameters, key, value);
|
||||
} else if (!g_strcmp0 ("pbkeylen", key)) {
|
||||
gst_srt_object_set_enum_value (srtobject->parameters,
|
||||
GST_TYPE_SRT_KEY_LENGTH_BITS, key, value);
|
||||
if (query_table) {
|
||||
g_hash_table_iter_init (&iter, query_table);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||
if (!g_strcmp0 ("mode", key)) {
|
||||
gst_srt_object_set_enum_value (srtobject->parameters,
|
||||
GST_TYPE_SRT_CONNECTION_MODE, key, value);
|
||||
} else if (!g_strcmp0 ("localaddress", key)) {
|
||||
gst_srt_object_set_string_value (srtobject->parameters, key, value);
|
||||
} else if (!g_strcmp0 ("localport", key)) {
|
||||
gst_srt_object_set_uint_value (srtobject->parameters, key, value);
|
||||
} else if (!g_strcmp0 ("passphrase", key)) {
|
||||
gst_srt_object_set_string_value (srtobject->parameters, key, value);
|
||||
} else if (!g_strcmp0 ("pbkeylen", key)) {
|
||||
gst_srt_object_set_enum_value (srtobject->parameters,
|
||||
GST_TYPE_SRT_KEY_LENGTH_BITS, key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_hash_table_unref (query_table);
|
||||
g_hash_table_unref (query_table);
|
||||
}
|
||||
|
||||
gst_srt_object_validate_parameters (srtobject->parameters, srtobject->uri);
|
||||
|
||||
|
@ -954,10 +960,10 @@ gst_srt_object_open_full (GstSRTObject * srtobject,
|
|||
addr_str = gst_uri_get_host (srtobject->uri);
|
||||
|
||||
if (addr_str == NULL) {
|
||||
addr_str = GST_SRT_DEFAULT_LOCALADDRESS;
|
||||
GST_WARNING_OBJECT (srtobject->element,
|
||||
"Given uri doesn't have hostname or address. Use default localaddress (%s)",
|
||||
addr_str);
|
||||
addr_str = "0.0.0.0";
|
||||
GST_DEBUG_OBJECT (srtobject->element,
|
||||
"Given uri doesn't have hostname or address. Use any (%s) and"
|
||||
" setting listener mode", addr_str);
|
||||
}
|
||||
|
||||
socket_address =
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
* <refsect2>
|
||||
* <title>Examples</title>
|
||||
* |[
|
||||
* gst-launch-1.0 -v audiotestsrc ! srtsink uri://host?mode=caller
|
||||
* gst-launch-1.0 -v audiotestsrc ! srtsink uri=srt://host
|
||||
* ]| This pipeline shows how to serve SRT packets through the default port.
|
||||
*
|
||||
* |[
|
||||
* gst-launch-1.0 -v audiotestsrc ! srtsink uri://host:port?mode=listener
|
||||
* gst-launch-1.0 -v audiotestsrc ! srtsink uri=srt://:port
|
||||
* ]| This pipeline shows how to wait SRT callers.
|
||||
* </refsect2>
|
||||
*
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
* ]| This pipeline shows how to connect SRT server by setting #GstSRTSrc:uri property.
|
||||
*
|
||||
* |[
|
||||
* gst-launch-1.0 -v srtsrc uri="srt://127.0.0.1:7001?mode=listener" ! fakesink
|
||||
* gst-launch-1.0 -v srtsrc uri="srt://:7001?mode=listener" ! fakesink
|
||||
* ]| This pipeline shows how to wait SRT connection by setting #GstSRTSrc:uri property.
|
||||
*
|
||||
* |[
|
||||
|
|
Loading…
Reference in a new issue