server: simpify channel function

This commit is contained in:
Wim Taymans 2011-01-12 18:24:44 +01:00
parent ba4d65a673
commit 3315031bf6

View file

@ -498,9 +498,17 @@ gst_rtsp_server_set_property (GObject * object, guint propid,
}
}
/* Prepare a server socket for @server and make it listen on the configured port */
static GIOChannel *
gst_rtsp_server_sink_init_send (GstRTSPServer * server)
/**
* gst_rtsp_server_get_io_channel:
* @server: a #GstRTSPServer
*
* Create a #GIOChannel for @server. The io channel will listen on the
* configured service.
*
* Returns: the GIOChannel for @server or NULL when an error occured.
*/
GIOChannel *
gst_rtsp_server_get_io_channel (GstRTSPServer * server)
{
GIOChannel *channel;
int ret, sockfd;
@ -510,6 +518,8 @@ gst_rtsp_server_sink_init_send (GstRTSPServer * server)
struct linger linger;
#endif
g_return_val_if_fail (GST_IS_RTSP_SERVER (server), NULL);
memset (&hints, 0, sizeof (struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_STREAM; /* stream socket */
@ -761,33 +771,6 @@ accept_failed:
}
}
/**
* gst_rtsp_server_get_io_channel:
* @server: a #GstRTSPServer
*
* Create a #GIOChannel for @server.
*
* Returns: the GIOChannel for @server or NULL when an error occured.
*/
GIOChannel *
gst_rtsp_server_get_io_channel (GstRTSPServer * server)
{
GIOChannel *channel;
g_return_val_if_fail (GST_IS_RTSP_SERVER (server), NULL);
if (!(channel = gst_rtsp_server_sink_init_send (server)))
goto init_failed;
return channel;
init_failed:
{
GST_ERROR_OBJECT (server, "failed to initialize server");
return NULL;
}
}
static void
watch_destroyed (GstRTSPServer * server)
{