2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * <2006> Wim Taymans <wim@fluendo.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 * Unless otherwise indicated, Source Code is licensed under MIT license.
22 * See further explanation attached in License Statement (distributed in the file
25 * Permission is hereby granted, free of charge, to any person obtaining a copy of
26 * this software and associated documentation files (the "Software"), to deal in
27 * the Software without restriction, including without limitation the rights to
28 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
29 * of the Software, and to permit persons to whom the Software is furnished to do
30 * so, subject to the following conditions:
32 * The above copyright notice and this permission notice shall be included in all
33 * copies or substantial portions of the Software.
35 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44 #ifndef __GST_RTSPSRC_H__
45 #define __GST_RTSPSRC_H__
51 #include <gst/rtsp/rtsp.h>
54 #include "gstrtspext.h"
56 #define GST_TYPE_RTSPSRC \
57 (gst_rtspsrc_get_type())
58 #define GST_RTSPSRC(obj) \
59 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTSPSRC,GstRTSPSrc))
60 #define GST_RTSPSRC_CLASS(klass) \
61 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTSPSRC,GstRTSPSrcClass))
62 #define GST_IS_RTSPSRC(obj) \
63 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTSPSRC))
64 #define GST_IS_RTSPSRC_CLASS(klass) \
65 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTSPSRC))
66 #define GST_RTSPSRC_CAST(obj) \
69 typedef struct _GstRTSPSrc GstRTSPSrc;
70 typedef struct _GstRTSPSrcClass GstRTSPSrcClass;
72 #define GST_RTSP_STATE_GET_LOCK(rtsp) (&GST_RTSPSRC_CAST(rtsp)->state_rec_lock)
73 #define GST_RTSP_STATE_LOCK(rtsp) (g_rec_mutex_lock (GST_RTSP_STATE_GET_LOCK(rtsp)))
74 #define GST_RTSP_STATE_UNLOCK(rtsp) (g_rec_mutex_unlock (GST_RTSP_STATE_GET_LOCK(rtsp)))
76 #define GST_RTSP_STREAM_GET_LOCK(rtsp) (&GST_RTSPSRC_CAST(rtsp)->stream_rec_lock)
77 #define GST_RTSP_STREAM_LOCK(rtsp) (g_rec_mutex_lock (GST_RTSP_STREAM_GET_LOCK(rtsp)))
78 #define GST_RTSP_STREAM_UNLOCK(rtsp) (g_rec_mutex_unlock (GST_RTSP_STREAM_GET_LOCK(rtsp)))
80 typedef struct _GstRTSPConnInfo GstRTSPConnInfo;
82 struct _GstRTSPConnInfo {
86 GstRTSPConnection *connection;
94 typedef struct _GstRTSPStream GstRTSPStream;
96 struct _GstRTSPStream {
99 GstRTSPSrc *parent; /* parent, no extra ref to parent is taken */
101 /* pad we expose or NULL when it does not have an actual pad */
103 GstFlowReturn last_ret;
110 gboolean waiting_setup_response;
112 /* for interleaved mode */
114 GstPad *channelpad[2];
116 /* our udp sources */
117 GstElement *udpsrc[2];
122 /* our udp sinks back to the server */
123 GstElement *udpsink[2];
126 /* fakesrc for sending dummy data or appsrc for sending backchannel data */
134 GstRTSPProfile profile;
136 /* original control url */
142 GstCaps *srtcpparams;
146 /* per stream connection */
147 GstRTSPConnInfo conninfo;
152 /* srtp key management */
153 GstMIKEYMessage *mikey;
162 gboolean is_multicast;
164 gboolean is_backchannel;
166 /* A unique and stable id we will use for the stream start event */
169 GstStructure *rtx_pt_map;
174 * @GST_RTSP_NAT_NONE: none
175 * @GST_RTSP_NAT_DUMMY: send dummy packets
177 * Different methods for trying to traverse firewalls.
188 /* task and mutex for interleaved mode */
189 gboolean interleaved;
191 GRecMutex stream_rec_lock;
197 gboolean need_segment;
198 GstClockTime base_time;
203 gboolean ignore_timeout;
206 /* mutex for protecting state changes */
207 GRecMutex state_rec_lock;
213 gboolean need_activate;
216 GstRTSPLowerTrans protocols;
220 GTimeVal tcp_timeout;
221 GTimeVal *ptcp_timeout;
223 gboolean drop_on_latency;
224 guint64 connection_speed;
225 GstRTSPNatMethod nat_method;
227 gboolean do_rtsp_keep_alive;
230 gchar *proxy_user; /* from url or property */
231 gchar *proxy_passwd; /* from url or property */
232 gchar *prop_proxy_id; /* set via property */
233 gchar *prop_proxy_pw; /* set via property */
238 GstRTSPRange client_port_range;
239 gint udp_buffer_size;
240 gboolean short_header;
242 gboolean udp_reconnect;
245 gboolean use_pipeline_clock;
247 GTlsCertificateFlags tls_validation_flags;
248 GTlsDatabase *tls_database;
249 GTlsInteraction *tls_interaction;
250 gboolean do_retransmission;
251 gint ntp_time_source;
253 GstClockTime max_rtcp_rtp_time_diff;
254 gboolean rfc7273_sync;
255 guint64 max_ts_offset_adjustment;
256 gint64 max_ts_offset;
257 gboolean max_ts_offset_is_set;
263 GstRTSPLowerTrans cur_protocols;
264 gboolean tried_url_auth;
266 gboolean need_redirect;
267 GstRTSPTimeRange *range;
270 GstClock *provided_clock;
272 /* supported methods */
276 * -1.0 : Stream is not seekable
277 * 0.0 : seekable only to the beginning
278 * G_MAXFLOAT : Any value is possible
280 * Any other positive value indicates the longest duration
281 * between any two random access points
284 GstClockTime last_pos;
286 /* session management */
288 gulong manager_sig_id;
289 gulong manager_ptmap_id;
290 gboolean use_buffering;
292 GstRTSPConnInfo conninfo;
294 /* a list of RTSP extensions as GstElement */
295 GstRTSPExtensionList *extensions;
297 GstRTSPVersion default_version;
298 GstRTSPVersion version;
301 struct _GstRTSPSrcClass {
302 GstBinClass parent_class;
304 GstFlowReturn (*push_backchannel_buffer) (GstRTSPSrc *src, guint id, GstSample *sample);
307 GType gst_rtspsrc_get_type(void);
311 #endif /* __GST_RTSPSRC_H__ */