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;
45 * @media: the owner #GstRTSPMedia
46 * @srcpad: the srcpad of the stream
47 * @payloader: the payloader of the format
48 * @prepared: if the stream is prepared for streaming
49 * @server_port: the server udp ports
50 * @recv_rtp_sink: sinkpad for RTP buffers
51 * @recv_rtcp_sink: sinkpad for RTCP buffers
52 * @recv_rtp_src: srcpad for RTP buffers
53 * @recv_rtcp_src: srcpad for RTCP buffers
54 * @udpsrc: the udp source elements for RTP/RTCP
55 * @udpsink: the udp sink elements for RTP/RTCP
56 * @caps_sig: the signal id for detecting caps
57 * @caps: the caps of the stream
59 * The definition of a media stream. The streams are identified by @id.
61 struct _GstRTSPMediaStream {
63 GstElement *payloader;
66 /* pads on the rtpbin */
67 GstPad *recv_rtcp_sink;
68 GstPad *send_rtp_sink;
70 GstPad *send_rtcp_src;
72 /* sinks used for sending and receiving RTP and RTCP, they share
74 GstElement *udpsrc[2];
75 GstElement *udpsink[2];
77 /* server ports for sending/receiving */
78 GstRTSPRange server_port;
80 /* the caps of the stream */
87 * @shared: if this media can be shared between clients
88 * @element: the data providing element
89 * @stream: the different streams provided by @element
90 * @prepared: if the media is prepared for streaming
91 * @pipeline: the toplevel pipeline
93 * @multifdsink: multifdsink element for TCP transport
95 * A class that contains the GStreamer element along with a list of
96 * #GstRTSPediaStream objects that can produce data.
98 * This object is usually created from a #GstRTSPMediaFactory.
100 struct _GstRTSPMedia {
110 /* the pipeline for the media */
111 GstElement *pipeline;
113 /* RTP session manager */
116 /* for TCP transport */
117 GstElement *multifdsink;
120 struct _GstRTSPMediaClass {
121 GObjectClass parent_class;
124 GType gst_rtsp_media_get_type (void);
126 /* creating the media */
127 GstRTSPMedia * gst_rtsp_media_new (void);
129 void gst_rtsp_media_set_shared (GstRTSPMedia *media, gboolean shared);
130 gboolean gst_rtsp_media_is_shared (GstRTSPMedia *media);
132 /* prepare the media for playback */
133 gboolean gst_rtsp_media_prepare (GstRTSPMedia *media);
135 /* dealing with the media */
136 guint gst_rtsp_media_n_streams (GstRTSPMedia *media);
137 GstRTSPMediaStream * gst_rtsp_media_get_stream (GstRTSPMedia *media, guint idx);
139 /* add destinations to a stream */
140 gboolean gst_rtsp_media_stream_add (GstRTSPMediaStream *stream, GstRTSPTransport *ct);
141 gboolean gst_rtsp_media_stream_remove (GstRTSPMediaStream *stream, GstRTSPTransport *ct);
143 GstStateChangeReturn gst_rtsp_media_play (GstRTSPMedia *media);
144 GstStateChangeReturn gst_rtsp_media_pause (GstRTSPMedia *media);
145 GstStateChangeReturn gst_rtsp_media_stop (GstRTSPMedia *media);
149 #endif /* __GST_RTSP_MEDIA_H__ */