X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Favio.c;h=c188adcce1280be0df8a2537436688d7a76e28c7;hb=7755a5744005e93ea2f59b4f46066b4b9118e90a;hp=deeb87f9ecbb164eaac11759916d23d7ca229702;hpb=6cfaa51acbf7f604ff94a3bc6e564855e7813b3a;p=ffmpeg diff --git a/libavformat/avio.c b/libavformat/avio.c index deeb87f9ecb..c188adcce12 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -263,7 +263,7 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags, *puc = NULL; if (av_strstart(filename, "https:", NULL)) - av_log(NULL, AV_LOG_WARNING, "https protocol not found, recompile with " + av_log(NULL, AV_LOG_WARNING, "https protocol not found, recompile FFmpeg with " "openssl, gnutls,\n" "or securetransport enabled.\n"); return AVERROR_PROTOCOL_NOT_FOUND; @@ -421,6 +421,44 @@ int avio_check(const char *url, int flags) return ret; } +int avpriv_io_move(const char *url_src, const char *url_dst) +{ + URLContext *h_src, *h_dst; + int ret = ffurl_alloc(&h_src, url_src, AVIO_FLAG_READ_WRITE, NULL); + if (ret < 0) + return ret; + ret = ffurl_alloc(&h_dst, url_dst, AVIO_FLAG_WRITE, NULL); + if (ret < 0) { + ffurl_close(h_src); + return ret; + } + + if (h_src->prot == h_dst->prot && h_src->prot->url_move) + ret = h_src->prot->url_move(h_src, h_dst); + else + ret = AVERROR(ENOSYS); + + ffurl_close(h_src); + ffurl_close(h_dst); + return ret; +} + +int avpriv_io_delete(const char *url) +{ + URLContext *h; + int ret = ffurl_alloc(&h, url, AVIO_FLAG_WRITE, NULL); + if (ret < 0) + return ret; + + if (h->prot->url_delete) + ret = h->prot->url_delete(h); + else + ret = AVERROR(ENOSYS); + + ffurl_close(h); + return ret; +} + int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options) { URLContext *h = NULL; @@ -447,6 +485,7 @@ int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options) if (ret < 0) goto fail; + h->is_connected = 1; ctx->url_context = h; *s = ctx; return 0;