Add new API for setting/getting maximum multicast ttl value
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-stream.h
1 /* GStreamer
2  * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
3  *
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.
8  *
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.
13  *
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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #include <gst/gst.h>
21 #include <gst/rtsp/rtsp.h>
22 #include <gio/gio.h>
23
24 #ifndef __GST_RTSP_STREAM_H__
25 #define __GST_RTSP_STREAM_H__
26
27 #include "rtsp-server-prelude.h"
28
29 G_BEGIN_DECLS
30
31 /* types for the media stream */
32 #define GST_TYPE_RTSP_STREAM              (gst_rtsp_stream_get_type ())
33 #define GST_IS_RTSP_STREAM(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_STREAM))
34 #define GST_IS_RTSP_STREAM_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_STREAM))
35 #define GST_RTSP_STREAM_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_STREAM, GstRTSPStreamClass))
36 #define GST_RTSP_STREAM(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_STREAM, GstRTSPStream))
37 #define GST_RTSP_STREAM_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_STREAM, GstRTSPStreamClass))
38 #define GST_RTSP_STREAM_CAST(obj)         ((GstRTSPStream*)(obj))
39 #define GST_RTSP_STREAM_CLASS_CAST(klass) ((GstRTSPStreamClass*)(klass))
40
41 typedef struct _GstRTSPStream GstRTSPStream;
42 typedef struct _GstRTSPStreamClass GstRTSPStreamClass;
43 typedef struct _GstRTSPStreamPrivate GstRTSPStreamPrivate;
44
45 #include "rtsp-stream-transport.h"
46 #include "rtsp-address-pool.h"
47 #include "rtsp-session.h"
48 #include "rtsp-media.h"
49
50 /**
51  * GstRTSPStream:
52  *
53  * The definition of a media stream.
54  */
55 struct _GstRTSPStream {
56   GObject       parent;
57
58   /*< private >*/
59   GstRTSPStreamPrivate *priv;
60   gpointer _gst_reserved[GST_PADDING];
61 };
62
63 struct _GstRTSPStreamClass {
64   GObjectClass parent_class;
65
66   /*< private >*/
67   gpointer _gst_reserved[GST_PADDING];
68 };
69
70 GST_RTSP_SERVER_API
71 GType             gst_rtsp_stream_get_type         (void);
72
73 GST_RTSP_SERVER_API
74 GstRTSPStream *   gst_rtsp_stream_new              (guint idx, GstElement *payloader,
75                                                     GstPad *pad);
76
77 GST_RTSP_SERVER_API
78 guint             gst_rtsp_stream_get_index        (GstRTSPStream *stream);
79
80 GST_RTSP_SERVER_API
81 guint             gst_rtsp_stream_get_pt           (GstRTSPStream *stream);
82
83 GST_RTSP_SERVER_API
84 GstPad *          gst_rtsp_stream_get_srcpad       (GstRTSPStream *stream);
85
86 GST_RTSP_SERVER_API
87 GstPad *          gst_rtsp_stream_get_sinkpad      (GstRTSPStream *stream);
88
89 GST_RTSP_SERVER_API
90 void              gst_rtsp_stream_set_control      (GstRTSPStream *stream, const gchar *control);
91
92 GST_RTSP_SERVER_API
93 gchar *           gst_rtsp_stream_get_control      (GstRTSPStream *stream);
94
95 GST_RTSP_SERVER_API
96 gboolean          gst_rtsp_stream_has_control      (GstRTSPStream *stream, const gchar *control);
97
98 GST_RTSP_SERVER_API
99 void              gst_rtsp_stream_set_mtu          (GstRTSPStream *stream, guint mtu);
100
101 GST_RTSP_SERVER_API
102 guint             gst_rtsp_stream_get_mtu          (GstRTSPStream *stream);
103
104 GST_RTSP_SERVER_API
105 void              gst_rtsp_stream_set_dscp_qos     (GstRTSPStream *stream, gint dscp_qos);
106
107 GST_RTSP_SERVER_API
108 gint              gst_rtsp_stream_get_dscp_qos     (GstRTSPStream *stream);
109
110 GST_RTSP_SERVER_API
111 gboolean          gst_rtsp_stream_is_transport_supported  (GstRTSPStream *stream,
112                                                            GstRTSPTransport *transport);
113
114 GST_RTSP_SERVER_API
115 void              gst_rtsp_stream_set_profiles     (GstRTSPStream *stream, GstRTSPProfile profiles);
116
117 GST_RTSP_SERVER_API
118 GstRTSPProfile    gst_rtsp_stream_get_profiles     (GstRTSPStream *stream);
119
120 GST_RTSP_SERVER_API
121 void              gst_rtsp_stream_set_protocols    (GstRTSPStream *stream, GstRTSPLowerTrans protocols);
122
123 GST_RTSP_SERVER_API
124 GstRTSPLowerTrans gst_rtsp_stream_get_protocols    (GstRTSPStream *stream);
125
126 GST_RTSP_SERVER_API
127 void              gst_rtsp_stream_set_address_pool (GstRTSPStream *stream, GstRTSPAddressPool *pool);
128
129 GST_RTSP_SERVER_API
130 GstRTSPAddressPool *
131                   gst_rtsp_stream_get_address_pool (GstRTSPStream *stream);
132
133 GST_RTSP_SERVER_API
134 void              gst_rtsp_stream_set_multicast_iface (GstRTSPStream *stream, const gchar * multicast_iface);
135
136 GST_RTSP_SERVER_API
137 gchar *           gst_rtsp_stream_get_multicast_iface (GstRTSPStream *stream);
138
139 GST_RTSP_SERVER_API
140 GstRTSPAddress *  gst_rtsp_stream_reserve_address  (GstRTSPStream *stream,
141                                                     const gchar * address,
142                                                     guint port,
143                                                     guint n_ports,
144                                                     guint ttl);
145
146 GST_RTSP_SERVER_API
147 gboolean          gst_rtsp_stream_join_bin         (GstRTSPStream *stream,
148                                                     GstBin *bin, GstElement *rtpbin,
149                                                     GstState state);
150
151 GST_RTSP_SERVER_API
152 gboolean          gst_rtsp_stream_leave_bin        (GstRTSPStream *stream,
153                                                     GstBin *bin, GstElement *rtpbin);
154
155 GST_RTSP_SERVER_API
156 GstBin *          gst_rtsp_stream_get_joined_bin   (GstRTSPStream *stream);
157
158 GST_RTSP_SERVER_API
159 gboolean          gst_rtsp_stream_set_blocked      (GstRTSPStream * stream,
160                                                     gboolean blocked);
161
162 GST_RTSP_SERVER_API
163 gboolean          gst_rtsp_stream_is_blocking      (GstRTSPStream * stream);
164
165
166 GST_RTSP_SERVER_API
167 gboolean          gst_rtsp_stream_unblock_linked   (GstRTSPStream * stream);
168
169 GST_RTSP_SERVER_API
170 void              gst_rtsp_stream_set_client_side (GstRTSPStream *stream, gboolean client_side);
171
172 GST_RTSP_SERVER_API
173 gboolean          gst_rtsp_stream_is_client_side (GstRTSPStream *stream);
174
175 GST_RTSP_SERVER_API
176 void              gst_rtsp_stream_get_server_port  (GstRTSPStream *stream,
177                                                     GstRTSPRange *server_port,
178                                                     GSocketFamily family);
179
180 GST_RTSP_SERVER_API
181 GstRTSPAddress *  gst_rtsp_stream_get_multicast_address (GstRTSPStream *stream,
182                                                          GSocketFamily family);
183
184
185 GST_RTSP_SERVER_API
186 GObject *         gst_rtsp_stream_get_rtpsession   (GstRTSPStream *stream);
187
188 GST_RTSP_SERVER_API
189 GstElement *      gst_rtsp_stream_get_srtp_encoder (GstRTSPStream *stream);
190
191 GST_RTSP_SERVER_API
192 void              gst_rtsp_stream_get_ssrc         (GstRTSPStream *stream,
193                                                     guint *ssrc);
194
195 GST_RTSP_SERVER_API
196 gboolean          gst_rtsp_stream_get_rtpinfo      (GstRTSPStream *stream,
197                                                     guint *rtptime, guint *seq,
198                                                     guint *clock_rate,
199                                                     GstClockTime *running_time);
200
201 GST_RTSP_SERVER_API
202 GstCaps *         gst_rtsp_stream_get_caps         (GstRTSPStream *stream);
203
204 GST_RTSP_SERVER_API
205 GstFlowReturn     gst_rtsp_stream_recv_rtp         (GstRTSPStream *stream,
206                                                     GstBuffer *buffer);
207
208 GST_RTSP_SERVER_API
209 GstFlowReturn     gst_rtsp_stream_recv_rtcp        (GstRTSPStream *stream,
210                                                     GstBuffer *buffer);
211
212 GST_RTSP_SERVER_API
213 gboolean          gst_rtsp_stream_add_transport    (GstRTSPStream *stream,
214                                                     GstRTSPStreamTransport *trans);
215
216 GST_RTSP_SERVER_API
217 gboolean          gst_rtsp_stream_remove_transport (GstRTSPStream *stream,
218                                                     GstRTSPStreamTransport *trans);
219
220 GST_RTSP_SERVER_API
221 GSocket *         gst_rtsp_stream_get_rtp_socket   (GstRTSPStream *stream,
222                                                     GSocketFamily family);
223
224 GST_RTSP_SERVER_API
225 GSocket *         gst_rtsp_stream_get_rtcp_socket  (GstRTSPStream *stream,
226                                                     GSocketFamily family);
227
228 GST_RTSP_SERVER_API
229 GSocket *         gst_rtsp_stream_get_rtp_multicast_socket (GstRTSPStream *stream,
230                                                             GSocketFamily family);
231
232 GST_RTSP_SERVER_API
233 GSocket *         gst_rtsp_stream_get_rtcp_multicast_socket (GstRTSPStream *stream,
234                                                              GSocketFamily family);
235
236 GST_RTSP_SERVER_API
237 gboolean          gst_rtsp_stream_update_crypto    (GstRTSPStream * stream,
238                                                     guint ssrc, GstCaps * crypto);
239
240 GST_RTSP_SERVER_API
241 gboolean          gst_rtsp_stream_query_position   (GstRTSPStream * stream,
242                                                     gint64 * position);
243
244 GST_RTSP_SERVER_API
245 gboolean          gst_rtsp_stream_query_stop       (GstRTSPStream * stream,
246                                                     gint64 * stop);
247
248 GST_RTSP_SERVER_API
249 gboolean          gst_rtsp_stream_seekable         (GstRTSPStream *stream);
250
251 GST_RTSP_SERVER_API
252 void              gst_rtsp_stream_set_seqnum_offset          (GstRTSPStream *stream, guint16 seqnum);
253
254 GST_RTSP_SERVER_API
255 guint16           gst_rtsp_stream_get_current_seqnum          (GstRTSPStream *stream);
256
257 GST_RTSP_SERVER_API
258 void              gst_rtsp_stream_set_retransmission_time     (GstRTSPStream *stream, GstClockTime time);
259
260 GST_RTSP_SERVER_API
261 GstClockTime      gst_rtsp_stream_get_retransmission_time     (GstRTSPStream *stream);
262
263 GST_RTSP_SERVER_API
264 guint             gst_rtsp_stream_get_retransmission_pt       (GstRTSPStream * stream);
265
266 GST_RTSP_SERVER_API
267 void              gst_rtsp_stream_set_retransmission_pt       (GstRTSPStream * stream,
268                                                                guint rtx_pt);
269
270 GST_RTSP_SERVER_API
271 void              gst_rtsp_stream_set_buffer_size  (GstRTSPStream *stream, guint size);
272
273 GST_RTSP_SERVER_API
274 guint             gst_rtsp_stream_get_buffer_size  (GstRTSPStream *stream);
275
276 GST_RTSP_SERVER_API
277 void              gst_rtsp_stream_set_pt_map                 (GstRTSPStream * stream, guint pt, GstCaps * caps);
278
279 GST_RTSP_SERVER_API
280 GstElement *      gst_rtsp_stream_request_aux_sender         (GstRTSPStream * stream, guint sessid);
281
282 GST_RTSP_SERVER_API
283 GstElement *      gst_rtsp_stream_request_aux_receiver       (GstRTSPStream * stream, guint sessid);
284
285 GST_RTSP_SERVER_API
286 gboolean          gst_rtsp_stream_allocate_udp_sockets       (GstRTSPStream * stream, GSocketFamily family,
287                                                               GstRTSPTransport *transport, gboolean use_client_settings);
288
289 GST_RTSP_SERVER_API
290 void                    gst_rtsp_stream_set_publish_clock_mode (GstRTSPStream * stream, GstRTSPPublishClockMode mode);
291
292 GST_RTSP_SERVER_API
293 GstRTSPPublishClockMode gst_rtsp_stream_get_publish_clock_mode (GstRTSPStream * stream);
294
295 GST_RTSP_SERVER_API
296 gboolean                gst_rtsp_stream_set_max_mcast_ttl  (GstRTSPStream *stream, guint ttl);
297
298 GST_RTSP_SERVER_API
299 guint             gst_rtsp_stream_get_max_mcast_ttl  (GstRTSPStream *stream);
300
301 GST_RTSP_SERVER_API
302 gboolean          gst_rtsp_stream_complete_stream (GstRTSPStream * stream, const GstRTSPTransport * transport);
303
304 GST_RTSP_SERVER_API
305 gboolean           gst_rtsp_stream_is_complete (GstRTSPStream * stream);
306
307 GST_RTSP_SERVER_API
308 gboolean           gst_rtsp_stream_is_sender (GstRTSPStream * stream);
309
310 GST_RTSP_SERVER_API
311 gboolean           gst_rtsp_stream_is_receiver (GstRTSPStream * stream);
312
313 GST_RTSP_SERVER_API
314 gboolean           gst_rtsp_stream_handle_keymgmt (GstRTSPStream *stream, const gchar *keymgmt);
315
316 /* ULP Forward Error Correction (RFC 5109) */
317 GST_RTSP_SERVER_API
318 gboolean           gst_rtsp_stream_get_ulpfec_enabled (GstRTSPStream *stream);
319
320 GST_RTSP_SERVER_API
321 void               gst_rtsp_stream_set_ulpfec_pt (GstRTSPStream *stream, guint pt);
322
323 GST_RTSP_SERVER_API
324 guint              gst_rtsp_stream_get_ulpfec_pt (GstRTSPStream *stream);
325
326 GST_RTSP_SERVER_API
327 GstElement *       gst_rtsp_stream_request_ulpfec_decoder (GstRTSPStream *stream, GstElement *rtpbin, guint sessid);
328
329 GST_RTSP_SERVER_API
330 GstElement *       gst_rtsp_stream_request_ulpfec_encoder (GstRTSPStream *stream, guint sessid);
331
332 GST_RTSP_SERVER_API
333 void               gst_rtsp_stream_set_ulpfec_percentage (GstRTSPStream *stream, guint percentage);
334
335 GST_RTSP_SERVER_API
336 guint              gst_rtsp_stream_get_ulpfec_percentage (GstRTSPStream *stream);
337
338 /**
339  * GstRTSPStreamTransportFilterFunc:
340  * @stream: a #GstRTSPStream object
341  * @trans: a #GstRTSPStreamTransport in @stream
342  * @user_data: user data that has been given to gst_rtsp_stream_transport_filter()
343  *
344  * This function will be called by the gst_rtsp_stream_transport_filter(). An
345  * implementation should return a value of #GstRTSPFilterResult.
346  *
347  * When this function returns #GST_RTSP_FILTER_REMOVE, @trans will be removed
348  * from @stream.
349  *
350  * A return value of #GST_RTSP_FILTER_KEEP will leave @trans untouched in
351  * @stream.
352  *
353  * A value of #GST_RTSP_FILTER_REF will add @trans to the result #GList of
354  * gst_rtsp_stream_transport_filter().
355  *
356  * Returns: a #GstRTSPFilterResult.
357  */
358 typedef GstRTSPFilterResult (*GstRTSPStreamTransportFilterFunc) (GstRTSPStream *stream,
359                                                                  GstRTSPStreamTransport *trans,
360                                                                  gpointer user_data);
361
362 GST_RTSP_SERVER_API
363 GList *                gst_rtsp_stream_transport_filter  (GstRTSPStream *stream,
364                                                           GstRTSPStreamTransportFilterFunc func,
365                                                           gpointer user_data);
366
367 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
368 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPStream, gst_object_unref)
369 #endif
370
371 G_END_DECLS
372
373 #endif /* __GST_RTSP_STREAM_H__ */