Add RTSP channel object for async io

Add a GstRTSPChannel object that wraps a GSource around the RTSP connection so
that the connection can be monitored from a maincontext. This allows us to
operate in ASYNC mode, which is handy when building a server.

Rework the old code to use the async code under the hood.

API: gst_rtsp_channel_new()
API: gst_rtsp_channel_unref()
API: gst_rtsp_channel_attach()
API: gst_rtsp_channel_queue_message()
This commit is contained in:
Wim Taymans 2009-02-18 17:42:59 +01:00
parent 6c28744f76
commit a6d75bd33c
3 changed files with 814 additions and 328 deletions

View file

@ -1205,6 +1205,13 @@ gst_rtsp_connection_next_timeout
gst_rtsp_connection_reset_timeout
gst_rtsp_connection_flush
gst_rtsp_connection_set_auth
GstRTSPChannel
GstRTSPChannelFuncs
gst_rtsp_channel_new
gst_rtsp_channel_unref
gst_rtsp_channel_attach
gst_rtsp_channel_queue_message
</SECTION>
<SECTION>

File diff suppressed because it is too large Load diff

View file

@ -127,6 +127,48 @@ GstRTSPResult gst_rtsp_connection_set_qos_dscp (GstRTSPConnection *conn,
/* accessors */
const gchar * gst_rtsp_connection_get_ip (const GstRTSPConnection *conn);
/* async IO */
/**
* GstRTSPChannel:
*
* Opaque RTSP channel object that can be used for asynchronous RTSP
* operations.
*/
typedef struct _GstRTSPChannel GstRTSPChannel;
/**
* GstRTSPChannelFuncs:
* @message_received: callback when a message was received
* @message_sent: callback when a message was sent
* @closed: callback when the connection is closed
* @error: callback when an error occured
*
* Callback functions from a #GstRTSPChannel.
*/
typedef struct {
GstRTSPResult (*message_received) (GstRTSPChannel *channel, GstRTSPMessage *message,
gpointer user_data);
GstRTSPResult (*message_sent) (GstRTSPChannel *channel, guint cseq,
gpointer user_data);
GstRTSPResult (*closed) (GstRTSPChannel *channel, gpointer user_data);
GstRTSPResult (*error) (GstRTSPChannel *channel, GstRTSPResult result,
gpointer user_data);
} GstRTSPChannelFuncs;
GstRTSPChannel * gst_rtsp_channel_new (GstRTSPConnection *conn,
GstRTSPChannelFuncs *funcs,
gpointer user_data,
GDestroyNotify notify);
void gst_rtsp_channel_unref (GstRTSPChannel *channel);
guint gst_rtsp_channel_attach (GstRTSPChannel *channel,
GMainContext *context);
guint gst_rtsp_channel_queue_message (GstRTSPChannel *channel,
GstRTSPMessage *message);
G_END_DECLS
#endif /* __GST_RTSP_CONNECTION_H__ */