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 #include "rtsp-media.h"
26 #ifndef __GST_RTSP_SESSION_H__
27 #define __GST_RTSP_SESSION_H__
31 #define GST_TYPE_RTSP_SESSION (gst_rtsp_session_get_type ())
32 #define GST_IS_RTSP_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SESSION))
33 #define GST_IS_RTSP_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SESSION))
34 #define GST_RTSP_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SESSION, GstRTSPSessionClass))
35 #define GST_RTSP_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SESSION, GstRTSPSession))
36 #define GST_RTSP_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SESSION, GstRTSPSessionClass))
37 #define GST_RTSP_SESSION_CAST(obj) ((GstRTSPSession*)(obj))
38 #define GST_RTSP_SESSION_CLASS_CAST(klass) ((GstRTSPSessionClass*)(klass))
40 typedef struct _GstRTSPSession GstRTSPSession;
41 typedef struct _GstRTSPSessionClass GstRTSPSessionClass;
43 typedef struct _GstRTSPSessionStream GstRTSPSessionStream;
44 typedef struct _GstRTSPSessionMedia GstRTSPSessionMedia;
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 /* configuration for the different streams */
84 * @sessionid: the session id of the session
85 * @timeout: the timeout of the session
86 * @create_time: the time when the session was created
87 * @last_access: the time the session was last accessed
88 * @media: a list of #GstRTSPSessionMedia managed in this session
90 * Session information kept by the server for a specific client.
91 * One client session, identified with a session id, can handle multiple medias
92 * identified with the url of a media.
94 struct _GstRTSPSession {
100 GTimeVal create_time;
101 GTimeVal last_access;
106 struct _GstRTSPSessionClass {
107 GObjectClass parent_class;
110 GType gst_rtsp_session_get_type (void);
112 /* create a new session */
113 GstRTSPSession * gst_rtsp_session_new (const gchar *sessionid);
115 const gchar * gst_rtsp_session_get_sessionid (GstRTSPSession *session);
117 void gst_rtsp_session_set_timeout (GstRTSPSession *session, guint timeout);
118 guint gst_rtsp_session_get_timeout (GstRTSPSession *session);
120 /* session timeout stuff */
121 void gst_rtsp_session_touch (GstRTSPSession *session);
122 gint gst_rtsp_session_next_timeout (GstRTSPSession *session, GTimeVal *now);
123 gboolean gst_rtsp_session_is_expired (GstRTSPSession *session, GTimeVal *now);
125 /* handle media in a session */
126 GstRTSPSessionMedia * gst_rtsp_session_manage_media (GstRTSPSession *sess,
127 const GstRTSPUrl *uri,
128 GstRTSPMedia *media);
129 gboolean gst_rtsp_session_release_media (GstRTSPSession *sess,
130 GstRTSPSessionMedia *media);
131 /* get media in a session */
132 GstRTSPSessionMedia * gst_rtsp_session_get_media (GstRTSPSession *sess,
133 const GstRTSPUrl *uri);
135 gboolean gst_rtsp_session_media_play (GstRTSPSessionMedia *media);
136 gboolean gst_rtsp_session_media_pause (GstRTSPSessionMedia *media);
137 gboolean gst_rtsp_session_media_stop (GstRTSPSessionMedia *media);
139 /* get stream config */
140 GstRTSPSessionStream * gst_rtsp_session_media_get_stream (GstRTSPSessionMedia *media,
143 /* configure transport */
144 GstRTSPTransport * gst_rtsp_session_stream_set_transport (GstRTSPSessionStream *stream,
145 GstRTSPTransport *ct);
149 #endif /* __GST_RTSP_SESSION_H__ */