You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	Merge commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d'
This commit also disables the async fate test, because it used internal APIs in a non-kosher way, which no longer exists. * commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d': lavf: reorganize URLProtocols Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This commit is contained in:
		
							
								
								
									
										10
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								configure
									
									
									
									
										vendored
									
									
								
							| @@ -3138,9 +3138,17 @@ MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c) | ||||
| DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c) | ||||
| OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c) | ||||
| INDEV_LIST=$(find_things    indev    _IN      libavdevice/alldevices.c) | ||||
| PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c) | ||||
| FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c) | ||||
|  | ||||
| find_things_extern(){ | ||||
|     thing=$1 | ||||
|     pattern=$2 | ||||
|     file=$source_path/$3 | ||||
|     sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file" | ||||
| } | ||||
|  | ||||
| PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c) | ||||
|  | ||||
| ALL_COMPONENTS=" | ||||
|     $BSF_LIST | ||||
|     $DECODER_LIST | ||||
|   | ||||
| @@ -19,6 +19,7 @@ OBJS = allformats.o         \ | ||||
|        options.o            \ | ||||
|        os_support.o         \ | ||||
|        qtpalette.o          \ | ||||
|        protocols.o          \ | ||||
|        riff.o               \ | ||||
|        sdp.o                \ | ||||
|        url.o                \ | ||||
|   | ||||
| @@ -41,13 +41,6 @@ | ||||
|  | ||||
| #define REGISTER_MUXDEMUX(X, x) REGISTER_MUXER(X, x); REGISTER_DEMUXER(X, x) | ||||
|  | ||||
| #define REGISTER_PROTOCOL(X, x)                                         \ | ||||
|     {                                                                   \ | ||||
|         extern URLProtocol ff_##x##_protocol;                           \ | ||||
|         if (CONFIG_##X##_PROTOCOL)                                      \ | ||||
|             ffurl_register_protocol(&ff_##x##_protocol);                \ | ||||
|     } | ||||
|  | ||||
| void av_register_all(void) | ||||
| { | ||||
|     static int initialized; | ||||
| @@ -367,57 +360,9 @@ void av_register_all(void) | ||||
|     REGISTER_DEMUXER (IMAGE_TIFF_PIPE,       image_tiff_pipe); | ||||
|     REGISTER_DEMUXER (IMAGE_WEBP_PIPE,       image_webp_pipe); | ||||
|  | ||||
|  | ||||
|     /* protocols */ | ||||
|     REGISTER_PROTOCOL(ASYNC,            async); | ||||
|     REGISTER_PROTOCOL(BLURAY,           bluray); | ||||
|     REGISTER_PROTOCOL(CACHE,            cache); | ||||
|     REGISTER_PROTOCOL(CONCAT,           concat); | ||||
|     REGISTER_PROTOCOL(CRYPTO,           crypto); | ||||
|     REGISTER_PROTOCOL(DATA,             data); | ||||
|     REGISTER_PROTOCOL(FFRTMPCRYPT,      ffrtmpcrypt); | ||||
|     REGISTER_PROTOCOL(FFRTMPHTTP,       ffrtmphttp); | ||||
|     REGISTER_PROTOCOL(FILE,             file); | ||||
|     REGISTER_PROTOCOL(FTP,              ftp); | ||||
|     REGISTER_PROTOCOL(GOPHER,           gopher); | ||||
|     REGISTER_PROTOCOL(HLS,              hls); | ||||
|     REGISTER_PROTOCOL(HTTP,             http); | ||||
|     REGISTER_PROTOCOL(HTTPPROXY,        httpproxy); | ||||
|     REGISTER_PROTOCOL(HTTPS,            https); | ||||
|     REGISTER_PROTOCOL(ICECAST,          icecast); | ||||
|     REGISTER_PROTOCOL(MMSH,             mmsh); | ||||
|     REGISTER_PROTOCOL(MMST,             mmst); | ||||
|     REGISTER_PROTOCOL(MD5,              md5); | ||||
|     REGISTER_PROTOCOL(PIPE,             pipe); | ||||
|     REGISTER_PROTOCOL(RTMP,             rtmp); | ||||
|     REGISTER_PROTOCOL(RTMPE,            rtmpe); | ||||
|     REGISTER_PROTOCOL(RTMPS,            rtmps); | ||||
|     REGISTER_PROTOCOL(RTMPT,            rtmpt); | ||||
|     REGISTER_PROTOCOL(RTMPTE,           rtmpte); | ||||
|     REGISTER_PROTOCOL(RTMPTS,           rtmpts); | ||||
|     REGISTER_PROTOCOL(RTP,              rtp); | ||||
|     REGISTER_PROTOCOL(SCTP,             sctp); | ||||
|     REGISTER_PROTOCOL(SRTP,             srtp); | ||||
|     REGISTER_PROTOCOL(SUBFILE,          subfile); | ||||
|     REGISTER_PROTOCOL(TCP,              tcp); | ||||
|     REGISTER_PROTOCOL(TLS_SCHANNEL,     tls_schannel); | ||||
|     REGISTER_PROTOCOL(TLS_SECURETRANSPORT, tls_securetransport); | ||||
|     REGISTER_PROTOCOL(TLS_GNUTLS,       tls_gnutls); | ||||
|     REGISTER_PROTOCOL(TLS_OPENSSL,      tls_openssl); | ||||
|     REGISTER_PROTOCOL(UDP,              udp); | ||||
|     REGISTER_PROTOCOL(UDPLITE,          udplite); | ||||
|     REGISTER_PROTOCOL(UNIX,             unix); | ||||
|  | ||||
|     /* external libraries */ | ||||
|     REGISTER_MUXER   (CHROMAPRINT,      chromaprint); | ||||
|     REGISTER_DEMUXER (LIBGME,           libgme); | ||||
|     REGISTER_DEMUXER (LIBMODPLUG,       libmodplug); | ||||
|     REGISTER_MUXDEMUX(LIBNUT,           libnut); | ||||
|     REGISTER_PROTOCOL(LIBRTMP,          librtmp); | ||||
|     REGISTER_PROTOCOL(LIBRTMPE,         librtmpe); | ||||
|     REGISTER_PROTOCOL(LIBRTMPS,         librtmps); | ||||
|     REGISTER_PROTOCOL(LIBRTMPT,         librtmpt); | ||||
|     REGISTER_PROTOCOL(LIBRTMPTE,        librtmpte); | ||||
|     REGISTER_PROTOCOL(LIBSSH,           libssh); | ||||
|     REGISTER_PROTOCOL(LIBSMBCLIENT,     libsmbclient); | ||||
| } | ||||
|   | ||||
| @@ -479,7 +479,7 @@ static const AVClass async_context_class = { | ||||
|     .version    = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_async_protocol = { | ||||
| const URLProtocol ff_async_protocol = { | ||||
|     .name                = "async", | ||||
|     .url_open2           = async_open, | ||||
|     .url_read            = async_read, | ||||
| @@ -489,7 +489,7 @@ URLProtocol ff_async_protocol = { | ||||
|     .priv_data_class     = &async_context_class, | ||||
| }; | ||||
|  | ||||
| #ifdef TEST | ||||
| #if 0 | ||||
|  | ||||
| #define TEST_SEEK_POS    (1536) | ||||
| #define TEST_STREAM_SIZE (2048) | ||||
| @@ -581,7 +581,7 @@ static const AVClass async_test_context_class = { | ||||
|     .version    = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_async_test_protocol = { | ||||
| const URLProtocol ff_async_test_protocol = { | ||||
|     .name                = "async-test", | ||||
|     .url_open2           = async_test_open, | ||||
|     .url_read            = async_test_read, | ||||
|   | ||||
| @@ -31,13 +31,6 @@ | ||||
| #endif | ||||
| #include "url.h" | ||||
|  | ||||
| static URLProtocol *first_protocol = NULL; | ||||
|  | ||||
| URLProtocol *ffurl_protocol_next(const URLProtocol *prev) | ||||
| { | ||||
|     return prev ? prev->next : first_protocol; | ||||
| } | ||||
|  | ||||
| /** @name Logging context. */ | ||||
| /*@{*/ | ||||
| static const char *urlcontext_to_name(void *ptr) | ||||
| @@ -59,17 +52,20 @@ static void *urlcontext_child_next(void *obj, void *prev) | ||||
|  | ||||
| static const AVClass *urlcontext_child_class_next(const AVClass *prev) | ||||
| { | ||||
|     URLProtocol *p = NULL; | ||||
|     int i; | ||||
|  | ||||
|     /* find the protocol that corresponds to prev */ | ||||
|     while (prev && (p = ffurl_protocol_next(p))) | ||||
|         if (p->priv_data_class == prev) | ||||
|     for (i = 0; ff_url_protocols[i]; i++) { | ||||
|         if (ff_url_protocols[i]->priv_data_class == prev) { | ||||
|             i++; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* find next protocol with priv options */ | ||||
|     while (p = ffurl_protocol_next(p)) | ||||
|         if (p->priv_data_class) | ||||
|             return p->priv_data_class; | ||||
|     for (; ff_url_protocols[i]; i++) | ||||
|         if (ff_url_protocols[i]->priv_data_class) | ||||
|             return ff_url_protocols[i]->priv_data_class; | ||||
|     return NULL; | ||||
| } | ||||
|  | ||||
| @@ -92,27 +88,20 @@ const AVClass ffurl_context_class = { | ||||
|  | ||||
| const char *avio_enum_protocols(void **opaque, int output) | ||||
| { | ||||
|     URLProtocol *p; | ||||
|     *opaque = ffurl_protocol_next(*opaque); | ||||
|     if (!(p = *opaque)) | ||||
|     const URLProtocol **p = *opaque; | ||||
|  | ||||
|     p = p ? p + 1 : ff_url_protocols; | ||||
|     *opaque = p; | ||||
|     if (!*p) { | ||||
|         *opaque = NULL; | ||||
|         return NULL; | ||||
|     if ((output && p->url_write) || (!output && p->url_read)) | ||||
|         return p->name; | ||||
|     } | ||||
|     if ((output && (*p)->url_write) || (!output && (*p)->url_read)) | ||||
|         return (*p)->name; | ||||
|     return avio_enum_protocols(opaque, output); | ||||
| } | ||||
|  | ||||
| int ffurl_register_protocol(URLProtocol *protocol) | ||||
| { | ||||
|     URLProtocol **p; | ||||
|     p = &first_protocol; | ||||
|     while (*p) | ||||
|         p = &(*p)->next; | ||||
|     *p             = protocol; | ||||
|     protocol->next = NULL; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static int url_alloc_for_protocol(URLContext **puc, struct URLProtocol *up, | ||||
| static int url_alloc_for_protocol(URLContext **puc, const URLProtocol *up, | ||||
|                                   const char *filename, int flags, | ||||
|                                   const AVIOInterruptCB *int_cb) | ||||
| { | ||||
| @@ -280,11 +269,12 @@ int ffurl_handshake(URLContext *c) | ||||
|     "ABCDEFGHIJKLMNOPQRSTUVWXYZ"                \ | ||||
|     "0123456789+-." | ||||
|  | ||||
| static struct URLProtocol *url_find_protocol(const char *filename) | ||||
| static const struct URLProtocol *url_find_protocol(const char *filename) | ||||
| { | ||||
|     URLProtocol *up = NULL; | ||||
|     const URLProtocol *up; | ||||
|     char proto_str[128], proto_nested[128], *ptr; | ||||
|     size_t proto_len = strspn(filename, URL_SCHEME_CHARS); | ||||
|     int i; | ||||
|  | ||||
|     if (filename[proto_len] != ':' && | ||||
|         (strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) || | ||||
| @@ -300,7 +290,8 @@ static struct URLProtocol *url_find_protocol(const char *filename) | ||||
|     if ((ptr = strchr(proto_nested, '+'))) | ||||
|         *ptr = '\0'; | ||||
|  | ||||
|     while (up = ffurl_protocol_next(up)) { | ||||
|     for (i = 0; ff_url_protocols[i]; i++) { | ||||
|         up = ff_url_protocols[i]; | ||||
|         if (!strcmp(proto_str, up->name)) | ||||
|             break; | ||||
|         if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && | ||||
| @@ -314,12 +305,7 @@ static struct URLProtocol *url_find_protocol(const char *filename) | ||||
| int ffurl_alloc(URLContext **puc, const char *filename, int flags, | ||||
|                 const AVIOInterruptCB *int_cb) | ||||
| { | ||||
|     URLProtocol *p = NULL; | ||||
|  | ||||
|     if (!first_protocol) { | ||||
|         av_log(NULL, AV_LOG_WARNING, "No URL Protocols are registered. " | ||||
|                                      "Missing call to av_register_all()?\n"); | ||||
|     } | ||||
|     const URLProtocol *p = NULL; | ||||
|  | ||||
|     p = url_find_protocol(filename); | ||||
|     if (p) | ||||
| @@ -484,7 +470,7 @@ int ffurl_close(URLContext *h) | ||||
|  | ||||
| const char *avio_find_protocol_name(const char *url) | ||||
| { | ||||
|     URLProtocol *p = url_find_protocol(url); | ||||
|     const URLProtocol *p = url_find_protocol(url); | ||||
|  | ||||
|     return p ? p->name : NULL; | ||||
| } | ||||
|   | ||||
| @@ -224,7 +224,7 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) | ||||
| } | ||||
|  | ||||
|  | ||||
| URLProtocol ff_bluray_protocol = { | ||||
| const URLProtocol ff_bluray_protocol = { | ||||
|     .name            = "bluray", | ||||
|     .url_close       = bluray_close, | ||||
|     .url_open        = bluray_open, | ||||
|   | ||||
| @@ -312,7 +312,7 @@ static const AVClass cache_context_class = { | ||||
|     .version    = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_cache_protocol = { | ||||
| const URLProtocol ff_cache_protocol = { | ||||
|     .name                = "cache", | ||||
|     .url_open2           = cache_open, | ||||
|     .url_read            = cache_read, | ||||
|   | ||||
| @@ -186,7 +186,7 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence) | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_concat_protocol = { | ||||
| const URLProtocol ff_concat_protocol = { | ||||
|     .name           = "concat", | ||||
|     .url_open       = concat_open, | ||||
|     .url_read       = concat_read, | ||||
|   | ||||
| @@ -284,7 +284,7 @@ static int crypto_close(URLContext *h) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_crypto_protocol = { | ||||
| const URLProtocol ff_crypto_protocol = { | ||||
|     .name            = "crypto", | ||||
|     .url_open2       = crypto_open2, | ||||
|     .url_read        = crypto_read, | ||||
|   | ||||
| @@ -109,7 +109,7 @@ static int data_read(URLContext *h, unsigned char *buf, int size) | ||||
|     return size; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_data_protocol = { | ||||
| const URLProtocol ff_data_protocol = { | ||||
|     .name           = "data", | ||||
|     .url_open       = data_open, | ||||
|     .url_close      = data_close, | ||||
|   | ||||
| @@ -329,7 +329,7 @@ static int file_close_dir(URLContext *h) | ||||
| #endif /* HAVE_LSTAT */ | ||||
| } | ||||
|  | ||||
| URLProtocol ff_file_protocol = { | ||||
| const URLProtocol ff_file_protocol = { | ||||
|     .name                = "file", | ||||
|     .url_open            = file_open, | ||||
|     .url_read            = file_read, | ||||
| @@ -375,7 +375,7 @@ static int pipe_open(URLContext *h, const char *filename, int flags) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_pipe_protocol = { | ||||
| const URLProtocol ff_pipe_protocol = { | ||||
|     .name                = "pipe", | ||||
|     .url_open            = pipe_open, | ||||
|     .url_read            = file_read, | ||||
|   | ||||
| @@ -1099,7 +1099,7 @@ cleanup: | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_ftp_protocol = { | ||||
| const URLProtocol ff_ftp_protocol = { | ||||
|     .name                = "ftp", | ||||
|     .url_open            = ftp_open, | ||||
|     .url_read            = ftp_read, | ||||
|   | ||||
| @@ -114,7 +114,7 @@ static int gopher_read(URLContext *h, uint8_t *buf, int size) | ||||
| } | ||||
|  | ||||
|  | ||||
| URLProtocol ff_gopher_protocol = { | ||||
| const URLProtocol ff_gopher_protocol = { | ||||
|     .name           = "gopher", | ||||
|     .url_open       = gopher_open, | ||||
|     .url_read       = gopher_read, | ||||
|   | ||||
| @@ -318,7 +318,7 @@ retry: | ||||
|     goto start; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_hls_protocol = { | ||||
| const URLProtocol ff_hls_protocol = { | ||||
|     .name           = "hls", | ||||
|     .url_open       = hls_open, | ||||
|     .url_read       = hls_read, | ||||
|   | ||||
| @@ -1508,7 +1508,7 @@ static const AVClass flavor ## _context_class = {   \ | ||||
| #if CONFIG_HTTP_PROTOCOL | ||||
| HTTP_CLASS(http); | ||||
|  | ||||
| URLProtocol ff_http_protocol = { | ||||
| const URLProtocol ff_http_protocol = { | ||||
|     .name                = "http", | ||||
|     .url_open2           = http_open, | ||||
|     .url_accept          = http_accept, | ||||
| @@ -1529,7 +1529,7 @@ URLProtocol ff_http_protocol = { | ||||
| #if CONFIG_HTTPS_PROTOCOL | ||||
| HTTP_CLASS(https); | ||||
|  | ||||
| URLProtocol ff_https_protocol = { | ||||
| const URLProtocol ff_https_protocol = { | ||||
|     .name                = "https", | ||||
|     .url_open2           = http_open, | ||||
|     .url_read            = http_read, | ||||
| @@ -1644,7 +1644,7 @@ static int http_proxy_write(URLContext *h, const uint8_t *buf, int size) | ||||
|     return ffurl_write(s->hd, buf, size); | ||||
| } | ||||
|  | ||||
| URLProtocol ff_httpproxy_protocol = { | ||||
| const URLProtocol ff_httpproxy_protocol = { | ||||
|     .name                = "httpproxy", | ||||
|     .url_open            = http_proxy_open, | ||||
|     .url_read            = http_buf_read, | ||||
|   | ||||
| @@ -209,7 +209,7 @@ static const AVClass icecast_context_class = { | ||||
|     .version        = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_icecast_protocol = { | ||||
| const URLProtocol ff_icecast_protocol = { | ||||
|     .name            = "icecast", | ||||
|     .url_open        = icecast_open, | ||||
|     .url_write       = icecast_write, | ||||
|   | ||||
| @@ -337,7 +337,7 @@ static const AVClass lib ## flavor ## _class = {\ | ||||
| }; | ||||
|  | ||||
| RTMP_CLASS(rtmp) | ||||
| URLProtocol ff_librtmp_protocol = { | ||||
| const URLProtocol ff_librtmp_protocol = { | ||||
|     .name                = "rtmp", | ||||
|     .url_open            = rtmp_open, | ||||
|     .url_read            = rtmp_read, | ||||
| @@ -352,7 +352,7 @@ URLProtocol ff_librtmp_protocol = { | ||||
| }; | ||||
|  | ||||
| RTMP_CLASS(rtmpt) | ||||
| URLProtocol ff_librtmpt_protocol = { | ||||
| const URLProtocol ff_librtmpt_protocol = { | ||||
|     .name                = "rtmpt", | ||||
|     .url_open            = rtmp_open, | ||||
|     .url_read            = rtmp_read, | ||||
| @@ -367,7 +367,7 @@ URLProtocol ff_librtmpt_protocol = { | ||||
| }; | ||||
|  | ||||
| RTMP_CLASS(rtmpe) | ||||
| URLProtocol ff_librtmpe_protocol = { | ||||
| const URLProtocol ff_librtmpe_protocol = { | ||||
|     .name                = "rtmpe", | ||||
|     .url_open            = rtmp_open, | ||||
|     .url_read            = rtmp_read, | ||||
| @@ -382,7 +382,7 @@ URLProtocol ff_librtmpe_protocol = { | ||||
| }; | ||||
|  | ||||
| RTMP_CLASS(rtmpte) | ||||
| URLProtocol ff_librtmpte_protocol = { | ||||
| const URLProtocol ff_librtmpte_protocol = { | ||||
|     .name                = "rtmpte", | ||||
|     .url_open            = rtmp_open, | ||||
|     .url_read            = rtmp_read, | ||||
| @@ -397,7 +397,7 @@ URLProtocol ff_librtmpte_protocol = { | ||||
| }; | ||||
|  | ||||
| RTMP_CLASS(rtmps) | ||||
| URLProtocol ff_librtmps_protocol = { | ||||
| const URLProtocol ff_librtmps_protocol = { | ||||
|     .name                = "rtmps", | ||||
|     .url_open            = rtmp_open, | ||||
|     .url_read            = rtmp_read, | ||||
|   | ||||
| @@ -365,7 +365,7 @@ static const AVClass libsmbclient_context_class = { | ||||
|     .version        = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_libsmbclient_protocol = { | ||||
| const URLProtocol ff_libsmbclient_protocol = { | ||||
|     .name                = "smb", | ||||
|     .url_open            = libsmbc_open, | ||||
|     .url_read            = libsmbc_read, | ||||
|   | ||||
| @@ -489,7 +489,7 @@ static const AVClass libssh_context_class = { | ||||
|     .version        = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_libssh_protocol = { | ||||
| const URLProtocol ff_libssh_protocol = { | ||||
|     .name                = "sftp", | ||||
|     .url_open            = libssh_open, | ||||
|     .url_read            = libssh_read, | ||||
|   | ||||
| @@ -87,7 +87,7 @@ static int md5_close(URLContext *h) | ||||
| } | ||||
|  | ||||
|  | ||||
| URLProtocol ff_md5_protocol = { | ||||
| const URLProtocol ff_md5_protocol = { | ||||
|     .name                = "md5", | ||||
|     .url_open            = md5_open, | ||||
|     .url_write           = md5_write, | ||||
|   | ||||
| @@ -401,7 +401,7 @@ static int64_t mmsh_seek(URLContext *h, int64_t pos, int whence) | ||||
|     return AVERROR(ENOSYS); | ||||
| } | ||||
|  | ||||
| URLProtocol ff_mmsh_protocol = { | ||||
| const URLProtocol ff_mmsh_protocol = { | ||||
|     .name           = "mmsh", | ||||
|     .url_open       = mmsh_open, | ||||
|     .url_read       = mmsh_read, | ||||
|   | ||||
| @@ -629,7 +629,7 @@ static int mms_read(URLContext *h, uint8_t *buf, int size) | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_mmst_protocol = { | ||||
| const URLProtocol ff_mmst_protocol = { | ||||
|     .name           = "mmst", | ||||
|     .url_open       = mms_open, | ||||
|     .url_read       = mms_read, | ||||
|   | ||||
							
								
								
									
										208
									
								
								libavformat/protocols.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										208
									
								
								libavformat/protocols.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,208 @@ | ||||
| /* | ||||
|  * 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 "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; | ||||
|  | ||||
| const URLProtocol *ff_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, | ||||
| }; | ||||
| @@ -325,7 +325,7 @@ static const AVClass ffrtmpcrypt_class = { | ||||
|     .version    = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_ffrtmpcrypt_protocol = { | ||||
| const URLProtocol ff_ffrtmpcrypt_protocol = { | ||||
|     .name            = "ffrtmpcrypt", | ||||
|     .url_open        = rtmpe_open, | ||||
|     .url_read        = rtmpe_read, | ||||
|   | ||||
| @@ -265,7 +265,7 @@ static const AVClass ffrtmphttp_class = { | ||||
|     .version    = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_ffrtmphttp_protocol = { | ||||
| const URLProtocol ff_ffrtmphttp_protocol = { | ||||
|     .name           = "ffrtmphttp", | ||||
|     .url_open       = rtmp_http_open, | ||||
|     .url_read       = rtmp_http_read, | ||||
|   | ||||
| @@ -3110,7 +3110,7 @@ static const AVClass flavor##_class = {          \ | ||||
|     .version    = LIBAVUTIL_VERSION_INT,         \ | ||||
| };                                               \ | ||||
|                                                  \ | ||||
| URLProtocol ff_##flavor##_protocol = {           \ | ||||
| const URLProtocol ff_##flavor##_protocol = {     \ | ||||
|     .name           = #flavor,                   \ | ||||
|     .url_open       = rtmp_open,                 \ | ||||
|     .url_read       = rtmp_read,                 \ | ||||
|   | ||||
| @@ -605,7 +605,7 @@ static int rtp_get_multi_file_handle(URLContext *h, int **handles, | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_rtp_protocol = { | ||||
| const URLProtocol ff_rtp_protocol = { | ||||
|     .name                      = "rtp", | ||||
|     .url_open                  = rtp_open, | ||||
|     .url_read                  = rtp_read, | ||||
|   | ||||
| @@ -359,7 +359,7 @@ static int sctp_get_file_handle(URLContext *h) | ||||
|     return s->fd; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_sctp_protocol = { | ||||
| const URLProtocol ff_sctp_protocol = { | ||||
|     .name                = "sctp", | ||||
|     .url_open            = sctp_open, | ||||
|     .url_read            = sctp_read, | ||||
|   | ||||
| @@ -132,7 +132,7 @@ static int srtp_get_multi_file_handle(URLContext *h, int **handles, | ||||
|     return ffurl_get_multi_file_handle(s->rtp_hd, handles, numhandles); | ||||
| } | ||||
|  | ||||
| URLProtocol ff_srtp_protocol = { | ||||
| const URLProtocol ff_srtp_protocol = { | ||||
|     .name                      = "srtp", | ||||
|     .url_open                  = srtp_open, | ||||
|     .url_read                  = srtp_read, | ||||
|   | ||||
| @@ -137,7 +137,7 @@ static int64_t subfile_seek(URLContext *h, int64_t pos, int whence) | ||||
|     return c->pos - c->start; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_subfile_protocol = { | ||||
| const URLProtocol ff_subfile_protocol = { | ||||
|     .name                = "subfile", | ||||
|     .url_open2           = subfile_open, | ||||
|     .url_read            = subfile_read, | ||||
|   | ||||
| @@ -255,7 +255,7 @@ static int tcp_get_file_handle(URLContext *h) | ||||
|     return s->fd; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_tcp_protocol = { | ||||
| const URLProtocol ff_tcp_protocol = { | ||||
|     .name                = "tcp", | ||||
|     .url_open            = tcp_open, | ||||
|     .url_accept          = tcp_accept, | ||||
|   | ||||
| @@ -247,7 +247,7 @@ static const AVClass tls_class = { | ||||
|     .version    = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_tls_gnutls_protocol = { | ||||
| const URLProtocol ff_tls_gnutls_protocol = { | ||||
|     .name           = "tls", | ||||
|     .url_open2      = tls_open, | ||||
|     .url_read       = tls_read, | ||||
|   | ||||
| @@ -295,7 +295,7 @@ static const AVClass tls_class = { | ||||
|     .version    = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_tls_openssl_protocol = { | ||||
| const URLProtocol ff_tls_openssl_protocol = { | ||||
|     .name           = "tls", | ||||
|     .url_open2      = tls_open, | ||||
|     .url_read       = tls_read, | ||||
|   | ||||
| @@ -589,7 +589,7 @@ static const AVClass tls_class = { | ||||
|     .version    = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_tls_schannel_protocol = { | ||||
| const URLProtocol ff_tls_schannel_protocol = { | ||||
|     .name           = "tls", | ||||
|     .url_open2      = tls_open, | ||||
|     .url_read       = tls_read, | ||||
|   | ||||
| @@ -387,7 +387,7 @@ static const AVClass tls_class = { | ||||
|     .version    = LIBAVUTIL_VERSION_INT, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_tls_securetransport_protocol = { | ||||
| const URLProtocol ff_tls_securetransport_protocol = { | ||||
|     .name           = "tls", | ||||
|     .url_open2      = tls_open, | ||||
|     .url_read       = tls_read, | ||||
|   | ||||
| @@ -983,7 +983,7 @@ static int udp_close(URLContext *h) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_udp_protocol = { | ||||
| const URLProtocol ff_udp_protocol = { | ||||
|     .name                = "udp", | ||||
|     .url_open            = udp_open, | ||||
|     .url_read            = udp_read, | ||||
| @@ -995,7 +995,7 @@ URLProtocol ff_udp_protocol = { | ||||
|     .flags               = URL_PROTOCOL_FLAG_NETWORK, | ||||
| }; | ||||
|  | ||||
| URLProtocol ff_udplite_protocol = { | ||||
| const URLProtocol ff_udplite_protocol = { | ||||
|     .name                = "udplite", | ||||
|     .url_open            = udplite_open, | ||||
|     .url_read            = udp_read, | ||||
|   | ||||
| @@ -140,7 +140,7 @@ static int unix_get_file_handle(URLContext *h) | ||||
|     return s->fd; | ||||
| } | ||||
|  | ||||
| URLProtocol ff_unix_protocol = { | ||||
| const URLProtocol ff_unix_protocol = { | ||||
|     .name                = "unix", | ||||
|     .url_open            = unix_open, | ||||
|     .url_read            = unix_read, | ||||
|   | ||||
| @@ -37,7 +37,7 @@ extern const AVClass ffurl_context_class; | ||||
|  | ||||
| typedef struct URLContext { | ||||
|     const AVClass *av_class;    /**< information for av_log(). Set by url_open(). */ | ||||
|     struct URLProtocol *prot; | ||||
|     const struct URLProtocol *prot; | ||||
|     void *priv_data; | ||||
|     char *filename;             /**< specified URL */ | ||||
|     int flags; | ||||
| @@ -77,7 +77,6 @@ typedef struct URLProtocol { | ||||
|     int     (*url_write)(URLContext *h, const unsigned char *buf, int size); | ||||
|     int64_t (*url_seek)( URLContext *h, int64_t pos, int whence); | ||||
|     int     (*url_close)(URLContext *h); | ||||
|     struct URLProtocol *next; | ||||
|     int (*url_read_pause)(URLContext *h, int pause); | ||||
|     int64_t (*url_read_seek)(URLContext *h, int stream_index, | ||||
|                              int64_t timestamp, int flags); | ||||
| @@ -257,24 +256,12 @@ int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles); | ||||
|  */ | ||||
| int ffurl_shutdown(URLContext *h, int flags); | ||||
|  | ||||
| /** | ||||
|  * Register the URLProtocol protocol. | ||||
|  */ | ||||
| int ffurl_register_protocol(URLProtocol *protocol); | ||||
|  | ||||
| /** | ||||
|  * Check if the user has requested to interrup a blocking function | ||||
|  * associated with cb. | ||||
|  */ | ||||
| int ff_check_interrupt(AVIOInterruptCB *cb); | ||||
|  | ||||
| /** | ||||
|  * Iterate over all available protocols. | ||||
|  * | ||||
|  * @param prev result of the previous call to this functions or NULL. | ||||
|  */ | ||||
| URLProtocol *ffurl_protocol_next(const URLProtocol *prev); | ||||
|  | ||||
| /* udp.c */ | ||||
| int ff_udp_set_remote_url(URLContext *h, const char *uri); | ||||
| int ff_udp_get_local_port(URLContext *h); | ||||
| @@ -322,5 +309,6 @@ void ff_make_absolute_url(char *buf, int size, const char *base, | ||||
|  */ | ||||
| AVIODirEntry *ff_alloc_dir_entry(void); | ||||
|  | ||||
| extern const URLProtocol *ff_url_protocols[]; | ||||
|  | ||||
| #endif /* AVFORMAT_URL_H */ | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| FATE_LIBAVFORMAT-$(HAVE_PTHREADS) += fate-async | ||||
| fate-async: libavformat/async-test$(EXESUF) | ||||
| fate-async: CMD = run libavformat/async-test | ||||
| #FATE_LIBAVFORMAT-$(HAVE_PTHREADS) += fate-async | ||||
| #fate-async: libavformat/async-test$(EXESUF) | ||||
| #fate-async: CMD = run libavformat/async-test | ||||
|  | ||||
| FATE_LIBAVFORMAT-$(CONFIG_NETWORK) += fate-noproxy | ||||
| fate-noproxy: libavformat/noproxy-test$(EXESUF) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user