2 * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
22 #include <gst/rtsp/gstrtsptransport.h>
24 #ifndef __GST_RTSP_SESSION_H__
25 #define __GST_RTSP_SESSION_H__
29 #define GST_TYPE_RTSP_SESSION (gst_rtsp_session_get_type ())
30 #define GST_IS_RTSP_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SESSION))
31 #define GST_IS_RTSP_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SESSION))
32 #define GST_RTSP_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SESSION, GstRTSPSessionClass))
33 #define GST_RTSP_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SESSION, GstRTSPSession))
34 #define GST_RTSP_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SESSION, GstRTSPSessionClass))
35 #define GST_RTSP_SESSION_CAST(obj) ((GstRTSPSession*)(obj))
36 #define GST_RTSP_SESSION_CLASS_CAST(klass) ((GstRTSPSessionClass*)(klass))
38 typedef struct _GstRTSPSession GstRTSPSession;
39 typedef struct _GstRTSPSessionClass GstRTSPSessionClass;
41 typedef struct _GstRTSPSessionStream GstRTSPSessionStream;
42 typedef struct _GstRTSPSessionMedia GstRTSPSessionMedia;
44 #include "rtsp-media.h"
47 * GstRTSPSessionStream:
48 * @trans: the media transport
49 * @media_stream: the controlled media stream
51 * Configuration of a stream. A stream is an audio or video stream related to a
54 struct _GstRTSPSessionStream
56 GstRTSPMediaTrans trans;
58 /* the stream of the media */
59 GstRTSPMediaStream *media_stream;
63 * GstRTSPSessionMedia:
65 * State of a client session regarding a specific media identified by uri.
67 struct _GstRTSPSessionMedia
69 /* the url of the media */
72 /* the pipeline for the media */
75 /* the server state */
78 /* counter for channels */
81 /* configuration for the different streams */
87 * @sessionid: the session id of the session
88 * @timeout: the timeout of the session
89 * @create_time: the time when the session was created
90 * @last_access: the time the session was last accessed
91 * @expire_count: the expire prevention counter
92 * @media: a list of #GstRTSPSessionMedia managed in this session
94 * Session information kept by the server for a specific client.
95 * One client session, identified with a session id, can handle multiple medias
96 * identified with the url of a media.
98 struct _GstRTSPSession {
104 GTimeVal create_time;
105 GTimeVal last_access;
111 struct _GstRTSPSessionClass {
112 GObjectClass parent_class;
115 GType gst_rtsp_session_get_type (void);
117 /* create a new session */
118 GstRTSPSession * gst_rtsp_session_new (const gchar *sessionid);
120 const gchar * gst_rtsp_session_get_sessionid (GstRTSPSession *session);
122 void gst_rtsp_session_set_timeout (GstRTSPSession *session, guint timeout);
123 guint gst_rtsp_session_get_timeout (GstRTSPSession *session);
125 /* session timeout stuff */
126 void gst_rtsp_session_touch (GstRTSPSession *session);
127 void gst_rtsp_session_prevent_expire (GstRTSPSession *session);
128 void gst_rtsp_session_allow_expire (GstRTSPSession *session);
129 gint gst_rtsp_session_next_timeout (GstRTSPSession *session, GTimeVal *now);
130 gboolean gst_rtsp_session_is_expired (GstRTSPSession *session, GTimeVal *now);
132 /* handle media in a session */
133 GstRTSPSessionMedia * gst_rtsp_session_manage_media (GstRTSPSession *sess,
134 const GstRTSPUrl *uri,
135 GstRTSPMedia *media);
136 gboolean gst_rtsp_session_release_media (GstRTSPSession *sess,
137 GstRTSPSessionMedia *media);
138 /* get media in a session */
139 GstRTSPSessionMedia * gst_rtsp_session_get_media (GstRTSPSession *sess,
140 const GstRTSPUrl *url);
142 gboolean gst_rtsp_session_media_set_state (GstRTSPSessionMedia *media, GstState state);
144 /* get stream config */
145 GstRTSPSessionStream * gst_rtsp_session_media_get_stream (GstRTSPSessionMedia *media,
148 gboolean gst_rtsp_session_media_alloc_channels (GstRTSPSessionMedia *media,
149 GstRTSPRange *range);
151 /* configure transport */
152 GstRTSPTransport * gst_rtsp_session_stream_set_transport (GstRTSPSessionStream *stream,
153 GstRTSPTransport *ct);
154 void gst_rtsp_session_stream_set_callbacks (GstRTSPSessionStream *stream,
155 GstRTSPSendFunc send_rtp,
156 GstRTSPSendFunc send_rtcp,
158 GDestroyNotify notify);
159 void gst_rtsp_session_stream_set_keepalive (GstRTSPSessionStream *stream,
160 GstRTSPKeepAliveFunc keep_alive,
162 GDestroyNotify notify);
166 #endif /* __GST_RTSP_SESSION_H__ */