]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/avio.c
yop: initialize palette to 0
[ffmpeg] / libavformat / avio.c
index f2fec5bdefcbc001900418ee46b46af636272130..a43b241399184729162b1d3fa4522c0fa041c5c8 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <unistd.h>
-
 #include "libavutil/avstring.h"
 #include "libavutil/dict.h"
 #include "libavutil/opt.h"
+#include "libavutil/time.h"
 #include "os_support.h"
 #include "avformat.h"
 #if CONFIG_NETWORK
@@ -84,18 +83,13 @@ const AVClass ffurl_context_class = {
 /*@}*/
 
 
-#if FF_API_OLD_INTERRUPT_CB
-static int default_interrupt_cb(void);
-int (*url_interrupt_cb)(void) = default_interrupt_cb;
-#endif
-
 const char *avio_enum_protocols(void **opaque, int output)
 {
-    URLProtocol **p = opaque;
-    *p = ffurl_protocol_next(*p);
-    if (!*p) return NULL;
-    if ((output && (*p)->url_write) || (!output && (*p)->url_read))
-        return (*p)->name;
+    URLProtocol *p;
+    *opaque = ffurl_protocol_next(*opaque);
+    if (!(p = *opaque)) return NULL;
+    if ((output && p->url_write) || (!output && p->url_read))
+        return p->name;
     return avio_enum_protocols(opaque, output);
 }
 
@@ -242,7 +236,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
             if (fast_retries)
                 fast_retries--;
             else
-                usleep(1000);
+                av_usleep(1000);
         } else if (ret < 1)
             return ret < 0 ? ret : len;
         if (ret)
@@ -350,29 +344,32 @@ int ffurl_get_file_handle(URLContext *h)
     return h->prot->url_get_file_handle(h);
 }
 
-#if FF_API_OLD_INTERRUPT_CB
-static int default_interrupt_cb(void)
+int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
 {
-    return 0;
+    if (!h->prot->url_get_multi_file_handle) {
+        if (!h->prot->url_get_file_handle)
+            return AVERROR(ENOSYS);
+        *handles = av_malloc(sizeof(*handles));
+        if (!*handles)
+            return AVERROR(ENOMEM);
+        *numhandles = 1;
+        *handles[0] = h->prot->url_get_file_handle(h);
+        return 0;
+    }
+    return h->prot->url_get_multi_file_handle(h, handles, numhandles);
 }
 
-void avio_set_interrupt_cb(int (*interrupt_cb)(void))
+int ffurl_shutdown(URLContext *h, int flags)
 {
-    if (!interrupt_cb)
-        interrupt_cb = default_interrupt_cb;
-    url_interrupt_cb = interrupt_cb;
+    if (!h->prot->url_shutdown)
+        return AVERROR(EINVAL);
+    return h->prot->url_shutdown(h, flags);
 }
-#endif
 
 int ff_check_interrupt(AVIOInterruptCB *cb)
 {
     int ret;
     if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
         return ret;
-#if FF_API_OLD_INTERRUPT_CB
-    return url_interrupt_cb();
-#else
     return 0;
-#endif
 }
-