int ffurl_alloc(URLContext **puc, const char *filename, int flags) { URLProtocol *up; char proto_str[128], proto_nested[128], *ptr; size_t proto_len = strspn(filename, URL_SCHEME_CHARS); if (filename[proto_len] != ':' || is_dos_path(filename)) strcpy(proto_str, "file"); else av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str))); av_strlcpy(proto_nested, proto_str, sizeof(proto_nested)); if ((ptr = strchr(proto_nested, '+'))) *ptr = '\0'; up = first_protocol; while (up != NULL) { if (!strcmp(proto_str, up->name)) return url_alloc_for_protocol (puc, up, filename, flags); if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && !strcmp(proto_nested, up->name)) return url_alloc_for_protocol (puc, up, filename, flags); up = up->next; } *puc = NULL; return AVERROR(ENOENT); }
int ffurl_alloc(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb) { URLProtocol *up = NULL; char proto_str[128], proto_nested[128], *ptr; size_t proto_len = strspn(filename, URL_SCHEME_CHARS); if (!first_protocol) { av_log(NULL, AV_LOG_WARNING, "No URL Protocols are registered. " "Missing call to av_register_all()?\n"); } if (filename[proto_len] != ':' && filename[proto_len] != ',' || is_dos_path(filename)) strcpy(proto_str, "file"); else av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str))); if ((ptr = strchr(proto_str, ','))) *ptr = '\0'; av_strlcpy(proto_nested, proto_str, sizeof(proto_nested)); if ((ptr = strchr(proto_nested, '+'))) *ptr = '\0'; while (up = ffurl_protocol_next(up)) { if (!strcmp(proto_str, up->name)) return url_alloc_for_protocol (puc, up, filename, flags, int_cb); if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && !strcmp(proto_nested, up->name)) return url_alloc_for_protocol (puc, up, filename, flags, int_cb); } *puc = NULL; return AVERROR_PROTOCOL_NOT_FOUND; }
int url_alloc(URLContext **puc, const char *filename, int flags) { URLProtocol *up; char proto_str[128], proto_nested[128], *ptr; //ec: strspn - Calculate the length of the initial substring of s which only contain letters in accept //ec: How about other symbol?Chinese etc. size_t proto_len = strspn(filename, URL_SCHEME_CHARS); if (filename[proto_len] != ':' || is_dos_path(filename)) strcpy(proto_str, "file"); else av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str))); av_strlcpy(proto_nested, proto_str, sizeof(proto_nested)); if ((ptr = strchr(proto_nested, '+'))) *ptr = '\0'; up = first_protocol; while (up != NULL) { if (!strcmp(proto_str, up->name)) return url_alloc_for_protocol (puc, up, filename, flags); if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && !strcmp(proto_nested, up->name)) return url_alloc_for_protocol (puc, up, filename, flags); up = up->next; } *puc = NULL; return AVERROR(ENOENT); }
int url_open_protocol (URLContext **puc, struct URLProtocol *up, const char *filename, int flags) { int ret; ret = url_alloc_for_protocol(puc, up, filename, flags); if (ret) goto fail; ret = ffurl_connect(*puc); if (!ret) return 0; fail: ffurl_close(*puc); *puc = NULL; return ret; }
int ffurl_alloc(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb) { const URLProtocol *p = NULL; p = url_find_protocol(filename); if (p) return url_alloc_for_protocol(puc, p, filename, flags, int_cb); *puc = NULL; if (av_strstart(filename, "https:", NULL)) av_log(NULL, AV_LOG_WARNING, "https protocol not found, recompile FFmpeg with " "openssl, gnutls " "or securetransport enabled.\n"); return AVERROR_PROTOCOL_NOT_FOUND; }
int url_alloc(URLContext **puc, const char *filename, int flags) { URLProtocol *up; char proto_str[128]; size_t proto_len = strspn(filename, URL_SCHEME_CHARS); if (filename[proto_len] != ':' || is_dos_path(filename)) strcpy(proto_str, "file"); else av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str))); up = first_protocol; while (up != NULL) { if (!strcmp(proto_str, up->name)) return url_alloc_for_protocol (puc, up, filename, flags); up = up->next; } *puc = NULL; return AVERROR(ENOENT); }