[Ffmpeg-cvslog] r7395 - in trunk/libavformat: avio.c avio.h aviobuf.c
michael
subversion
Mon Jan 1 22:49:10 CET 2007
Author: michael
Date: Mon Jan 1 22:49:09 2007
New Revision: 7395
Modified:
trunk/libavformat/avio.c
trunk/libavformat/avio.h
trunk/libavformat/aviobuf.c
Log:
seekless filesize retrieving support in 7 lines of code, also doesnt break compatibility
Modified: trunk/libavformat/avio.c
==============================================================================
--- trunk/libavformat/avio.c (original)
+++ trunk/libavformat/avio.c Mon Jan 1 22:49:09 2007
@@ -148,9 +148,12 @@
{
offset_t pos, size;
+ size= url_seek(h, 0, AVSEEK_SIZE);
+ if(size<0){
pos = url_seek(h, 0, SEEK_CUR);
size = url_seek(h, -1, SEEK_END)+1;
url_seek(h, pos, SEEK_SET);
+ }
return size;
}
Modified: trunk/libavformat/avio.h
==============================================================================
--- trunk/libavformat/avio.h (original)
+++ trunk/libavformat/avio.h Mon Jan 1 22:49:09 2007
@@ -69,6 +69,8 @@
/* not implemented */
int url_poll(URLPollEntry *poll_table, int n, int timeout);
+#define AVSEEK_SIZE 0x10000
+
typedef struct URLProtocol {
const char *name;
int (*url_open)(URLContext *h, const char *filename, int flags);
Modified: trunk/libavformat/aviobuf.c
==============================================================================
--- trunk/libavformat/aviobuf.c (original)
+++ trunk/libavformat/aviobuf.c Mon Jan 1 22:49:09 2007
@@ -170,8 +170,11 @@
if (!s->seek)
return -EPIPE;
+ size = s->seek(s->opaque, 0, AVSEEK_SIZE);
+ if(size<0){
size = s->seek(s->opaque, -1, SEEK_END) + 1;
s->seek(s->opaque, s->pos, SEEK_SET);
+ }
return size;
}
More information about the ffmpeg-cvslog
mailing list