summaryrefslogtreecommitdiff
path: root/contrib/ffmpeg/libavformat/avio.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg/libavformat/avio.c')
-rw-r--r--contrib/ffmpeg/libavformat/avio.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/contrib/ffmpeg/libavformat/avio.c b/contrib/ffmpeg/libavformat/avio.c
index a2b8a8325..a22bd22f3 100644
--- a/contrib/ffmpeg/libavformat/avio.c
+++ b/contrib/ffmpeg/libavformat/avio.c
@@ -67,14 +67,17 @@ int url_open(URLContext **puc, const char *filename, int flags)
goto found;
up = up->next;
}
- err = -ENOENT;
+ err = AVERROR(ENOENT);
goto fail;
found:
- uc = av_malloc(sizeof(URLContext) + strlen(filename));
+ uc = av_malloc(sizeof(URLContext) + strlen(filename) + 1);
if (!uc) {
- err = -ENOMEM;
+ err = AVERROR(ENOMEM);
goto fail;
}
+#if LIBAVFORMAT_VERSION_INT >= (52<<16)
+ uc->filename = (char *) &uc[1];
+#endif
strcpy(uc->filename, filename);
uc->prot = up;
uc->flags = flags;
@@ -121,7 +124,7 @@ offset_t url_seek(URLContext *h, offset_t pos, int whence)
offset_t ret;
if (!h->prot->url_seek)
- return -EPIPE;
+ return AVERROR(EPIPE);
ret = h->prot->url_seek(h, pos, whence);
return ret;
}
@@ -148,20 +151,17 @@ offset_t url_filesize(URLContext *h)
{
offset_t pos, size;
- pos = url_seek(h, 0, SEEK_CUR);
- size = url_seek(h, -1, SEEK_END)+1;
- url_seek(h, pos, SEEK_SET);
+ size= url_seek(h, 0, AVSEEK_SIZE);
+ if(size<0){
+ pos = url_seek(h, 0, SEEK_CUR);
+ if ((size = url_seek(h, -1, SEEK_END)) < 0)
+ return size;
+ size++;
+ url_seek(h, pos, SEEK_SET);
+ }
return size;
}
-/*
- * Return the maximum packet size associated to packetized file
- * handle. If the file is not packetized (stream like http or file on
- * disk), then 0 is returned.
- *
- * @param h file handle
- * @return maximum packet size in bytes
- */
int url_get_max_packet_size(URLContext *h)
{
return h->max_packet_size;
@@ -178,12 +178,6 @@ static int default_interrupt_cb(void)
return 0;
}
-/**
- * The callback is called in blocking functions to test regulary if
- * asynchronous interruption is needed. -EINTR is returned in this
- * case by the interrupted function. 'NULL' means no interrupt
- * callback is given.
- */
void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
{
if (!interrupt_cb)