From 066598d8de5530a153adde3e457deb1734df5ea8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 29 Apr 2007 14:43:37 +0000 Subject: gst/udp/gstmultiudpsink.c: Add code to drop membership of a multicast group. Original commit message from CVS: * gst/udp/gstmultiudpsink.c: (leave_multicast), (gst_multiudpsink_add), (gst_multiudpsink_remove): Add code to drop membership of a multicast group. * gst/udp/gstudpsink.c: (gst_udpsink_update_uri), (gst_udpsink_set_uri): Implement URI handler. * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_stream_configure_transport), (gst_rtspsrc_parse_rtpinfo): Use URI handler to make udpsink instace. Improve code to configure port and destination. --- gst/udp/gstmultiudpsink.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gst/udp/gstmultiudpsink.c') diff --git a/gst/udp/gstmultiudpsink.c b/gst/udp/gstmultiudpsink.c index 72fec4cf..21899c95 100644 --- a/gst/udp/gstmultiudpsink.c +++ b/gst/udp/gstmultiudpsink.c @@ -400,6 +400,14 @@ join_multicast (GstUDPClient * client) perror ("setsockopt IP_MULTICAST_LOOP\n"); } +static void +leave_multicast (GstUDPClient * client) +{ + if (setsockopt (*(client->sock), IPPROTO_IP, IP_DROP_MEMBERSHIP, + &(client->multi_addr), sizeof (client->multi_addr)) < 0) + perror ("setsockopt IP_DROP_MEMBERSHIP\n"); +} + /* create a socket for sending to remote machine */ static gboolean gst_multiudpsink_init_send (GstMultiUDPSink * sink) @@ -563,6 +571,9 @@ gst_multiudpsink_remove (GstMultiUDPSink * sink, const gchar * host, gint port) g_get_current_time (&now); client->disconnect_time = GST_TIMEVAL_TO_TIME (now); + if (client->multi_addr.imr_multiaddr.s_addr) + leave_multicast (client); + /* Unlock to emit signal before we delete the actual client */ g_mutex_unlock (sink->client_lock); g_signal_emit (G_OBJECT (sink), -- cgit