diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2005-06-02 13:28:46 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2005-06-02 13:28:46 +0000 |
commit | 8e61fd923091dbdb1cefe157c8dcfecc57d166fd (patch) | |
tree | 6ba8c2f83c2b13b90e857f9ec052b075de5d3655 /gst/udp/gstmultiudpsink.c | |
parent | ca1f865eaa541789d704d0d90ec36001a17da3fd (diff) |
gst/udp/: Use NetBuffer and small cleanups.
Original commit message from CVS:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_init_send),
(gst_multiudpsink_add), (client_compare), (free_client),
(gst_multiudpsink_remove), (gst_multiudpsink_clear),
(gst_multiudpsink_get_stats):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
Use NetBuffer and small cleanups.
Implement client removal in multiudpsink.
Diffstat (limited to 'gst/udp/gstmultiudpsink.c')
-rw-r--r-- | gst/udp/gstmultiudpsink.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gst/udp/gstmultiudpsink.c b/gst/udp/gstmultiudpsink.c index c7ea9e24..6ef5e2e4 100644 --- a/gst/udp/gstmultiudpsink.c +++ b/gst/udp/gstmultiudpsink.c @@ -382,14 +382,54 @@ host_error: } } +static gint +client_compare (GstUDPClient * a, GstUDPClient * b) +{ + if ((a->port == b->port) && (strcmp (a->host, b->host) == 0)) + return 0; + + return 1; +} + +static void +free_client (GstUDPClient * client) +{ + g_free (client->host); + g_free (client); +} + void gst_multiudpsink_remove (GstMultiUDPSink * sink, const gchar * host, gint port) { + GList *find; + GstUDPClient udpclient; + + udpclient.host = (gchar *) host; + udpclient.port = port; + + g_mutex_lock (sink->client_lock); + find = g_list_find_custom (sink->clients, &udpclient, + (GCompareFunc) client_compare); + if (find) { + GstUDPClient *client; + + client = (GstUDPClient *) find->data; + + sink->clients = g_list_delete_link (sink->clients, find); + + free_client (client); + } + g_mutex_unlock (sink->client_lock); } void gst_multiudpsink_clear (GstMultiUDPSink * sink) { + g_mutex_lock (sink->client_lock); + g_list_foreach (sink->clients, (GFunc) free_client, sink); + g_list_free (sink->clients); + sink->clients = NULL; + g_mutex_unlock (sink->client_lock); } GValueArray * |