summaryrefslogtreecommitdiff
path: root/gst/udp/gstudpsrc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/udp/gstudpsrc.c')
-rw-r--r--gst/udp/gstudpsrc.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c
index 8da3585db..34aa7e464 100644
--- a/gst/udp/gstudpsrc.c
+++ b/gst/udp/gstudpsrc.c
@@ -138,6 +138,7 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
#define UDP_DEFAULT_USED_SOCKET NULL
#define UDP_DEFAULT_AUTO_MULTICAST TRUE
#define UDP_DEFAULT_REUSE TRUE
+#define UDP_DEFAULT_LOOP TRUE
enum
{
@@ -156,7 +157,8 @@ enum
PROP_USED_SOCKET,
PROP_AUTO_MULTICAST,
PROP_REUSE,
- PROP_ADDRESS
+ PROP_ADDRESS,
+ PROP_LOOP
};
static void gst_udpsrc_uri_handler_init (gpointer g_iface, gpointer iface_data);
@@ -266,6 +268,11 @@ gst_udpsrc_class_init (GstUDPSrcClass * klass)
"Address to receive packets for. This is equivalent to the "
"multicast-group property for now", UDP_DEFAULT_MULTICAST_GROUP,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ 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,"
+ " FALSE = disable", UDP_DEFAULT_LOOP,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&src_template));
@@ -305,6 +312,7 @@ gst_udpsrc_init (GstUDPSrc * udpsrc)
udpsrc->auto_multicast = UDP_DEFAULT_AUTO_MULTICAST;
udpsrc->used_socket = UDP_DEFAULT_USED_SOCKET;
udpsrc->reuse = UDP_DEFAULT_REUSE;
+ udpsrc->loop = UDP_DEFAULT_LOOP;
/* configure basesrc to be a live source */
gst_base_src_set_live (GST_BASE_SRC (udpsrc), TRUE);
@@ -791,6 +799,9 @@ gst_udpsrc_set_property (GObject * object, guint prop_id, const GValue * value,
case PROP_REUSE:
udpsrc->reuse = g_value_get_boolean (value);
break;
+ case PROP_LOOP:
+ udpsrc->loop = g_value_get_boolean (value);
+ break;
default:
break;
}
@@ -845,6 +856,9 @@ gst_udpsrc_get_property (GObject * object, guint prop_id, GValue * value,
case PROP_REUSE:
g_value_set_boolean (value, udpsrc->reuse);
break;
+ case PROP_LOOP:
+ g_value_set_boolean (value, udpsrc->loop);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -952,6 +966,7 @@ gst_udpsrc_open (GstUDPSrc * src)
goto bind_error;
g_object_unref (bind_saddr);
+ g_socket_set_multicast_loopback (src->used_socket, src->loop);
} else {
GST_DEBUG_OBJECT (src, "using provided socket %p", src->socket);
/* we use the configured socket, try to get some info about it */