stream: add method to filter transports
[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/gstrtsprange.h>
22 #include <gst/rtsp/gstrtspurl.h>
23 #include <gio/gio.h>
24
25 #ifndef __GST_RTSP_STREAM_H__
26 #define __GST_RTSP_STREAM_H__
27
28 G_BEGIN_DECLS
29
30 /* types for the media stream */
31 #define GST_TYPE_RTSP_STREAM              (gst_rtsp_stream_get_type ())
32 #define GST_IS_RTSP_STREAM(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_STREAM))
33 #define GST_IS_RTSP_STREAM_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_STREAM))
34 #define GST_RTSP_STREAM_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_STREAM, GstRTSPStreamClass))
35 #define GST_RTSP_STREAM(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_STREAM, GstRTSPStream))
36 #define GST_RTSP_STREAM_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_STREAM, GstRTSPStreamClass))
37 #define GST_RTSP_STREAM_CAST(obj)         ((GstRTSPStream*)(obj))
38 #define GST_RTSP_STREAM_CLASS_CAST(klass) ((GstRTSPStreamClass*)(klass))
39
40 typedef struct _GstRTSPStream GstRTSPStream;
41 typedef struct _GstRTSPStreamClass GstRTSPStreamClass;
42 typedef struct _GstRTSPStreamPrivate GstRTSPStreamPrivate;
43
44 #include "rtsp-stream-transport.h"
45 #include "rtsp-address-pool.h"
46 #include "rtsp-session.h"
47
48 /**
49  * GstRTSPStream:
50  *
51  * The definition of a media stream.
52  */
53 struct _GstRTSPStream {
54   GObject       parent;
55
56   /*< private >*/
57   GstRTSPStreamPrivate *priv;
58 };
59
60 struct _GstRTSPStreamClass {
61   GObjectClass parent_class;
62 };
63
64 GType             gst_rtsp_stream_get_type         (void);
65
66 GstRTSPStream *   gst_rtsp_stream_new              (guint idx, GstElement *payloader,
67                                                     GstPad *srcpad);
68 guint             gst_rtsp_stream_get_index        (GstRTSPStream *stream);
69 GstPad *          gst_rtsp_stream_get_srcpad       (GstRTSPStream *stream);
70
71 void              gst_rtsp_stream_set_control      (GstRTSPStream *stream, const gchar *control);
72 gchar *           gst_rtsp_stream_get_control      (GstRTSPStream *stream);
73 gboolean          gst_rtsp_stream_has_control      (GstRTSPStream *stream, const gchar *control);
74
75 void              gst_rtsp_stream_set_mtu          (GstRTSPStream *stream, guint mtu);
76 guint             gst_rtsp_stream_get_mtu          (GstRTSPStream *stream);
77
78 void              gst_rtsp_stream_set_dscp_qos     (GstRTSPStream *stream, gint dscp_qos);
79 gint              gst_rtsp_stream_get_dscp_qos     (GstRTSPStream *stream);
80
81 void              gst_rtsp_stream_set_protocols    (GstRTSPStream *stream, GstRTSPLowerTrans protocols);
82 GstRTSPLowerTrans gst_rtsp_stream_get_protocols    (GstRTSPStream *stream);
83
84 void              gst_rtsp_stream_set_address_pool (GstRTSPStream *stream, GstRTSPAddressPool *pool);
85 GstRTSPAddressPool *
86                   gst_rtsp_stream_get_address_pool (GstRTSPStream *stream);
87
88 GstRTSPAddress *  gst_rtsp_stream_reserve_address  (GstRTSPStream *stream,
89                                                     const gchar * address,
90                                                     guint port,
91                                                     guint n_ports,
92                                                     guint ttl);
93
94 gboolean          gst_rtsp_stream_join_bin         (GstRTSPStream *stream,
95                                                     GstBin *bin, GstElement *rtpbin,
96                                                     GstState state);
97 gboolean          gst_rtsp_stream_leave_bin        (GstRTSPStream *stream,
98                                                     GstBin *bin, GstElement *rtpbin);
99
100 void              gst_rtsp_stream_get_server_port  (GstRTSPStream *stream,
101                                                     GstRTSPRange *server_port,
102                                                     GSocketFamily family);
103 GstRTSPAddress *  gst_rtsp_stream_get_multicast_address (GstRTSPStream *stream,
104                                                          GSocketFamily family);
105
106
107 GObject *         gst_rtsp_stream_get_rtpsession   (GstRTSPStream *stream);
108
109 void              gst_rtsp_stream_get_ssrc         (GstRTSPStream *stream,
110                                                     guint *ssrc);
111
112 gboolean          gst_rtsp_stream_get_rtpinfo      (GstRTSPStream *stream,
113                                                     guint *rtptime, guint *seq);
114 GstCaps *         gst_rtsp_stream_get_caps         (GstRTSPStream *stream);
115
116 GstFlowReturn     gst_rtsp_stream_recv_rtp         (GstRTSPStream *stream,
117                                                     GstBuffer *buffer);
118 GstFlowReturn     gst_rtsp_stream_recv_rtcp        (GstRTSPStream *stream,
119                                                     GstBuffer *buffer);
120
121 gboolean          gst_rtsp_stream_add_transport    (GstRTSPStream *stream,
122                                                     GstRTSPStreamTransport *trans);
123 gboolean          gst_rtsp_stream_remove_transport (GstRTSPStream *stream,
124                                                     GstRTSPStreamTransport *trans);
125
126 GSocket *         gst_rtsp_stream_get_rtp_socket   (GstRTSPStream *stream,
127                                                     GSocketFamily family);
128 GSocket *         gst_rtsp_stream_get_rtcp_socket  (GstRTSPStream *stream,
129                                                     GSocketFamily family);
130
131 /**
132  * GstRTSPStreamTransportFilterFunc:
133  * @stream: a #GstRTSPStream object
134  * @trans: a #GstRTSPStreamTransport in @stream
135  * @user_data: user data that has been given to gst_rtsp_stream_transport_filter()
136  *
137  * This function will be called by the gst_rtsp_stream_transport_filter(). An
138  * implementation should return a value of #GstRTSPFilterResult.
139  *
140  * When this function returns #GST_RTSP_FILTER_REMOVE, @trans will be removed
141  * from @stream.
142  *
143  * A return value of #GST_RTSP_FILTER_KEEP will leave @trans untouched in
144  * @stream.
145  *
146  * A value of #GST_RTSP_FILTER_REF will add @trans to the result #GList of
147  * gst_rtsp_stream_transport_filter().
148  *
149  * Returns: a #GstRTSPFilterResult.
150  */
151 typedef GstRTSPFilterResult (*GstRTSPStreamTransportFilterFunc) (GstRTSPStream *stream,
152                                                                  GstRTSPStreamTransport *trans,
153                                                                  gpointer user_data);
154
155 GList *                gst_rtsp_stream_transport_filter  (GstRTSPStream *stream,
156                                                           GstRTSPStreamTransportFilterFunc func,
157                                                           gpointer user_data);
158
159
160 G_END_DECLS
161
162 #endif /* __GST_RTSP_STREAM_H__ */