1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
#include "url.h"
extern const URLProtocol ff_async_protocol;
extern const URLProtocol ff_bluray_protocol;
extern const URLProtocol ff_cache_protocol;
extern const URLProtocol ff_concat_protocol;
extern const URLProtocol ff_crypto_protocol;
extern const URLProtocol ff_data_protocol;
extern const URLProtocol ff_ffrtmpcrypt_protocol;
extern const URLProtocol ff_ffrtmphttp_protocol;
extern const URLProtocol ff_file_protocol;
extern const URLProtocol ff_ftp_protocol;
extern const URLProtocol ff_gopher_protocol;
extern const URLProtocol ff_hls_protocol;
extern const URLProtocol ff_http_protocol;
extern const URLProtocol ff_httpproxy_protocol;
extern const URLProtocol ff_https_protocol;
extern const URLProtocol ff_icecast_protocol;
extern const URLProtocol ff_mmsh_protocol;
extern const URLProtocol ff_mmst_protocol;
extern const URLProtocol ff_md5_protocol;
extern const URLProtocol ff_pipe_protocol;
extern const URLProtocol ff_rtmp_protocol;
extern const URLProtocol ff_rtmpe_protocol;
extern const URLProtocol ff_rtmps_protocol;
extern const URLProtocol ff_rtmpt_protocol;
extern const URLProtocol ff_rtmpte_protocol;
extern const URLProtocol ff_rtmpts_protocol;
extern const URLProtocol ff_rtp_protocol;
extern const URLProtocol ff_sctp_protocol;
extern const URLProtocol ff_srtp_protocol;
extern const URLProtocol ff_subfile_protocol;
extern const URLProtocol ff_tcp_protocol;
extern const URLProtocol ff_tls_gnutls_protocol;
extern const URLProtocol ff_tls_schannel_protocol;
extern const URLProtocol ff_tls_securetransport_protocol;
extern const URLProtocol ff_tls_openssl_protocol;
extern const URLProtocol ff_udp_protocol;
extern const URLProtocol ff_udplite_protocol;
extern const URLProtocol ff_unix_protocol;
extern const URLProtocol ff_librtmp_protocol;
extern const URLProtocol ff_librtmpe_protocol;
extern const URLProtocol ff_librtmps_protocol;
extern const URLProtocol ff_librtmpt_protocol;
extern const URLProtocol ff_librtmpte_protocol;
extern const URLProtocol ff_libssh_protocol;
extern const URLProtocol ff_libsmbclient_protocol;
static const URLProtocol *url_protocols[] = {
#if CONFIG_ASYNC_PROTOCOL
&ff_async_protocol,
#endif
#if CONFIG_BLURAY_PROTOCOL
&ff_bluray_protocol,
#endif
#if CONFIG_CACHE_PROTOCOL
&ff_cache_protocol,
#endif
#if CONFIG_CONCAT_PROTOCOL
&ff_concat_protocol,
#endif
#if CONFIG_CRYPTO_PROTOCOL
&ff_crypto_protocol,
#endif
#if CONFIG_DATA_PROTOCOL
&ff_data_protocol,
#endif
#if CONFIG_FFRTMPCRYPT_PROTOCOL
&ff_ffrtmpcrypt_protocol,
#endif
#if CONFIG_FFRTMPHTTP_PROTOCOL
&ff_ffrtmphttp_protocol,
#endif
#if CONFIG_FILE_PROTOCOL
&ff_file_protocol,
#endif
#if CONFIG_FTP_PROTOCOL
&ff_ftp_protocol,
#endif
#if CONFIG_GOPHER_PROTOCOL
&ff_gopher_protocol,
#endif
#if CONFIG_HLS_PROTOCOL
&ff_hls_protocol,
#endif
#if CONFIG_HTTP_PROTOCOL
&ff_http_protocol,
#endif
#if CONFIG_HTTPPROXY_PROTOCOL
&ff_httpproxy_protocol,
#endif
#if CONFIG_HTTPS_PROTOCOL
&ff_https_protocol,
#endif
#if CONFIG_ICECAST_PROTOCOL
&ff_icecast_protocol,
#endif
#if CONFIG_MMSH_PROTOCOL
&ff_mmsh_protocol,
#endif
#if CONFIG_MMST_PROTOCOL
&ff_mmst_protocol,
#endif
#if CONFIG_MD5_PROTOCOL
&ff_md5_protocol,
#endif
#if CONFIG_PIPE_PROTOCOL
&ff_pipe_protocol,
#endif
#if CONFIG_RTMP_PROTOCOL
&ff_rtmp_protocol,
#endif
#if CONFIG_RTMPE_PROTOCOL
&ff_rtmpe_protocol,
#endif
#if CONFIG_RTMPS_PROTOCOL
&ff_rtmps_protocol,
#endif
#if CONFIG_RTMPT_PROTOCOL
&ff_rtmpt_protocol,
#endif
#if CONFIG_RTMPTE_PROTOCOL
&ff_rtmpte_protocol,
#endif
#if CONFIG_RTMPTS_PROTOCOL
&ff_rtmpts_protocol,
#endif
#if CONFIG_RTP_PROTOCOL
&ff_rtp_protocol,
#endif
#if CONFIG_SCTP_PROTOCOL
&ff_sctp_protocol,
#endif
#if CONFIG_SRTP_PROTOCOL
&ff_srtp_protocol,
#endif
#if CONFIG_SUBFILE_PROTOCOL
&ff_subfile_protocol,
#endif
#if CONFIG_TCP_PROTOCOL
&ff_tcp_protocol,
#endif
#if CONFIG_TLS_GNUTLS_PROTOCOL
&ff_tls_gnutls_protocol,
#endif
#if CONFIG_TLS_SCHANNEL_PROTOCOL
&ff_tls_schannel_protocol,
#endif
#if CONFIG_TLS_SECURETRANSPORT_PROTOCOL
&ff_tls_securetransport_protocol,
#endif
#if CONFIG_TLS_OPENSSL_PROTOCOL
&ff_tls_openssl_protocol,
#endif
#if CONFIG_UDP_PROTOCOL
&ff_udp_protocol,
#endif
#if CONFIG_UDPLITE_PROTOCOL
&ff_udplite_protocol,
#endif
#if CONFIG_UNIX_PROTOCOL
&ff_unix_protocol,
#endif
/* external libraries */
#if CONFIG_LIBRTMP_PROTOCOL
&ff_librtmp_protocol,
#endif
#if CONFIG_LIBRTMPE_PROTOCOL
&ff_librtmpe_protocol,
#endif
#if CONFIG_LIBRTMPS_PROTOCOL
&ff_librtmps_protocol,
#endif
#if CONFIG_LIBRTMPT_PROTOCOL
&ff_librtmpt_protocol,
#endif
#if CONFIG_LIBRTMPTE_PROTOCOL
&ff_librtmpte_protocol,
#endif
#if CONFIG_LIBSSH_PROTOCOL
&ff_libssh_protocol,
#endif
#if CONFIG_LIBSMBCLIENT_PROTOCOL
&ff_libsmbclient_protocol,
#endif
NULL,
};
const AVClass *ff_urlcontext_child_class_next(const AVClass *prev)
{
int i;
/* find the protocol that corresponds to prev */
for (i = 0; prev && url_protocols[i]; i++) {
if (url_protocols[i]->priv_data_class == prev) {
i++;
break;
}
}
/* find next protocol with priv options */
for (; url_protocols[i]; i++)
if (url_protocols[i]->priv_data_class)
return url_protocols[i]->priv_data_class;
return NULL;
}
const char *avio_enum_protocols(void **opaque, int output)
{
const URLProtocol **p = *opaque;
p = p ? p + 1 : url_protocols;
*opaque = p;
if (!*p) {
*opaque = NULL;
return NULL;
}
if ((output && (*p)->url_write) || (!output && (*p)->url_read))
return (*p)->name;
return avio_enum_protocols(opaque, output);
}
const URLProtocol **ffurl_get_protocols(const char *whitelist,
const char *blacklist)
{
const URLProtocol **ret;
int i, ret_idx = 0;
ret = av_mallocz_array(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret));
if (!ret)
return NULL;
for (i = 0; url_protocols[i]; i++) {
const URLProtocol *up = url_protocols[i];
if (whitelist && *whitelist && !av_match_name(up->name, whitelist))
continue;
if (blacklist && *blacklist && av_match_name(up->name, blacklist))
continue;
ret[ret_idx++] = up;
}
return ret;
}
|