summaryrefslogtreecommitdiffstats
path: root/gst/udp
diff options
context:
space:
mode:
authorJarkko Palviainen <jarkko.palviainen at sesca.com>2009-08-31 12:16:01 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2009-08-31 12:16:01 +0200
commit1f14f577d873711e3f4b026f1ab709af69883684 (patch)
tree963df445e07a46c42ec6d95be11c5965b5a51496 /gst/udp
parente2518fedbe8f6eb9cf1cf456381a5e350e2c4001 (diff)
udpsink: Add ttl multicast property
Add a new ttl-mc property to control the TTL on multicast addresses. Fixes #588245
Diffstat (limited to 'gst/udp')
-rw-r--r--gst/udp/gstmultiudpsink.c20
-rw-r--r--gst/udp/gstmultiudpsink.h1
-rw-r--r--gst/udp/gstudpnetutils.c1
3 files changed, 19 insertions, 3 deletions
diff --git a/gst/udp/gstmultiudpsink.c b/gst/udp/gstmultiudpsink.c
index 6b5ca4d4..46e92ba5 100644
--- a/gst/udp/gstmultiudpsink.c
+++ b/gst/udp/gstmultiudpsink.c
@@ -1,5 +1,6 @@
/* GStreamer
* Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
+ * Copyright (C) <2009> Jarkko Palviainen <jarkko.palviainen@sesca.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -81,6 +82,7 @@ enum
* be configured in the element that does the receive. */
#define DEFAULT_AUTO_MULTICAST TRUE
#define DEFAULT_TTL 64
+#define DEFAULT_TTL_MC 1
#define DEFAULT_LOOP TRUE
#define DEFAULT_QOS_DSCP -1
@@ -95,6 +97,7 @@ enum
PROP_CLIENTS,
PROP_AUTO_MULTICAST,
PROP_TTL,
+ PROP_TTL_MC,
PROP_LOOP,
PROP_QOS_DSCP,
PROP_LAST
@@ -307,9 +310,13 @@ gst_multiudpsink_class_init (GstMultiUDPSinkClass * klass)
"Automatically join/leave the multicast groups, FALSE means user"
" has to do it himself", DEFAULT_AUTO_MULTICAST, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_TTL,
- g_param_spec_int ("ttl", "Multicast TTL",
- "Used for setting the multicast TTL parameter",
+ g_param_spec_int ("ttl", "Unicast TTL",
+ "Used for setting the unicast TTL parameter",
0, 255, DEFAULT_TTL, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, PROP_TTL_MC,
+ g_param_spec_int ("ttl-mc", "Multicast TTL",
+ "Used for setting the multicast TTL parameter",
+ 0, 255, DEFAULT_TTL_MC, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_LOOP,
g_param_spec_boolean ("loop", "Multicast Loopback",
"Used for setting the multicast loop parameter. TRUE = enable,"
@@ -346,6 +353,7 @@ gst_multiudpsink_init (GstMultiUDPSink * sink)
sink->externalfd = (sink->sockfd != -1);
sink->auto_multicast = DEFAULT_AUTO_MULTICAST;
sink->ttl = DEFAULT_TTL;
+ sink->ttl_mc = DEFAULT_TTL_MC;
sink->loop = DEFAULT_LOOP;
sink->qos_dscp = DEFAULT_QOS_DSCP;
}
@@ -635,6 +643,9 @@ gst_multiudpsink_set_property (GObject * object, guint prop_id,
case PROP_TTL:
udpsink->ttl = g_value_get_int (value);
break;
+ case PROP_TTL_MC:
+ udpsink->ttl_mc = g_value_get_int (value);
+ break;
case PROP_LOOP:
udpsink->loop = g_value_get_boolean (value);
break;
@@ -682,6 +693,9 @@ gst_multiudpsink_get_property (GObject * object, guint prop_id, GValue * value,
case PROP_TTL:
g_value_set_int (value, udpsink->ttl);
break;
+ case PROP_TTL_MC:
+ g_value_set_int (value, udpsink->ttl_mc);
+ break;
case PROP_LOOP:
g_value_set_boolean (value, udpsink->loop);
break;
@@ -737,7 +751,7 @@ gst_multiudpsink_init_send (GstMultiUDPSink * sink)
}
if (gst_udp_set_loop (sink->sock, sink->loop) != 0)
goto loop_failed;
- if (gst_udp_set_ttl (sink->sock, sink->ttl, TRUE) != 0)
+ if (gst_udp_set_ttl (sink->sock, sink->ttl_mc, TRUE) != 0)
goto ttl_failed;
} else {
if (gst_udp_set_ttl (sink->sock, sink->ttl, FALSE) != 0)
diff --git a/gst/udp/gstmultiudpsink.h b/gst/udp/gstmultiudpsink.h
index e9543eda..37787b72 100644
--- a/gst/udp/gstmultiudpsink.h
+++ b/gst/udp/gstmultiudpsink.h
@@ -72,6 +72,7 @@ struct _GstMultiUDPSink {
gboolean auto_multicast;
gint ttl;
+ gint ttl_mc;
gboolean loop;
gint qos_dscp;
};
diff --git a/gst/udp/gstudpnetutils.c b/gst/udp/gstudpnetutils.c
index 322351a8..1a6b9a43 100644
--- a/gst/udp/gstudpnetutils.c
+++ b/gst/udp/gstudpnetutils.c
@@ -1,6 +1,7 @@
/* GStreamer UDP network utility functions
* Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
* Copyright (C) 2006 Joni Valtanen <joni.valtanen@movial.fi>
+ * Copyright (C) 2009 Jarkko Palviainen <jarkko.palviainen@sesca.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public