summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/stream.c b/stream.c
index 5a6a7fa71f..b83f1405d6 100644
--- a/stream.c
+++ b/stream.c
@@ -1,10 +1,15 @@
-#include <stdio.h>
-#include <stdlib.h>
+#include "config.h"
+#include <sys/types.h>
+#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <fcntl.h>
#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#include "stream.h"
extern int verbose; // defined in mplayer.c
@@ -40,14 +45,19 @@ int stream_fill_buffer(stream_t *s){
return len;
}
-int stream_seek_long(stream_t *s,unsigned int pos){
-unsigned int newpos;
+int stream_seek_long(stream_t *s,off_t pos){
+off_t newpos;
-// if(verbose>=3) printf("seek to 0x%X\n",pos);
+// if(verbose>=3) printf("seek to 0x%X\n",(unsigned int)pos);
if(verbose>=3){
+#ifdef _LARGEFILE_SOURCE
+ printf("s->pos=%llX newpos=%llX new_bufpos=%llX buflen=%X \n",
+ (long long)s->pos,(long long)newpos,(long long)pos,s->buf_len);
+#else
printf("s->pos=%X newpos=%X new_bufpos=%X buflen=%X \n",
(unsigned int)s->pos,newpos,pos,s->buf_len);
+#endif
}
s->buf_pos=s->buf_len=0;
@@ -55,7 +65,11 @@ if(verbose>=3){
switch(s->type){
case STREAMTYPE_FILE:
case STREAMTYPE_STREAM:
+#ifdef _LARGEFILE_SOURCE
+ newpos=pos&(~((long long)STREAM_BUFFER_SIZE-1));break;
+#else
newpos=pos&(~(STREAM_BUFFER_SIZE-1));break;
+#endif
case STREAMTYPE_VCD:
newpos=(pos/VCD_SECTOR_DATA)*VCD_SECTOR_DATA;break;
}
@@ -97,7 +111,11 @@ if(newpos==0 || newpos!=s->pos){
s->buf_pos=pos; // byte position in sector
return 1;
}
- if(verbose) printf("stream_seek: WARNING! Can't seek to 0x%X !\n",pos+newpos);
+#ifdef _LARGEFILE_SOURCE
+ if(verbose) printf("stream_seek: WARNING! Can't seek to 0x%llX !\n",(long long)(pos+newpos));
+#else
+ if(verbose) printf("stream_seek: WARNING! Can't seek to 0x%X !\n",(pos+newpos));
+#endif
return 0;
}