[FFmpeg-devel] [PATCH 1/2] lavf/url: add ffurl_disconnect().

Nicolas George nicolas.george at normalesup.org
Sun Jul 21 16:14:23 CEST 2013


Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavformat/avio.c |   14 ++++++++++++--
 libavformat/url.h  |    7 +++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 2c7a35e..067964b 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -337,14 +337,24 @@ int64_t ffurl_seek(URLContext *h, int64_t pos, int whence)
     return ret;
 }
 
-int ffurl_closep(URLContext **hh)
+int ffurl_disconnect(URLContext *h)
 {
-    URLContext *h= *hh;
     int ret = 0;
     if (!h) return 0; /* can happen when ffurl_open fails */
 
     if (h->is_connected && h->prot->url_close)
         ret = h->prot->url_close(h);
+    h->is_connected = 0;
+    return ret;
+}
+
+int ffurl_closep(URLContext **hh)
+{
+    URLContext *h= *hh;
+    int ret = 0;
+    if (!h) return 0; /* can happen when ffurl_open fails */
+
+    ret = ffurl_disconnect(h);
 #if CONFIG_NETWORK
     if (h->prot->flags & URL_PROTOCOL_FLAG_NETWORK)
         ff_network_close();
diff --git a/libavformat/url.h b/libavformat/url.h
index 06dfda1..84d6527 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -181,6 +181,13 @@ int ffurl_write(URLContext *h, const unsigned char *buf, int size);
 int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
 
 /**
+ * Disconnect from the resource accessed by the URLContext h.
+ *
+ * @return  0 for success or a negative error code
+ */
+int ffurl_disconnect(URLContext *h);
+
+/**
  * Close the resource accessed by the URLContext h, and free the
  * memory used by it. Also set the URLContext pointer to NULL.
  *
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list