MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_format_check_set_url

Function ff_format_check_set_url

libavformat/avformat.c:872–900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

870}
871
872int ff_format_check_set_url(AVFormatContext *s, const char *url)
873{
874 URLComponents uc;
875 av_assert0(url);
876 char proto[64];
877
878 int ret = ff_url_decompose(&uc, url, NULL);
879 if (ret < 0)
880 return ret;
881 av_strlcpy(proto, uc.scheme, FFMIN(sizeof(proto), uc.url_component_end_scheme - uc.scheme));
882
883 if (s->protocol_whitelist && av_match_list(proto, s->protocol_whitelist, ',') <= 0) {
884 av_log(s, AV_LOG_ERROR, "Protocol '%s' not on whitelist '%s'!\n", proto, s->protocol_whitelist);
885 return AVERROR(EINVAL);
886 }
887
888 if (s->protocol_blacklist && av_match_list(proto, s->protocol_blacklist, ',') > 0) {
889 av_log(s, AV_LOG_ERROR, "Protocol '%s' on blacklist '%s'!\n", proto, s->protocol_blacklist);
890 return AVERROR(EINVAL);
891 }
892
893 char *urldup = av_strdup(url);
894 if (!urldup)
895 return AVERROR(ENOMEM);
896
897 av_freep(&s->url);
898 s->url = urldup;
899 return 0;
900}
901
902
903int ff_format_io_close(AVFormatContext *s, AVIOContext **pb)

Callers 1

ff_rtsp_connectFunction · 0.85

Calls 6

ff_url_decomposeFunction · 0.85
av_strlcpyFunction · 0.85
av_match_listFunction · 0.85
av_logFunction · 0.85
av_strdupFunction · 0.85
av_freepFunction · 0.85

Tested by

no test coverage detected