Update .po files
[platform/upstream/gst-plugins-good.git] / gst / rtsp / gstrtspsrc.h
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  *               <2006> Wim Taymans <wim@fluendo.com>
4  *
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.
9  *
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.
14  *
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.
19  */
20 /*
21  * Unless otherwise indicated, Source Code is licensed under MIT license.
22  * See further explanation attached in License Statement (distributed in the file
23  * LICENSE).
24  *
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:
31  *
32  * The above copyright notice and this permission notice shall be included in all
33  * copies or substantial portions of the Software.
34  *
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
41  * SOFTWARE.
42  */
43
44 #ifndef __GST_RTSPSRC_H__
45 #define __GST_RTSPSRC_H__
46
47 #include <gst/gst.h>
48
49 G_BEGIN_DECLS
50
51 #include <gst/rtsp/rtsp.h>
52 #include <gio/gio.h>
53
54 #include "gstrtspext.h"
55
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) \
67   ((GstRTSPSrc *)(obj))
68
69 typedef struct _GstRTSPSrc GstRTSPSrc;
70 typedef struct _GstRTSPSrcClass GstRTSPSrcClass;
71
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)))
75
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)))
79
80 typedef struct _GstRTSPConnInfo GstRTSPConnInfo;
81
82 struct _GstRTSPConnInfo {
83   gchar              *location;
84   GstRTSPUrl         *url;
85   gchar              *url_str;
86   GstRTSPConnection  *connection;
87   gboolean            connected;
88   gboolean            flushing;
89 };
90
91 typedef struct _GstRTSPStream GstRTSPStream;
92
93 struct _GstRTSPStream {
94   gint          id;
95
96   GstRTSPSrc   *parent; /* parent, no extra ref to parent is taken */
97
98   /* pad we expose or NULL when it does not have an actual pad */
99   GstPad       *srcpad;
100   GstFlowReturn last_ret;
101   gboolean      added;
102   gboolean      setup;
103   gboolean      skipped;
104   gboolean      eos;
105   gboolean      discont;
106
107   /* for interleaved mode */
108   guint8        channel[2];
109   GstPad       *channelpad[2];
110
111   /* our udp sources */
112   GstElement   *udpsrc[2];
113   GstPad       *blockedpad;
114   gulong        blockid;
115   gboolean      is_ipv6;
116
117   /* our udp sinks back to the server */
118   GstElement   *udpsink[2];
119   GstPad       *rtcppad;
120
121   /* fakesrc for sending dummy data */
122   GstElement   *fakesrc;
123
124   /* state */
125   guint         port;
126   gboolean      container;
127   gboolean      is_real;
128   guint8        default_pt;
129   GstRTSPProfile profile;
130   GArray       *ptmap;
131   /* original control url */
132   gchar        *control_url;
133   guint32       ssrc;
134   guint32       seqbase;
135   guint64       timebase;
136   GstElement   *srtpdec;
137   GstCaps      *srtcpparams;
138   GstElement   *srtpenc;
139   guint32       send_ssrc;
140
141   /* per stream connection */
142   GstRTSPConnInfo  conninfo;
143
144   /* session */
145   GObject      *session;
146
147   /* bandwidth */
148   guint         as_bandwidth;
149   guint         rs_bandwidth;
150   guint         rr_bandwidth;
151
152   /* destination */
153   gchar        *destination;
154   gboolean      is_multicast;
155   guint         ttl;
156
157   GstStructure     *rtx_pt_map;
158 };
159
160 /**
161  * GstRTSPNatMethod:
162  * @GST_RTSP_NAT_NONE: none
163  * @GST_RTSP_NAT_DUMMY: send dummy packets
164  *
165  * Different methods for trying to traverse firewalls.
166  */
167 typedef enum
168 {
169   GST_RTSP_NAT_NONE,
170   GST_RTSP_NAT_DUMMY
171 } GstRTSPNatMethod;
172
173 struct _GstRTSPSrc {
174   GstBin           parent;
175
176   /* task and mutex for interleaved mode */
177   gboolean         interleaved;
178   GstTask         *task;
179   GRecMutex        stream_rec_lock;
180   GstSegment       segment;
181   gboolean         running;
182   gboolean         need_range;
183   gboolean         skip;
184   gint             free_channel;
185   gboolean         need_segment;
186   GstClockTime     base_time;
187
188   /* UDP mode loop */
189   gint             pending_cmd;
190   gint             busy_cmd;
191   gboolean         ignore_timeout;
192   gboolean         open_error;
193
194   /* mutex for protecting state changes */
195   GRecMutex        state_rec_lock;
196
197   GstSDPMessage   *sdp;
198   gboolean         from_sdp;
199   GList           *streams;
200   GstStructure    *props;
201   gboolean         need_activate;
202
203   /* properties */
204   GstRTSPLowerTrans protocols;
205   gboolean          debug;
206   guint             retry;
207   guint64           udp_timeout;
208   GTimeVal          tcp_timeout;
209   GTimeVal         *ptcp_timeout;
210   guint             latency;
211   gboolean          drop_on_latency;
212   guint64           connection_speed;
213   GstRTSPNatMethod  nat_method;
214   gboolean          do_rtcp;
215   gboolean          do_rtsp_keep_alive;
216   gchar            *proxy_host;
217   guint             proxy_port;
218   gchar            *proxy_user;        /* from url or property */
219   gchar            *proxy_passwd;      /* from url or property */
220   gchar            *prop_proxy_id;     /* set via property */
221   gchar            *prop_proxy_pw;     /* set via property */
222   guint             rtp_blocksize;
223   gchar            *user_id;
224   gchar            *user_pw;
225   gint              buffer_mode;
226   GstRTSPRange      client_port_range;
227   gint              udp_buffer_size;
228   gboolean          short_header;
229   guint             probation;
230   gboolean          udp_reconnect;
231   gchar            *multi_iface;
232   gboolean          ntp_sync;
233   gboolean          use_pipeline_clock;
234   GstStructure     *sdes;
235   GTlsCertificateFlags tls_validation_flags;
236   GTlsDatabase     *tls_database;
237   GTlsInteraction  *tls_interaction;
238   gboolean          do_retransmission;
239   gint              ntp_time_source;
240   gchar            *user_agent;
241   GstClockTime      max_rtcp_rtp_time_diff;
242
243   /* state */
244   GstRTSPState       state;
245   gchar             *content_base;
246   GstRTSPLowerTrans  cur_protocols;
247   gboolean           tried_url_auth;
248   gchar             *addr;
249   gboolean           need_redirect;
250   GstRTSPTimeRange  *range;
251   gchar             *control;
252   guint              next_port_num;
253   GstClock          *provided_clock;
254
255   /* supported methods */
256   gint               methods;
257
258   gboolean           seekable;
259   GstClockTime       last_pos;
260
261   /* session management */
262   GstElement      *manager;
263   gulong           manager_sig_id;
264   gulong           manager_ptmap_id;
265   gboolean         use_buffering;
266
267   GstRTSPConnInfo  conninfo;
268
269   /* a list of RTSP extensions as GstElement */
270   GstRTSPExtensionList  *extensions;
271 };
272
273 struct _GstRTSPSrcClass {
274   GstBinClass parent_class;
275 };
276
277 GType gst_rtspsrc_get_type(void);
278
279 G_END_DECLS
280
281 #endif /* __GST_RTSPSRC_H__ */