2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * <2006> Wim Taymans <wim@fluendo.com>
4 * <2015> Jan Schmidt <jan at centricular dot com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 * Unless otherwise indicated, Source Code is licensed under MIT license.
23 * See further explanation attached in License Statement (distributed in the file
26 * Permission is hereby granted, free of charge, to any person obtaining a copy of
27 * this software and associated documentation files (the "Software"), to deal in
28 * the Software without restriction, including without limitation the rights to
29 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
30 * of the Software, and to permit persons to whom the Software is furnished to do
31 * so, subject to the following conditions:
33 * The above copyright notice and this permission notice shall be included in all
34 * copies or substantial portions of the Software.
36 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45 #ifndef __GST_RTSP_CLIENT_SINK_H__
46 #define __GST_RTSP_CLIENT_SINK_H__
52 #include <gst/rtsp-server/rtsp-stream.h>
53 #include <gst/rtsp/rtsp.h>
56 #define GST_TYPE_RTSP_CLIENT_SINK \
57 (gst_rtsp_client_sink_get_type())
58 #define GST_RTSP_CLIENT_SINK(obj) \
59 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTSP_CLIENT_SINK,GstRTSPClientSink))
60 #define GST_RTSP_CLIENT_SINK_CLASS(klass) \
61 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTSP_CLIENT_SINK,GstRTSPClientSinkClass))
62 #define GST_IS_RTSP_CLIENT_SINK(obj) \
63 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTSP_CLIENT_SINK))
64 #define GST_IS_RTSP_CLIENT_SINK_CLASS(klass) \
65 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTSP_CLIENT_SINK))
66 #define GST_RTSP_CLIENT_SINK_CAST(obj) \
67 ((GstRTSPClientSink *)(obj))
69 typedef struct _GstRTSPClientSink GstRTSPClientSink;
70 typedef struct _GstRTSPClientSinkClass GstRTSPClientSinkClass;
72 #define GST_RTSP_STATE_GET_LOCK(rtsp) (&GST_RTSP_CLIENT_SINK_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_RTSP_CLIENT_SINK_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;
91 typedef struct _GstRTSPStreamInfo GstRTSPStreamInfo;
92 typedef struct _GstRTSPStreamContext GstRTSPStreamContext;
94 struct _GstRTSPStreamContext {
95 GstRTSPClientSink *parent;
98 /* Index of the SDPMedia in the stored SDP */
101 GstElement *payloader;
102 guint payloader_block_id;
105 /* Stream management object */
106 GstRTSPStream *stream;
109 /* Secure profile key mgmt */
110 GstCaps *srtcpparams;
112 /* per stream connection */
113 GstRTSPConnInfo conninfo;
114 /* For interleaved mode */
117 GstRTSPStreamTransport *stream_transport;
122 * @GST_RTSP_NAT_NONE: none
123 * @GST_RTSP_NAT_DUMMY: send dummy packets
125 * Different methods for trying to traverse firewalls.
133 struct _GstRTSPClientSink {
136 /* task and mutex for interleaved mode */
137 gboolean interleaved;
139 GRecMutex stream_rec_lock;
146 gboolean ignore_timeout;
149 /* mutex for protecting state changes */
150 GRecMutex state_rec_lock;
152 GstSDPMessage *uri_sdp;
156 GstRTSPLowerTrans protocols;
160 GTimeVal tcp_timeout;
161 GTimeVal *ptcp_timeout;
163 gboolean do_rtsp_keep_alive;
166 gchar *proxy_user; /* from url or property */
167 gchar *proxy_passwd; /* from url or property */
168 gchar *prop_proxy_id; /* set via property */
169 gchar *prop_proxy_pw; /* set via property */
173 GstRTSPRange client_port_range;
174 gint udp_buffer_size;
175 gboolean udp_reconnect;
178 gboolean use_pipeline_clock;
180 GTlsCertificateFlags tls_validation_flags;
181 GTlsDatabase *tls_database;
182 GTlsInteraction *tls_interaction;
183 gint ntp_time_source;
189 GstRTSPLowerTrans cur_protocols;
190 gboolean tried_url_auth;
192 gboolean need_redirect;
193 GstRTSPTimeRange *range;
196 GstClock *provided_clock;
198 /* supported methods */
201 /* session management */
202 GstRTSPConnInfo conninfo;
204 /* Everything goes in an internal
205 * locked-state bin */
206 GstBin *internal_bin;
207 /* Set to true when internal bin state
211 /* TRUE if we posted async-start */
214 /* TRUE when stream info has been collected */
215 gboolean streams_collected;
223 GstSDPMessage cursdp;
230 GstClockTime rtx_time;
232 GstRTSPProfile profiles;
236 struct _GstRTSPClientSinkClass {
237 GstBinClass parent_class;
240 GType gst_rtsp_client_sink_get_type(void);
244 #endif /* __GST_RTSP_CLIENT_SINK_H__ */