mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
gst/udp/gstmultiudpsink.*: Add property to automatically join a multicast group or not. This can be useful when shari...
Original commit message from CVS: Patch by: Olivier Crete <tester at tester dot ca> * gst/udp/gstmultiudpsink.c: (gst_multiudpsink_class_init), (gst_multiudpsink_init), (gst_multiudpsink_set_property), (gst_multiudpsink_get_property), (gst_multiudpsink_init_send), (gst_multiudpsink_add_internal), (gst_multiudpsink_remove): * gst/udp/gstmultiudpsink.h: Add property to automatically join a multicast group or not. This can be useful when sharing a socket between multiple elements. Fixes #509531.
This commit is contained in:
parent
4c3b21a09a
commit
156151291b
3 changed files with 34 additions and 4 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
2008-01-17 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
Patch by: Olivier Crete <tester at tester dot ca>
|
||||||
|
|
||||||
|
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_class_init),
|
||||||
|
(gst_multiudpsink_init), (gst_multiudpsink_set_property),
|
||||||
|
(gst_multiudpsink_get_property), (gst_multiudpsink_init_send),
|
||||||
|
(gst_multiudpsink_add_internal), (gst_multiudpsink_remove):
|
||||||
|
* gst/udp/gstmultiudpsink.h:
|
||||||
|
Add property to automatically join a multicast group or not. This can be
|
||||||
|
useful when sharing a socket between multiple elements.
|
||||||
|
Fixes #509531.
|
||||||
|
|
||||||
2008-01-16 Stefan Kost <ensonic@users.sf.net>
|
2008-01-16 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* gst/videomixer/Makefile.am:
|
* gst/videomixer/Makefile.am:
|
||||||
|
|
|
@ -80,6 +80,7 @@ enum
|
||||||
#define DEFAULT_CLOSEFD TRUE
|
#define DEFAULT_CLOSEFD TRUE
|
||||||
#define DEFAULT_SOCK -1
|
#define DEFAULT_SOCK -1
|
||||||
#define DEFAULT_CLIENTS NULL
|
#define DEFAULT_CLIENTS NULL
|
||||||
|
#define DEFAULT_AUTO_MULTICAST TRUE
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -89,7 +90,8 @@ enum
|
||||||
PROP_SOCKFD,
|
PROP_SOCKFD,
|
||||||
PROP_CLOSEFD,
|
PROP_CLOSEFD,
|
||||||
PROP_SOCK,
|
PROP_SOCK,
|
||||||
PROP_CLIENTS
|
PROP_CLIENTS,
|
||||||
|
PROP_AUTO_MULTICAST
|
||||||
/* FILL ME */
|
/* FILL ME */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -285,6 +287,11 @@ gst_multiudpsink_class_init (GstMultiUDPSinkClass * klass)
|
||||||
g_param_spec_string ("clients", "Clients",
|
g_param_spec_string ("clients", "Clients",
|
||||||
"A comma separated list of host:port pairs with destinations",
|
"A comma separated list of host:port pairs with destinations",
|
||||||
DEFAULT_CLIENTS, G_PARAM_READWRITE));
|
DEFAULT_CLIENTS, G_PARAM_READWRITE));
|
||||||
|
g_object_class_install_property (gobject_class, PROP_AUTO_MULTICAST,
|
||||||
|
g_param_spec_boolean ("auto-multicast",
|
||||||
|
"Automatically join/leave multicast groups",
|
||||||
|
"Automatically join/leave the multicast groups, FALSE means user"
|
||||||
|
" has to do it himself", DEFAULT_AUTO_MULTICAST, G_PARAM_READWRITE));
|
||||||
|
|
||||||
gstelement_class->change_state = gst_multiudpsink_change_state;
|
gstelement_class->change_state = gst_multiudpsink_change_state;
|
||||||
|
|
||||||
|
@ -308,6 +315,7 @@ gst_multiudpsink_init (GstMultiUDPSink * sink)
|
||||||
sink->sockfd = DEFAULT_SOCKFD;
|
sink->sockfd = DEFAULT_SOCKFD;
|
||||||
sink->closefd = DEFAULT_CLOSEFD;
|
sink->closefd = DEFAULT_CLOSEFD;
|
||||||
sink->externalfd = (sink->sockfd != -1);
|
sink->externalfd = (sink->sockfd != -1);
|
||||||
|
sink->auto_multicast = DEFAULT_AUTO_MULTICAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -462,6 +470,9 @@ gst_multiudpsink_set_property (GObject * object, guint prop_id,
|
||||||
case PROP_CLIENTS:
|
case PROP_CLIENTS:
|
||||||
gst_multiudpsink_set_clients_string (udpsink, g_value_get_string (value));
|
gst_multiudpsink_set_clients_string (udpsink, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_AUTO_MULTICAST:
|
||||||
|
udpsink->auto_multicast = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -496,6 +507,9 @@ gst_multiudpsink_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
g_value_take_string (value,
|
g_value_take_string (value,
|
||||||
gst_multiudpsink_get_clients_string (udpsink));
|
gst_multiudpsink_get_clients_string (udpsink));
|
||||||
break;
|
break;
|
||||||
|
case PROP_AUTO_MULTICAST:
|
||||||
|
g_value_set_boolean (value, udpsink->auto_multicast);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -565,7 +579,7 @@ gst_multiudpsink_init_send (GstMultiUDPSink * sink)
|
||||||
|
|
||||||
for (clients = sink->clients; clients; clients = g_list_next (clients)) {
|
for (clients = sink->clients; clients; clients = g_list_next (clients)) {
|
||||||
client = (GstUDPClient *) clients->data;
|
client = (GstUDPClient *) clients->data;
|
||||||
if (client->multi_addr.imr_multiaddr.s_addr)
|
if (client->multi_addr.imr_multiaddr.s_addr && sink->auto_multicast)
|
||||||
join_multicast (client);
|
join_multicast (client);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -631,7 +645,8 @@ gst_multiudpsink_add_internal (GstMultiUDPSink * sink, const gchar * host,
|
||||||
client->theiraddr.sin_addr = *((struct in_addr *) &addr);
|
client->theiraddr.sin_addr = *((struct in_addr *) &addr);
|
||||||
}
|
}
|
||||||
/* if init_send has already been called, set sockopts for multicast */
|
/* if init_send has already been called, set sockopts for multicast */
|
||||||
if (*client->sock > 0 && client->multi_addr.imr_multiaddr.s_addr)
|
if (*client->sock > 0 && client->multi_addr.imr_multiaddr.s_addr &&
|
||||||
|
sink->auto_multicast)
|
||||||
join_multicast (client);
|
join_multicast (client);
|
||||||
}
|
}
|
||||||
/* we dont need to lookup for localhost */
|
/* we dont need to lookup for localhost */
|
||||||
|
@ -712,7 +727,7 @@ gst_multiudpsink_remove (GstMultiUDPSink * sink, const gchar * host, gint port)
|
||||||
g_get_current_time (&now);
|
g_get_current_time (&now);
|
||||||
client->disconnect_time = GST_TIMEVAL_TO_TIME (now);
|
client->disconnect_time = GST_TIMEVAL_TO_TIME (now);
|
||||||
|
|
||||||
if (client->multi_addr.imr_multiaddr.s_addr)
|
if (client->multi_addr.imr_multiaddr.s_addr && sink->auto_multicast)
|
||||||
leave_multicast (client);
|
leave_multicast (client);
|
||||||
|
|
||||||
/* Unlock to emit signal before we delete the actual client */
|
/* Unlock to emit signal before we delete the actual client */
|
||||||
|
|
|
@ -70,6 +70,8 @@ struct _GstMultiUDPSink {
|
||||||
gboolean closefd;
|
gboolean closefd;
|
||||||
|
|
||||||
gboolean externalfd;
|
gboolean externalfd;
|
||||||
|
|
||||||
|
gboolean auto_multicast;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstMultiUDPSinkClass {
|
struct _GstMultiUDPSinkClass {
|
||||||
|
|
Loading…
Reference in a new issue