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.
21 #include <gst/rtsp/gstrtsprange.h>
22 #include <gst/rtsp/gstrtspurl.h>
24 #ifndef __GST_RTSP_MEDIA_H__
25 #define __GST_RTSP_MEDIA_H__
29 /* types for the media */
30 #define GST_TYPE_RTSP_MEDIA (gst_rtsp_media_get_type ())
31 #define GST_IS_RTSP_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MEDIA))
32 #define GST_IS_RTSP_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MEDIA))
33 #define GST_RTSP_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MEDIA, GstRTSPMediaClass))
34 #define GST_RTSP_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MEDIA, GstRTSPMedia))
35 #define GST_RTSP_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MEDIA, GstRTSPMediaClass))
36 #define GST_RTSP_MEDIA_CAST(obj) ((GstRTSPMedia*)(obj))
37 #define GST_RTSP_MEDIA_CLASS_CAST(klass) ((GstRTSPMediaClass*)(klass))
39 typedef struct _GstRTSPMediaStream GstRTSPMediaStream;
40 typedef struct _GstRTSPMedia GstRTSPMedia;
41 typedef struct _GstRTSPMediaClass GstRTSPMediaClass;
42 typedef struct _GstRTSPMediaTrans GstRTSPMediaTrans;
46 * @idx: a stream index
47 * @transport: a transport description
49 * A Transport description for stream @idx
51 struct _GstRTSPMediaTrans {
54 GstRTSPTransport *transport;
60 * @media: the owner #GstRTSPMedia
61 * @srcpad: the srcpad of the stream
62 * @payloader: the payloader of the format
63 * @prepared: if the stream is prepared for streaming
64 * @server_port: the server udp ports
65 * @recv_rtp_sink: sinkpad for RTP buffers
66 * @recv_rtcp_sink: sinkpad for RTCP buffers
67 * @recv_rtp_src: srcpad for RTP buffers
68 * @recv_rtcp_src: srcpad for RTCP buffers
69 * @udpsrc: the udp source elements for RTP/RTCP
70 * @udpsink: the udp sink elements for RTP/RTCP
71 * @caps_sig: the signal id for detecting caps
72 * @caps: the caps of the stream
74 * The definition of a media stream. The streams are identified by @id.
76 struct _GstRTSPMediaStream {
78 GstElement *payloader;
81 /* pads on the rtpbin */
82 GstPad *recv_rtcp_sink;
83 GstPad *send_rtp_sink;
85 GstPad *send_rtcp_src;
87 /* the RTPSession object */
90 /* sinks used for sending and receiving RTP and RTCP, they share
92 GstElement *udpsrc[2];
93 GstElement *udpsink[2];
94 GstElement *appsrc[2];
96 /* server ports for sending/receiving */
97 GstRTSPRange server_port;
99 /* the caps of the stream */
106 * @shared: if this media can be shared between clients
107 * @element: the data providing element
108 * @stream: the different streams provided by @element
109 * @prepared: if the media is prepared for streaming
110 * @pipeline: the toplevel pipeline
111 * @rtpbin: the rtpbin
112 * @multifdsink: multifdsink element for TCP transport
114 * A class that contains the GStreamer element along with a list of
115 * #GstRTSPediaStream objects that can produce data.
117 * This object is usually created from a #GstRTSPMediaFactory.
119 struct _GstRTSPMedia {
129 /* the pipeline for the media */
130 GstElement *pipeline;
136 GstState target_state;
138 /* RTP session manager */
141 /* for TCP transport */
142 GstElement *multifdsink;
144 /* the range of media */
145 GstRTSPTimeRange range;
150 * @context: the main context for dispatching messages
151 * @loop: the mainloop for message.
152 * @thread: the thread dispatching messages.
153 * @handle_message: handle a message
155 * The RTSP media class
157 struct _GstRTSPMediaClass {
158 GObjectClass parent_class;
160 /* thread for the mainloop */
161 GMainContext *context;
165 gboolean (*handle_message) (GstRTSPMedia *media, GstMessage *message);
168 GType gst_rtsp_media_get_type (void);
170 /* creating the media */
171 GstRTSPMedia * gst_rtsp_media_new (void);
173 void gst_rtsp_media_set_shared (GstRTSPMedia *media, gboolean shared);
174 gboolean gst_rtsp_media_is_shared (GstRTSPMedia *media);
176 /* prepare the media for playback */
177 gboolean gst_rtsp_media_prepare (GstRTSPMedia *media);
179 /* dealing with the media */
180 guint gst_rtsp_media_n_streams (GstRTSPMedia *media);
181 GstRTSPMediaStream * gst_rtsp_media_get_stream (GstRTSPMedia *media, guint idx);
183 gboolean gst_rtsp_media_play (GstRTSPMedia *media, GArray *trans);
184 gboolean gst_rtsp_media_pause (GstRTSPMedia *media, GArray *trans);
185 gboolean gst_rtsp_media_stop (GstRTSPMedia *media, GArray *trans);
189 #endif /* __GST_RTSP_MEDIA_H__ */