case GST_STATE_CHANGE_FAILURE:
goto service_unavailable;
case GST_STATE_CHANGE_ASYNC:
+ /* wait for paused state change to complete */
ret = gst_element_get_state (media->pipeline, NULL, NULL, -1);
break;
}
client_accept (GstRTSPClient *client, GIOChannel *channel)
{
/* a new client connected. */
- int server_sock_fd;
+ int server_sock_fd, fd;
unsigned int address_len;
GstRTSPConnection *conn;
- conn = client->connection;
-
server_sock_fd = g_io_channel_unix_get_fd (channel);
address_len = sizeof (client->address);
memset (&client->address, 0, address_len);
- conn->fd.fd = accept (server_sock_fd, (struct sockaddr *) &client->address,
+ fd = accept (server_sock_fd, (struct sockaddr *) &client->address,
&address_len);
- if (conn->fd.fd == -1)
+ if (fd == -1)
goto accept_failed;
- g_print ("added new client %p ip %s with fd %d\n", client,
- inet_ntoa (client->address.sin_addr), conn->fd.fd);
+ /* now create the connection object */
+ gst_rtsp_connection_create (NULL, &conn);
+ conn->fd.fd = fd;
/* FIXME some hackery, we need to have a connection method to accept server
* connections */
gst_poll_add_fd (conn->fdset, &conn->fd);
+ g_print ("added new client %p ip %s with fd %d\n", client,
+ inet_ntoa (client->address.sin_addr), conn->fd.fd);
+
+ client->connection = conn;
+
return TRUE;
/* ERRORS */
gboolean
gst_rtsp_client_accept (GstRTSPClient *client, GIOChannel *channel)
{
- gst_rtsp_connection_create (NULL, &client->connection);
-
if (!client_accept (client, channel))
goto accept_failed;
/* ERRORS */
accept_failed:
{
- gst_rtsp_connection_close (client->connection);
return FALSE;
}
}
typedef struct _GstRTSPClient GstRTSPClient;
typedef struct _GstRTSPClientClass GstRTSPClientClass;
+/**
+ * GstRTSPClient:
+ *
+ * @connection: the connection object handling the client request.
+ * @address: the address of the connection
+ * @media: handle to the media handled by the client.
+ * @pool: handle to the session pool used by the client.
+ * @thread: thread to handle the client connection
+ *
+ * The client structure.
+ */
struct _GstRTSPClient {
GObject parent;