• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.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  * Unless otherwise indicated, Source Code is licensed under MIT license.
21  * See further explanation attached in License Statement (distributed in the file
22  * LICENSE).
23  *
24  * Permission is hereby granted, free of charge, to any person obtaining a copy of
25  * this software and associated documentation files (the "Software"), to deal in
26  * the Software without restriction, including without limitation the rights to
27  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
28  * of the Software, and to permit persons to whom the Software is furnished to do
29  * so, subject to the following conditions:
30  *
31  * The above copyright notice and this permission notice shall be included in all
32  * copies or substantial portions of the Software.
33  *
34  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40  * SOFTWARE.
41  */
42 
43 #ifndef __GST_RTSP_TRANSPORT_H__
44 #define __GST_RTSP_TRANSPORT_H__
45 
46 #include <gst/gstconfig.h>
47 #include <gst/rtsp/gstrtspdefs.h>
48 #include <gst/rtsp/gstrtsp-enumtypes.h>
49 
50 G_BEGIN_DECLS
51 
52 /**
53  * GstRTSPTransMode:
54  * @GST_RTSP_TRANS_UNKNOWN: invalid tansport mode
55  * @GST_RTSP_TRANS_RTP: transfer RTP data
56  * @GST_RTSP_TRANS_RDT: transfer RDT (RealMedia) data
57  *
58  * The transfer mode to use.
59  */
60 typedef enum {
61   GST_RTSP_TRANS_UNKNOWN =  0,
62   GST_RTSP_TRANS_RTP     = (1 << 0),
63   GST_RTSP_TRANS_RDT     = (1 << 1)
64 } GstRTSPTransMode;
65 
66 /**
67  * GstRTSPProfile:
68  * @GST_RTSP_PROFILE_UNKNOWN: invalid profile
69  * @GST_RTSP_PROFILE_AVP: the Audio/Visual profile (RFC 3551)
70  * @GST_RTSP_PROFILE_SAVP: the secure Audio/Visual profile (RFC 3711)
71  * @GST_RTSP_PROFILE_AVPF: the Audio/Visual profile with feedback (RFC 4585)
72  * @GST_RTSP_PROFILE_SAVPF: the secure Audio/Visual profile with feedback (RFC 5124)
73  *
74  * The transfer profile to use.
75  */
76 /* FIXME 2.0: This should probably be an enum, not flags and maybe be replaced
77  * by GstRTPTransport */
78 typedef enum {
79   GST_RTSP_PROFILE_UNKNOWN =  0,
80   GST_RTSP_PROFILE_AVP     = (1 << 0),
81   GST_RTSP_PROFILE_SAVP    = (1 << 1),
82   GST_RTSP_PROFILE_AVPF    = (1 << 2),
83   GST_RTSP_PROFILE_SAVPF   = (1 << 3),
84 } GstRTSPProfile;
85 
86 /**
87  * GstRTSPLowerTrans:
88  * @GST_RTSP_LOWER_TRANS_UNKNOWN: invalid transport flag
89  * @GST_RTSP_LOWER_TRANS_UDP: stream data over UDP
90  * @GST_RTSP_LOWER_TRANS_UDP_MCAST: stream data over UDP multicast
91  * @GST_RTSP_LOWER_TRANS_TCP: stream data over TCP
92  * @GST_RTSP_LOWER_TRANS_HTTP: stream data tunneled over HTTP.
93  * @GST_RTSP_LOWER_TRANS_TLS: encrypt TCP and HTTP with TLS
94  *
95  * The different transport methods.
96  */
97 typedef enum {
98   GST_RTSP_LOWER_TRANS_UNKNOWN   = 0,
99   GST_RTSP_LOWER_TRANS_UDP       = (1 << 0),
100   GST_RTSP_LOWER_TRANS_UDP_MCAST = (1 << 1),
101   GST_RTSP_LOWER_TRANS_TCP       = (1 << 2),
102   GST_RTSP_LOWER_TRANS_HTTP      = (1 << 4),
103   GST_RTSP_LOWER_TRANS_TLS       = (1 << 5)
104 } GstRTSPLowerTrans;
105 
106 typedef struct _GstRTSPRange GstRTSPRange;
107 typedef struct _GstRTSPTransport GstRTSPTransport;
108 
109 /**
110  * GstRTSPRange:
111  * @min: minimum value of the range
112  * @max: maximum value of the range
113  *
114  * A type to specify a range.
115  */
116 
117 struct _GstRTSPRange {
118   gint min;
119   gint max;
120 };
121 
122 /**
123  * GstRTSPTransport:
124  * @trans: the transport mode
125  * @profile: the tansport profile
126  * @lower_transport: the lower transport
127  * @destination: the destination ip/hostname
128  * @source: the source ip/hostname
129  * @layers: the number of layers
130  * @mode_play: if play mode was selected
131  * @mode_record: if record mode was selected
132  * @append: is append mode was selected
133  * @interleaved: the interleave range
134  * @ttl: the time to live for multicast UDP
135  * @port: the port pair for multicast sessions
136  * @client_port: the client port pair for receiving data. For TCP
137  *   based transports, applications can use this field to store the
138  *   sender and receiver ports of the client.
139  * @server_port: the server port pair for receiving data. For TCP
140  *   based transports, applications can use this field to store the
141  *   sender and receiver ports of the server.
142  * @ssrc: the ssrc that the sender/receiver will use
143  *
144  * A structure holding the RTSP transport values.
145  */
146 
147 struct _GstRTSPTransport {
148   GstRTSPTransMode  trans;
149   GstRTSPProfile    profile;
150   GstRTSPLowerTrans lower_transport;
151 
152   gchar         *destination;
153   gchar         *source;
154   guint          layers;
155   gboolean       mode_play;
156   gboolean       mode_record;
157   gboolean       append;
158   GstRTSPRange   interleaved;
159 
160   /* multicast specific */
161   guint  ttl;
162   GstRTSPRange   port;
163 
164   /* UDP/TCP specific */
165   GstRTSPRange   client_port;
166   GstRTSPRange   server_port;
167   /* RTP specific */
168   guint          ssrc;
169 
170   /*< private >*/
171   gpointer _gst_reserved[GST_PADDING];
172 };
173 
174 GST_RTSP_API
175 GstRTSPResult      gst_rtsp_transport_new          (GstRTSPTransport **transport);
176 
177 GST_RTSP_API
178 GstRTSPResult      gst_rtsp_transport_init         (GstRTSPTransport *transport);
179 
180 GST_RTSP_API
181 GstRTSPResult      gst_rtsp_transport_parse        (const gchar *str, GstRTSPTransport *transport);
182 
183 GST_RTSP_API
184 gchar*             gst_rtsp_transport_as_text      (GstRTSPTransport *transport);
185 
186 GST_RTSP_DEPRECATED_FOR(gst_rtsp_transport_get_media_type)
187 GstRTSPResult      gst_rtsp_transport_get_mime     (GstRTSPTransMode trans, const gchar **mime);
188 
189 GST_RTSP_API
190 GstRTSPResult      gst_rtsp_transport_get_manager  (GstRTSPTransMode trans, const gchar **manager, guint option);
191 
192 GST_RTSP_API
193 GstRTSPResult      gst_rtsp_transport_get_media_type (GstRTSPTransport *transport,
194                                                       const gchar **media_type);
195 
196 GST_RTSP_API
197 GstRTSPResult      gst_rtsp_transport_free         (GstRTSPTransport *transport);
198 
199 G_END_DECLS
200 
201 #endif /* __GST_RTSP_TRANSPORT_H__ */
202