FFmpeg
Loading...
Searching...
No Matches
protocols.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg 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 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include <string.h>
20
21#include "libavutil/avstring.h"
22#include "libavutil/log.h"
23#include "libavutil/mem.h"
24
25#include "url.h"
26
34extern const URLProtocol ff_data_protocol;
35extern const URLProtocol ff_fd_protocol;
38extern const URLProtocol ff_file_protocol;
39extern const URLProtocol ff_ftp_protocol;
42extern const URLProtocol ff_http_protocol;
46extern const URLProtocol ff_mmsh_protocol;
47extern const URLProtocol ff_mmst_protocol;
48extern const URLProtocol ff_md5_protocol;
49extern const URLProtocol ff_pipe_protocol;
51extern const URLProtocol ff_rtmp_protocol;
57extern const URLProtocol ff_rtp_protocol;
59extern const URLProtocol ff_sctp_protocol;
60extern const URLProtocol ff_srtp_protocol;
62extern const URLProtocol ff_tee_protocol;
63extern const URLProtocol ff_tcp_protocol;
64extern const URLProtocol ff_tls_protocol;
65extern const URLProtocol ff_dtls_protocol;
66extern const URLProtocol ff_udp_protocol;
68extern const URLProtocol ff_unix_protocol;
83
84#include "libavformat/protocol_list.c"
85
87{
88 const AVClass *ret = NULL;
89 uintptr_t i;
90
91 for (i = (uintptr_t)*iter; url_protocols[i]; i++) {
92 ret = url_protocols[i]->priv_data_class;
93 if (ret)
94 break;
95 }
96
97 *iter = (void*)(uintptr_t)(url_protocols[i] ? i + 1 : i);
98 return ret;
99}
100
101const char *avio_enum_protocols(void **opaque, int output)
102{
103 uintptr_t i;
104
105 for (i = (uintptr_t)*opaque; url_protocols[i]; i++) {
106 const URLProtocol *p = url_protocols[i];
107 if ((output && p->url_write) || (!output && p->url_read)) {
108 *opaque = (void*)(uintptr_t)(i + 1);
109 return p->name;
110 }
111 }
112 *opaque = NULL;
113 return NULL;
114}
115
117{
118 int i = 0;
119 for (i = 0; url_protocols[i]; i++) {
120 if (!strcmp(url_protocols[i]->name, name))
121 return url_protocols[i]->priv_data_class;
122 }
123 return NULL;
124}
125
126const URLProtocol **ffurl_get_protocols(const char *whitelist,
127 const char *blacklist)
128{
129 const URLProtocol **ret;
130 int i, ret_idx = 0;
131
132 ret = av_calloc(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret));
133 if (!ret)
134 return NULL;
135
136 for (i = 0; url_protocols[i]; i++) {
137 const URLProtocol *up = url_protocols[i];
138
139 if (whitelist && *whitelist && !av_match_name(up->name, whitelist))
140 continue;
141 if (blacklist && *blacklist && av_match_name(up->name, blacklist))
142 continue;
143
144 ret[ret_idx++] = up;
145 }
146
147 return ret;
148}
const URLProtocol ff_async_protocol
Definition async.c:494
const URLProtocol ff_bluray_protocol
Definition bluray.c:227
const URLProtocol ff_cache_protocol
Definition cache.c:338
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define NULL
Definition coverity.c:32
const URLProtocol ff_crypto_protocol
Definition crypto.c:392
const URLProtocol ff_data_protocol
Definition data_uri.c:114
const URLProtocol ff_ftp_protocol
Definition ftp.c:1194
int av_match_name(const char *name, const char *names)
Match instances of a name in a comma-separated list of names.
Definition avstring.c:341
const URLProtocol ff_icecast_protocol
Definition icecast.c:221
const URLProtocol ff_ipfs_gateway_protocol
const URLProtocol ff_ipns_gateway_protocol
const URLProtocol ff_libamqp_protocol
Definition libamqp.c:313
const URLProtocol ff_libcurl_protocol
Definition libcurl.c:1214
const URLProtocol ff_librist_protocol
Definition librist.c:260
const URLProtocol ff_librtmpe_protocol
Definition librtmp.c:325
const URLProtocol ff_librtmpt_protocol
Definition librtmp.c:310
const URLProtocol ff_librtmpte_protocol
Definition librtmp.c:340
const URLProtocol ff_librtmps_protocol
Definition librtmp.c:355
const URLProtocol ff_librtmp_protocol
Definition librtmp.c:295
const URLProtocol ff_libsmbclient_protocol
const URLProtocol ff_libsrt_protocol
Definition libsrt.c:630
const URLProtocol ff_libssh_protocol
Definition libssh.c:490
const URLProtocol ff_libzmq_protocol
Definition libzmq.c:198
const URLProtocol ff_md5_protocol
Definition md5proto.c:89
void * av_calloc(size_t nmemb, size_t size)
Definition mem.c:264
Memory handling functions.
const URLProtocol ff_mmsh_protocol
Definition mmsh.c:412
const URLProtocol ff_mmst_protocol
Definition mmst.c:632
const URLProtocol ff_prompeg_protocol
Definition prompeg.c:469
const URLProtocol ff_dtls_protocol
Definition tls_gnutls.c:791
const URLProtocol ff_file_protocol
const URLProtocol ff_concatf_protocol
const URLProtocol ff_https_protocol
const URLProtocol ff_subfile_protocol
Definition subfile.c:150
const URLProtocol ff_shared_protocol
Definition shared.c:921
const URLProtocol ff_tls_protocol
Definition tls_gnutls.c:771
const URLProtocol ff_rtmp_protocol
const URLProtocol ** ffurl_get_protocols(const char *whitelist, const char *blacklist)
Construct a list of protocols matching a given whitelist and/or blacklist.
Definition protocols.c:126
const URLProtocol ff_gophers_protocol
const URLProtocol ff_rtp_protocol
Definition rtpproto.c:545
const URLProtocol ff_srtp_protocol
Definition srtpproto.c:132
const URLProtocol ff_udp_protocol
Definition udp.c:1140
const URLProtocol ff_tee_protocol
Definition teeproto.c:139
const URLProtocol ff_http_protocol
const URLProtocol ff_ffrtmphttp_protocol
Definition rtmphttp.c:275
const AVClass * avio_protocol_get_class(const char *name)
Get AVClass by names of available protocols.
Definition protocols.c:116
const URLProtocol ff_unix_protocol
Definition unix.c:162
const AVClass * ff_urlcontext_child_class_iterate(void **iter)
Definition protocols.c:86
const URLProtocol ff_concat_protocol
const URLProtocol ff_sctp_protocol
Definition sctp.c:368
const URLProtocol ff_gopher_protocol
const char * avio_enum_protocols(void **opaque, int output)
Iterate through names of available protocols.
Definition protocols.c:101
const URLProtocol ff_rtmpts_protocol
const URLProtocol ff_android_content_protocol
const URLProtocol ff_pipe_protocol
const URLProtocol ff_ffrtmpcrypt_protocol
Definition rtmpcrypt.c:328
const URLProtocol ff_udplite_protocol
Definition udp.c:1152
const URLProtocol ff_tcp_protocol
Definition tcp.c:348
const URLProtocol ff_fd_protocol
const URLProtocol ff_rtmps_protocol
const URLProtocol ff_rtmpe_protocol
const URLProtocol ff_httpproxy_protocol
const URLProtocol ff_rtmpt_protocol
const URLProtocol ff_rtmpte_protocol
const char * name
Definition qsvenc.c:142
#define FF_ARRAY_ELEMS(a)
Describe the class of an AVClass context structure.
Definition log.h:76
const char * name
Definition url.h:54
unbuffered private I/O API