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/gstrtspurl.h>
23 #ifndef __GST_RTSP_MEDIA_H__
24 #define __GST_RTSP_MEDIA_H__
28 /* types for the media */
29 #define GST_TYPE_RTSP_MEDIA (gst_rtsp_media_get_type ())
30 #define GST_IS_RTSP_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MEDIA))
31 #define GST_IS_RTSP_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MEDIA))
32 #define GST_RTSP_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MEDIA, GstRTSPMediaClass))
33 #define GST_RTSP_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MEDIA, GstRTSPMedia))
34 #define GST_RTSP_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MEDIA, GstRTSPMediaClass))
35 #define GST_RTSP_MEDIA_CAST(obj) ((GstRTSPMedia*)(obj))
36 #define GST_RTSP_MEDIA_CLASS_CAST(klass) ((GstRTSPMediaClass*)(klass))
38 typedef struct _GstRTSPMediaStream GstRTSPMediaStream;
39 typedef struct _GstRTSPMedia GstRTSPMedia;
40 typedef struct _GstRTSPMediaClass GstRTSPMediaClass;
41 typedef struct _GstRTSPMediaTrans GstRTSPMediaTrans;
45 * @idx: a stream index
46 * @transport: a transport description
48 * A Transport description for stream @idx
50 struct _GstRTSPMediaTrans {
53 GstRTSPTransport *transport;
59 * @media: the owner #GstRTSPMedia
60 * @srcpad: the srcpad of the stream
61 * @payloader: the payloader of the format
62 * @prepared: if the stream is prepared for streaming
63 * @server_port: the server udp ports
64 * @recv_rtp_sink: sinkpad for RTP buffers
65 * @recv_rtcp_sink: sinkpad for RTCP buffers
66 * @recv_rtp_src: srcpad for RTP buffers
67 * @recv_rtcp_src: srcpad for RTCP buffers
68 * @udpsrc: the udp source elements for RTP/RTCP
69 * @udpsink: the udp sink elements for RTP/RTCP
70 * @caps_sig: the signal id for detecting caps
71 * @caps: the caps of the stream
73 * The definition of a media stream. The streams are identified by @id.
75 struct _GstRTSPMediaStream {
77 GstElement *payloader;
80 /* pads on the rtpbin */
81 GstPad *recv_rtcp_sink;
82 GstPad *send_rtp_sink;
84 GstPad *send_rtcp_src;
86 /* sinks used for sending and receiving RTP and RTCP, they share
88 GstElement *udpsrc[2];
89 GstElement *udpsink[2];
91 /* server ports for sending/receiving */
92 GstRTSPRange server_port;
94 /* the caps of the stream */
101 * @shared: if this media can be shared between clients
102 * @element: the data providing element
103 * @stream: the different streams provided by @element
104 * @prepared: if the media is prepared for streaming
105 * @pipeline: the toplevel pipeline
106 * @rtpbin: the rtpbin
107 * @multifdsink: multifdsink element for TCP transport
109 * A class that contains the GStreamer element along with a list of
110 * #GstRTSPediaStream objects that can produce data.
112 * This object is usually created from a #GstRTSPMediaFactory.
114 struct _GstRTSPMedia {
124 /* the pipeline for the media */
125 GstElement *pipeline;
127 /* RTP session manager */
130 /* for TCP transport */
131 GstElement *multifdsink;
134 struct _GstRTSPMediaClass {
135 GObjectClass parent_class;
138 GType gst_rtsp_media_get_type (void);
140 /* creating the media */
141 GstRTSPMedia * gst_rtsp_media_new (void);
143 void gst_rtsp_media_set_shared (GstRTSPMedia *media, gboolean shared);
144 gboolean gst_rtsp_media_is_shared (GstRTSPMedia *media);
146 /* prepare the media for playback */
147 gboolean gst_rtsp_media_prepare (GstRTSPMedia *media);
149 /* dealing with the media */
150 guint gst_rtsp_media_n_streams (GstRTSPMedia *media);
151 GstRTSPMediaStream * gst_rtsp_media_get_stream (GstRTSPMedia *media, guint idx);
153 gboolean gst_rtsp_media_play (GstRTSPMedia *media, GArray *trans);
154 gboolean gst_rtsp_media_pause (GstRTSPMedia *media, GArray *trans);
155 gboolean gst_rtsp_media_stop (GstRTSPMedia *media, GArray *trans);
159 #endif /* __GST_RTSP_MEDIA_H__ */