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"
25 #include "rtsp-media-factory.h"
27 #ifndef __GST_RTSP_SESSION_H__
28 #define __GST_RTSP_SESSION_H__
32 #define GST_TYPE_RTSP_SESSION (gst_rtsp_session_get_type ())
33 #define GST_IS_RTSP_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SESSION))
34 #define GST_IS_RTSP_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SESSION))
35 #define GST_RTSP_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SESSION, GstRTSPSessionClass))
36 #define GST_RTSP_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SESSION, GstRTSPSession))
37 #define GST_RTSP_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SESSION, GstRTSPSessionClass))
38 #define GST_RTSP_SESSION_CAST(obj) ((GstRTSPSession*)(obj))
39 #define GST_RTSP_SESSION_CLASS_CAST(klass) ((GstRTSPSessionClass*)(klass))
41 typedef struct _GstRTSPSession GstRTSPSession;
42 typedef struct _GstRTSPSessionClass GstRTSPSessionClass;
44 typedef struct _GstRTSPSessionStream GstRTSPSessionStream;
45 typedef struct _GstRTSPSessionMedia GstRTSPSessionMedia;
48 * GstRTSPSessionStream:
50 * Configuration of a stream. A stream is an audio or video stream related to a
53 struct _GstRTSPSessionStream
58 GstRTSPSessionMedia *media;
60 GstRTSPMediaStream *media_stream;
62 /* client and server transports */
64 GstRTSPTransport *client_trans;
65 GstRTSPTransport *server_trans;
67 /* pads on the rtpbin */
68 GstPad *recv_rtcp_sink;
69 GstPad *send_rtp_sink;
71 GstPad *send_rtcp_src;
73 /* sinks used for sending and receiving RTP and RTCP, they share sockets */
74 GstElement *udpsrc[2];
75 GstElement *udpsink[2];
79 * GstRTSPSessionMedia:
81 * State of a client session regarding a specific media. The media is identified
82 * with the media factory. The media is typically composed of multiple streams,
83 * such as an audio and video stream.
85 struct _GstRTSPSessionMedia
87 /* the owner session */
88 GstRTSPSession *session;
90 /* the media we are handling */
91 GstRTSPMediaFactory *factory;
93 /* the pipeline for the media */
95 GstRTSPMediaBin *mediabin;
97 /* RTP session manager */
100 /* for TCP transport */
103 /* configuration for the different streams */
110 * Session information kept by the server for a specific client.
111 * One client session, identified with a session id, can handle multiple medias
112 * identified with the media factory.
114 struct _GstRTSPSession {
122 struct _GstRTSPSessionClass {
123 GObjectClass parent_class;
126 GType gst_rtsp_session_get_type (void);
128 GstRTSPSession * gst_rtsp_session_new (const gchar *sessionid);
130 GstRTSPSessionMedia * gst_rtsp_session_get_media (GstRTSPSession *sess, const gchar *location,
131 GstRTSPMediaFactory *factory);
133 GstStateChangeReturn gst_rtsp_session_media_play (GstRTSPSessionMedia *media);
134 GstStateChangeReturn gst_rtsp_session_media_pause (GstRTSPSessionMedia *media);
135 GstStateChangeReturn gst_rtsp_session_media_stop (GstRTSPSessionMedia *media);
137 GstRTSPSessionStream * gst_rtsp_session_media_get_stream (GstRTSPSessionMedia *media,
140 GstRTSPTransport * gst_rtsp_session_stream_set_transport (GstRTSPSessionStream *stream,
141 const gchar *destination,
142 GstRTSPTransport *ct);
146 #endif /* __GST_RTSP_SESSION_H__ */