]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/avio.c
Merge commit '9752d2e6cc9b9e8070ec515db8ed8374683d0856'
[ffmpeg] / libavformat / avio.c
index deeb87f9ecbb164eaac11759916d23d7ca229702..c188adcce1280be0df8a2537436688d7a76e28c7 100644 (file)
@@ -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;