Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz SzczepaƄczyk <mszczepanczyk@gmail.com>2015-06-17 21:12:00 +0300
committerMichael Niedermayer <michaelni@gmx.at>2015-06-22 13:46:08 +0300
commit80e18bb4868a3e95e49b98bcabff25607e1b9679 (patch)
tree68051af4c9d956b036be7615562b1d4e257da90a /libavformat/avio.c
parent8fb672b50ae3c5faf75889a2ed8a867af0ddc8a8 (diff)
lavf/avio: Extend API with avio_move() and avio_delete()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r--libavformat/avio.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 261ff2af98..bd329446e3 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -421,6 +421,44 @@ int avio_check(const char *url, int flags)
return ret;
}
+int avio_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 avio_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;