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
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182015-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
18-------- 8< --------- FFmpeg 2.7 was cut here -------- 8< ---------22-------- 8< --------- FFmpeg 2.7 was cut here -------- 8< ---------
19 23
202015-06-04 - cc17b43 - lswr 1.2.100242015-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
421 return ret;421 return ret;
422}422}
423 423
424int 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
446int 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
424int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options)462int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options)
425{463{
426 URLContext *h = NULL;464 URLContext *h = NULL;
libavformat/avio.h+19−0
@@ -229,6 +229,25 @@ const char *avio_find_protocol_name(const char *url); · 228 unmodified lines
229 */229 */
230int avio_check(const char *url, int flags);230int avio_check(const char *url, int flags);
231 231
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 */
241int 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 */
249int avio_delete(const char *url);
250
232/**251/**
233 * Open directory for reading.252 * Open directory for reading.
234 *253 *
libavformat/url.h+2−0
@@ -90,6 +90,8 @@ typedef struct URLProtocol { · 89 unmodified lines
90 int (*url_open_dir)(URLContext *h);90 int (*url_open_dir)(URLContext *h);
91 int (*url_read_dir)(URLContext *h, AVIODirEntry **next);91 int (*url_read_dir)(URLContext *h, AVIODirEntry **next);
92 int (*url_close_dir)(URLContext *h);92 int (*url_close_dir)(URLContext *h);
93 int (*url_delete)(URLContext *h);
94 int (*url_move)(URLContext *h_src, URLContext *h_dst);
93} URLProtocol;95} URLProtocol;
94 96
95/**97/**
libavformat/version.h+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
30#include "libavutil/version.h"30#include "libavutil/version.h"
31 31
32#define LIBAVFORMAT_VERSION_MAJOR 5632#define LIBAVFORMAT_VERSION_MAJOR 56
33#define LIBAVFORMAT_VERSION_MINOR 3733#define LIBAVFORMAT_VERSION_MINOR 38
34#define LIBAVFORMAT_VERSION_MICRO 10034#define LIBAVFORMAT_VERSION_MICRO 100
35 35
36#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \36#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