summaryrefslogtreecommitdiff
path: root/libavformat/avio.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r--libavformat/avio.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 8e1854976e..4141d0bd7d 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -2,20 +2,20 @@
* unbuffered I/O
* Copyright (c) 2001 Fabrice Bellard
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -52,21 +52,19 @@ static int default_interrupt_cb(void);
URLProtocol *first_protocol = NULL;
int (*url_interrupt_cb)(void) = default_interrupt_cb;
-#if FF_API_OLD_AVIO
URLProtocol *av_protocol_next(URLProtocol *p)
{
if(p) return p->next;
else return first_protocol;
}
-#endif
const char *avio_enum_protocols(void **opaque, int output)
{
- URLProtocol **p = opaque;
- *p = *p ? (*p)->next : first_protocol;
- if (!*p) return NULL;
- if ((output && (*p)->url_write) || (!output && (*p)->url_read))
- return (*p)->name;
+ URLProtocol *p = *opaque;
+ p = p ? p->next : first_protocol;
+ if (!p) return NULL;
+ if ((output && p->url_write) || (!output && p->url_read))
+ return p->name;
return avio_enum_protocols(opaque, output);
}
@@ -225,6 +223,11 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags)
char proto_str[128], proto_nested[128], *ptr;
size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
+ if (!first_protocol) {
+ av_log(NULL, AV_LOG_WARNING, "No URL Protocols are registered. "
+ "Missing call to av_register_all()?\n");
+ }
+
if (filename[proto_len] != ':' || is_dos_path(filename))
strcpy(proto_str, "file");
else
@@ -284,7 +287,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
if (ret)
fast_retries = FFMAX(fast_retries, 2);
len += ret;
- if (url_interrupt_cb())
+ if (len < size && url_interrupt_cb())
return AVERROR_EXIT;
}
return len;
@@ -312,7 +315,7 @@ int ffurl_write(URLContext *h, const unsigned char *buf, int size)
if (h->max_packet_size && size > h->max_packet_size)
return AVERROR(EIO);
- return retry_transfer_wrapper(h, buf, size, size, h->prot->url_write);
+ return retry_transfer_wrapper(h, buf, size, size, (void*)h->prot->url_write);
}
int64_t ffurl_seek(URLContext *h, int64_t pos, int whence)