History

lavf/avio: Extend API with avio_move() and avio_delete()

Mariusz Szczepańczyk committed 11 years ago

Commit 80e18bb1 parent 8fb672b5 files · +64 −1Browse files

Unified · Split

5 files
  1. doc/APIchanges +4 −0
  2. libavformat/avio.c +38 −0
  3. libavformat/avio.h +19 −0
  4. libavformat/url.h +2 −0
  5. libavformat/version.h +1 −1
doc/APIchanges+4−0
@@ -15,6 +15,10 @@ libavutil: 2014-08-09 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2015-xx-xx - xxxxxxx - lavf 56.38.100 - avio.h url.h
19+ Add avio_move(), avio_delete().
20+ Extend URLProtocol with url_move(), url_delete().
21+
1822 -------- 8< --------- FFmpeg 2.7 was cut here -------- 8< ---------
1923
2024 2015-06-04 - cc17b43 - lswr 1.2.100
libavformat/avio.c+38−0
@@ -421,6 +421,44 @@ int avio_check(const char *url, int flags) · 420 unmodified lines
421421 return ret;
422422 }
423423
424+int avio_move(const char *url_src, const char *url_dst)
425+{
426+ URLContext *h_src, *h_dst;
427+ int ret = ffurl_alloc(&h_src, url_src, AVIO_FLAG_READ_WRITE, NULL);
428+ if (ret < 0)
429+ return ret;
430+ ret = ffurl_alloc(&h_dst, url_dst, AVIO_FLAG_WRITE, NULL);
431+ if (ret < 0) {
432+ ffurl_close(h_src);
433+ return ret;
434+ }
435+
436+ if (h_src->prot == h_dst->prot && h_src->prot->url_move)
437+ ret = h_src->prot->url_move(h_src, h_dst);
438+ else
439+ ret = AVERROR(ENOSYS);
440+
441+ ffurl_close(h_src);
442+ ffurl_close(h_dst);
443+ return ret;
444+}
445+
446+int avio_delete(const char *url)
447+{
448+ URLContext *h;
449+ int ret = ffurl_alloc(&h, url, AVIO_FLAG_WRITE, NULL);
450+ if (ret < 0)
451+ return ret;
452+
453+ if (h->prot->url_delete)
454+ ret = h->prot->url_delete(h);
455+ else
456+ ret = AVERROR(ENOSYS);
457+
458+ ffurl_close(h);
459+ return ret;
460+}
461+
424462 int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options)
425463 {
426464 URLContext *h = NULL;
libavformat/avio.h+19−0
@@ -229,6 +229,25 @@ const char *avio_find_protocol_name(const char *url); · 228 unmodified lines
229229 */
230230 int avio_check(const char *url, int flags);
231231
232+/**
233+ * Move or rename a resource.
234+ *
235+ * @note url_src and url_dst should share the same protocol and authority.
236+ *
237+ * @param url_src url to resource to be moved
238+ * @param url_dst new url to resource if the operation succeeded
239+ * @return >=0 on success or negative on error.
240+ */
241+int avio_move(const char *url_src, const char *url_dst);
242+
243+/**
244+ * Delete a resource.
245+ *
246+ * @param url resource to be deleted.
247+ * @return >=0 on success or negative on error.
248+ */
249+int avio_delete(const char *url);
250+
232251 /**
233252 * Open directory for reading.
234253 *
libavformat/url.h+2−0
@@ -90,6 +90,8 @@ typedef struct URLProtocol { · 89 unmodified lines
9090 int (*url_open_dir)(URLContext *h);
9191 int (*url_read_dir)(URLContext *h, AVIODirEntry **next);
9292 int (*url_close_dir)(URLContext *h);
93+ int (*url_delete)(URLContext *h);
94+ int (*url_move)(URLContext *h_src, URLContext *h_dst);
9395 } URLProtocol;
9496
9597 /**
libavformat/version.h+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 #include "libavutil/version.h"
3131
3232 #define LIBAVFORMAT_VERSION_MAJOR 56
33−#define LIBAVFORMAT_VERSION_MINOR 37
33+#define LIBAVFORMAT_VERSION_MINOR 38
3434 #define LIBAVFORMAT_VERSION_MICRO 100
3535
3636 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t