mirror of
https://github.com/mpv-player/mpv
synced 2025-03-22 19:34:14 +00:00
largefile patch by Stephen Davies <steve@daviesfam.org>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1429 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
5f8d90d83b
commit
9e3123d6a3
12
configure
vendored
12
configure
vendored
@ -6,6 +6,9 @@
|
|||||||
#
|
#
|
||||||
# Changes in reversed order:
|
# Changes in reversed order:
|
||||||
#
|
#
|
||||||
|
# 2001/07/31 by Steve Davies
|
||||||
|
# - added --enable-largefiles
|
||||||
|
#
|
||||||
# 2001/07/12 by Juergen Keil
|
# 2001/07/12 by Juergen Keil
|
||||||
# - add support for non-x86 targets
|
# - add support for non-x86 targets
|
||||||
# - add autoconf checks for loader/wine
|
# - add autoconf checks for loader/wine
|
||||||
@ -122,6 +125,7 @@ params:
|
|||||||
data [/usr/local/share/mplayer]
|
data [/usr/local/share/mplayer]
|
||||||
--enable-debug[=1-3] compile debugging information into mplayer [disable]
|
--enable-debug[=1-3] compile debugging information into mplayer [disable]
|
||||||
--enable-profile compile profiling information into mplayer [disable]
|
--enable-profile compile profiling information into mplayer [disable]
|
||||||
|
--enable-largefiles build with support for files >2^32 bytes long [disable]
|
||||||
--enable-mmx build with mmx support [autodetect]
|
--enable-mmx build with mmx support [autodetect]
|
||||||
--enable-mmx2 build with mmx2 support (PIII, Athlon) [autodetect]
|
--enable-mmx2 build with mmx2 support (PIII, Athlon) [autodetect]
|
||||||
--enable-3dnow build with 3dnow! support [autodetect]
|
--enable-3dnow build with 3dnow! support [autodetect]
|
||||||
@ -962,6 +966,9 @@ for ac_option do
|
|||||||
--enable-debug)
|
--enable-debug)
|
||||||
_debug='-g'
|
_debug='-g'
|
||||||
;;
|
;;
|
||||||
|
--enable-largefiles)
|
||||||
|
_largefiles=yes
|
||||||
|
;;
|
||||||
--enable-debug=*)
|
--enable-debug=*)
|
||||||
_debug=`echo $_echo_n '-g'$_echo_c; echo $ac_option | cut -d '=' -f 2`
|
_debug=`echo $_echo_n '-g'$_echo_c; echo $ac_option | cut -d '=' -f 2`
|
||||||
;;
|
;;
|
||||||
@ -1575,6 +1582,11 @@ if [ "$system_name" = "FreeBSD" ]; then
|
|||||||
CFLAGS="$CFLAGS -D_THREAD_SAFE"
|
CFLAGS="$CFLAGS -D_THREAD_SAFE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 64 bit file offsets?
|
||||||
|
if [ "$_largefiles" = "yes" ]; then
|
||||||
|
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
|
||||||
|
fi
|
||||||
|
|
||||||
# echo 'CFLAGS=$(OPTFLAGS) -Wall -DMPG12PLAY' >> config.mak
|
# echo 'CFLAGS=$(OPTFLAGS) -Wall -DMPG12PLAY' >> config.mak
|
||||||
|
|
||||||
echo "Creating $CCONF"
|
echo "Creating $CCONF"
|
||||||
|
10
demuxer.c
10
demuxer.c
@ -1,5 +1,8 @@
|
|||||||
//=================== DEMUXER v2.5 =========================
|
//=================== DEMUXER v2.5 =========================
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -96,12 +99,12 @@ void ds_add_packet(demux_stream_t *ds,demux_packet_t* dp){
|
|||||||
ds->first=ds->last=dp;
|
ds->first=ds->last=dp;
|
||||||
}
|
}
|
||||||
if(verbose>=2)
|
if(verbose>=2)
|
||||||
printf("DEMUX: Append packet to %s, len=%d pts=%5.3f pos=%d [packs: A=%d V=%d]\n",
|
printf("DEMUX: Append packet to %s, len=%d pts=%5.3f pos=%u [packs: A=%d V=%d]\n",
|
||||||
(ds==ds->demuxer->audio)?"d_audio":"d_video",
|
(ds==ds->demuxer->audio)?"d_audio":"d_video",
|
||||||
dp->len,dp->pts,dp->pos,ds->demuxer->audio->packs,ds->demuxer->video->packs);
|
dp->len,dp->pts,(unsigned int)dp->pos,ds->demuxer->audio->packs,ds->demuxer->video->packs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,int pos,int flags){
|
void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,int flags){
|
||||||
demux_packet_t* dp=new_demux_packet(len);
|
demux_packet_t* dp=new_demux_packet(len);
|
||||||
stream_read(stream,dp->buffer,len);
|
stream_read(stream,dp->buffer,len);
|
||||||
dp->pts=pts; //(float)pts/90000.0f;
|
dp->pts=pts; //(float)pts/90000.0f;
|
||||||
@ -574,4 +577,3 @@ switch(file_format){
|
|||||||
demuxer->file_format=file_format;
|
demuxer->file_format=file_format;
|
||||||
return demuxer;
|
return demuxer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
demuxer.h
18
demuxer.h
@ -18,10 +18,11 @@
|
|||||||
#define DEMUXER_TIME_BPS 3
|
#define DEMUXER_TIME_BPS 3
|
||||||
|
|
||||||
|
|
||||||
|
// Holds one packet/frame/whatever
|
||||||
typedef struct demux_packet_st {
|
typedef struct demux_packet_st {
|
||||||
int len;
|
int len;
|
||||||
float pts;
|
float pts;
|
||||||
int pos; // pozicio indexben (AVI) ill. fileban (MPG)
|
off_t pos; // pozicio indexben (AVI) ill. fileban (MPG)
|
||||||
unsigned char* buffer;
|
unsigned char* buffer;
|
||||||
int flags; // keyframe, etc
|
int flags; // keyframe, etc
|
||||||
struct demux_packet_st* next;
|
struct demux_packet_st* next;
|
||||||
@ -34,8 +35,8 @@ typedef struct {
|
|||||||
float pts; // current buffer's pts
|
float pts; // current buffer's pts
|
||||||
int pts_bytes; // number of bytes read after last pts stamp
|
int pts_bytes; // number of bytes read after last pts stamp
|
||||||
int eof; // end of demuxed stream? (true if all buffer empty)
|
int eof; // end of demuxed stream? (true if all buffer empty)
|
||||||
int pos; // position in the input stream (file)
|
off_t pos; // position in the input stream (file)
|
||||||
int dpos; // position in the demuxed stream
|
off_t dpos; // position in the demuxed stream
|
||||||
int pack_no; // serial number of packet
|
int pack_no; // serial number of packet
|
||||||
int flags; // flags of current packet (keyframe etc)
|
int flags; // flags of current packet (keyframe etc)
|
||||||
//---------------
|
//---------------
|
||||||
@ -55,12 +56,12 @@ typedef struct {
|
|||||||
typedef struct demuxer_st {
|
typedef struct demuxer_st {
|
||||||
stream_t *stream;
|
stream_t *stream;
|
||||||
int synced; // stream synced (used by mpeg)
|
int synced; // stream synced (used by mpeg)
|
||||||
int filepos; // input stream current pos.
|
off_t filepos; // input stream current pos.
|
||||||
int type; // demuxer type: mpeg PS, mpeg ES, avi, avi-ni, avi-nini, asf
|
int type; // demuxer type: mpeg PS, mpeg ES, avi, avi-ni, avi-nini, asf
|
||||||
int file_format; // file format: mpeg/avi/asf
|
int file_format; // file format: mpeg/avi/asf
|
||||||
// int time_src;// time source (pts/file/bps)
|
// int time_src;// time source (pts/file/bps)
|
||||||
unsigned int movi_start;
|
off_t movi_start;
|
||||||
unsigned int movi_end;
|
off_t movi_end;
|
||||||
//
|
//
|
||||||
demux_stream_t *audio;
|
demux_stream_t *audio;
|
||||||
demux_stream_t *video;
|
demux_stream_t *video;
|
||||||
@ -68,6 +69,7 @@ typedef struct demuxer_st {
|
|||||||
|
|
||||||
// index:
|
// index:
|
||||||
// AVIINDEXENTRY* idx;
|
// AVIINDEXENTRY* idx;
|
||||||
|
// FIXME: off_t???
|
||||||
void* idx;
|
void* idx;
|
||||||
int idx_size;
|
int idx_size;
|
||||||
int idx_pos;
|
int idx_pos;
|
||||||
@ -103,12 +105,12 @@ demux_stream_t* new_demuxer_stream(struct demuxer_st *demuxer,int id);
|
|||||||
demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id);
|
demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id);
|
||||||
|
|
||||||
void ds_add_packet(demux_stream_t *ds,demux_packet_t* dp);
|
void ds_add_packet(demux_stream_t *ds,demux_packet_t* dp);
|
||||||
void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,int pos,int flags);
|
void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,int flags);
|
||||||
|
|
||||||
int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds);
|
int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds);
|
||||||
int ds_fill_buffer(demux_stream_t *ds);
|
int ds_fill_buffer(demux_stream_t *ds);
|
||||||
|
|
||||||
inline static int ds_tell(demux_stream_t *ds){
|
inline static off_t ds_tell(demux_stream_t *ds){
|
||||||
return (ds->dpos-ds->buffer_size)+ds->buffer_pos;
|
return (ds->dpos-ds->buffer_size)+ds->buffer_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
35
mplayer.c
35
mplayer.c
@ -1,24 +1,25 @@
|
|||||||
// AVI & MPEG Player v0.18 (C) 2000-2001. by A'rpi/ESP-team
|
// AVI & MPEG Player v0.18 (C) 2000-2001. by A'rpi/ESP-team
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "version.h"
|
||||||
#include <stdlib.h>
|
#include "config.h"
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#include "version.h"
|
#include <signal.h>
|
||||||
#include "config.h"
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
#include <sys/cdrio.h>
|
#include <sys/cdrio.h>
|
||||||
@ -227,7 +228,7 @@ extern void avi_fixate();
|
|||||||
int osd_level=2;
|
int osd_level=2;
|
||||||
int divx_quality=0;
|
int divx_quality=0;
|
||||||
char *seek_to_sec=NULL;
|
char *seek_to_sec=NULL;
|
||||||
int seek_to_byte=0;
|
off_t seek_to_byte=0;
|
||||||
int has_audio=1;
|
int has_audio=1;
|
||||||
char *audio_codec=NULL; // override audio codec
|
char *audio_codec=NULL; // override audio codec
|
||||||
char *video_codec=NULL; // override video codec
|
char *video_codec=NULL; // override video codec
|
||||||
@ -641,7 +642,7 @@ if(vcd_track){
|
|||||||
stream->end_pos=ret2;
|
stream->end_pos=ret2;
|
||||||
} else {
|
} else {
|
||||||
//============ Open plain FILE ============
|
//============ Open plain FILE ============
|
||||||
int len;
|
off_t len;
|
||||||
if(!strcmp(filename,"-")){
|
if(!strcmp(filename,"-")){
|
||||||
// read from stdin
|
// read from stdin
|
||||||
printf("Reading from stdin...\n");
|
printf("Reading from stdin...\n");
|
||||||
@ -656,6 +657,14 @@ if(vcd_track){
|
|||||||
f=open(filename,O_RDONLY);
|
f=open(filename,O_RDONLY);
|
||||||
if(f<0){ fprintf(stderr,"File not found: '%s'\n",filename);return 1; }
|
if(f<0){ fprintf(stderr,"File not found: '%s'\n",filename);return 1; }
|
||||||
len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);
|
len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);
|
||||||
|
if (len == -1)
|
||||||
|
perror("Error: lseek failed to obtain video file size");
|
||||||
|
else
|
||||||
|
#ifdef _LARGEFILE_SOURCE
|
||||||
|
fprintf(stderr, "File size is %lld bytes\n", (long long)len);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "File size is %u bytes\n", (unsigned int)len);
|
||||||
|
#endif
|
||||||
stream=new_stream(f,STREAMTYPE_FILE);
|
stream=new_stream(f,STREAMTYPE_FILE);
|
||||||
stream->end_pos=len;
|
stream->end_pos=len;
|
||||||
#ifdef STREAMING
|
#ifdef STREAMING
|
||||||
|
15
seek.c
15
seek.c
@ -58,6 +58,7 @@ if(demuxer->file_format==DEMUXER_TYPE_AVI && demuxer->idx_size<=0){
|
|||||||
|
|
||||||
switch(demuxer->file_format){
|
switch(demuxer->file_format){
|
||||||
|
|
||||||
|
//FIXME: OFF_T - Didn't check AVI case yet (avi files can't be >2G anyway?)
|
||||||
case DEMUXER_TYPE_AVI: {
|
case DEMUXER_TYPE_AVI: {
|
||||||
//================= seek in AVI ==========================
|
//================= seek in AVI ==========================
|
||||||
int rel_seek_frames=rel_seek_secs*sh_video->fps;
|
int rel_seek_frames=rel_seek_secs*sh_video->fps;
|
||||||
@ -187,12 +188,14 @@ switch(demuxer->file_format){
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//FIXME: OFF_T - didn't test ASF case yet (don't have a large asf...)
|
||||||
|
//FIXME: reports good or bad to steve@daviesfam.org please
|
||||||
case DEMUXER_TYPE_ASF: {
|
case DEMUXER_TYPE_ASF: {
|
||||||
//================= seek in ASF ==========================
|
//================= seek in ASF ==========================
|
||||||
float p_rate=10; // packets / sec
|
float p_rate=10; // packets / sec
|
||||||
int rel_seek_packs=rel_seek_secs*p_rate;
|
off_t rel_seek_packs=rel_seek_secs*p_rate; // FIXME: int may be enough?
|
||||||
int rel_seek_bytes=rel_seek_packs*asf_packetsize;
|
off_t rel_seek_bytes=rel_seek_packs*asf_packetsize;
|
||||||
int newpos;
|
off_t newpos;
|
||||||
//printf("ASF: packs: %d duration: %d \n",(int)fileh.packets,*((int*)&fileh.duration));
|
//printf("ASF: packs: %d duration: %d \n",(int)fileh.packets,*((int*)&fileh.duration));
|
||||||
// printf("ASF_seek: %d secs -> %d packs -> %d bytes \n",
|
// printf("ASF_seek: %d secs -> %d packs -> %d bytes \n",
|
||||||
// rel_seek_secs,rel_seek_packs,rel_seek_bytes);
|
// rel_seek_secs,rel_seek_packs,rel_seek_bytes);
|
||||||
@ -228,14 +231,18 @@ switch(demuxer->file_format){
|
|||||||
case DEMUXER_TYPE_MPEG_ES:
|
case DEMUXER_TYPE_MPEG_ES:
|
||||||
case DEMUXER_TYPE_MPEG_PS: {
|
case DEMUXER_TYPE_MPEG_PS: {
|
||||||
//================= seek in MPEG ==========================
|
//================= seek in MPEG ==========================
|
||||||
int newpos;
|
off_t newpos;
|
||||||
if(!sh_video->i_bps) // unspecified?
|
if(!sh_video->i_bps) // unspecified?
|
||||||
newpos=demuxer->filepos+2324*75*rel_seek_secs; // 174.3 kbyte/sec
|
newpos=demuxer->filepos+2324*75*rel_seek_secs; // 174.3 kbyte/sec
|
||||||
else
|
else
|
||||||
newpos=demuxer->filepos+(sh_video->i_bps)*rel_seek_secs;
|
newpos=demuxer->filepos+(sh_video->i_bps)*rel_seek_secs;
|
||||||
|
|
||||||
if(newpos<seek_to_byte) newpos=seek_to_byte;
|
if(newpos<seek_to_byte) newpos=seek_to_byte;
|
||||||
|
#ifdef _LARGEFILE_SOURCE
|
||||||
|
newpos&=~((long long)STREAM_BUFFER_SIZE-1); /* sector boundary */
|
||||||
|
#else
|
||||||
newpos&=~(STREAM_BUFFER_SIZE-1); /* sector boundary */
|
newpos&=~(STREAM_BUFFER_SIZE-1); /* sector boundary */
|
||||||
|
#endif
|
||||||
stream_seek(demuxer->stream,newpos);
|
stream_seek(demuxer->stream,newpos);
|
||||||
|
|
||||||
// re-sync video:
|
// re-sync video:
|
||||||
|
32
stream.c
32
stream.c
@ -1,10 +1,15 @@
|
|||||||
|
|
||||||
|
#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 <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
|
|
||||||
extern int verbose; // defined in mplayer.c
|
extern int verbose; // defined in mplayer.c
|
||||||
@ -40,14 +45,19 @@ int stream_fill_buffer(stream_t *s){
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int stream_seek_long(stream_t *s,unsigned int pos){
|
int stream_seek_long(stream_t *s,off_t pos){
|
||||||
unsigned int newpos;
|
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){
|
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",
|
printf("s->pos=%X newpos=%X new_bufpos=%X buflen=%X \n",
|
||||||
(unsigned int)s->pos,newpos,pos,s->buf_len);
|
(unsigned int)s->pos,newpos,pos,s->buf_len);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
s->buf_pos=s->buf_len=0;
|
s->buf_pos=s->buf_len=0;
|
||||||
@ -55,7 +65,11 @@ if(verbose>=3){
|
|||||||
switch(s->type){
|
switch(s->type){
|
||||||
case STREAMTYPE_FILE:
|
case STREAMTYPE_FILE:
|
||||||
case STREAMTYPE_STREAM:
|
case STREAMTYPE_STREAM:
|
||||||
|
#ifdef _LARGEFILE_SOURCE
|
||||||
|
newpos=pos&(~((long long)STREAM_BUFFER_SIZE-1));break;
|
||||||
|
#else
|
||||||
newpos=pos&(~(STREAM_BUFFER_SIZE-1));break;
|
newpos=pos&(~(STREAM_BUFFER_SIZE-1));break;
|
||||||
|
#endif
|
||||||
case STREAMTYPE_VCD:
|
case STREAMTYPE_VCD:
|
||||||
newpos=(pos/VCD_SECTOR_DATA)*VCD_SECTOR_DATA;break;
|
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
|
s->buf_pos=pos; // byte position in sector
|
||||||
return 1;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
stream.h
15
stream.h
@ -20,16 +20,17 @@ void vcd_cache_init(int s);
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int fd;
|
int fd;
|
||||||
long pos;
|
off_t pos;
|
||||||
int eof;
|
int eof;
|
||||||
int type; // 0=file 1=VCD
|
int type; // 0=file 1=VCD
|
||||||
unsigned int buf_pos,buf_len;
|
unsigned int buf_pos,buf_len;
|
||||||
long start_pos,end_pos;
|
off_t start_pos,end_pos;
|
||||||
unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE];
|
unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE];
|
||||||
} stream_t;
|
} stream_t;
|
||||||
|
|
||||||
int stream_fill_buffer(stream_t *s);
|
int stream_fill_buffer(stream_t *s);
|
||||||
int stream_seek_long(stream_t *s,unsigned int pos);
|
|
||||||
|
int stream_seek_long(stream_t *s,off_t pos);
|
||||||
|
|
||||||
inline static int stream_read_char(stream_t *s){
|
inline static int stream_read_char(stream_t *s){
|
||||||
return (s->buf_pos<s->buf_len)?s->buffer[s->buf_pos++]:
|
return (s->buf_pos<s->buf_len)?s->buffer[s->buf_pos++]:
|
||||||
@ -91,16 +92,16 @@ inline static int stream_eof(stream_t *s){
|
|||||||
return s->eof;
|
return s->eof;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int stream_tell(stream_t *s){
|
inline static off_t stream_tell(stream_t *s){
|
||||||
return s->pos+s->buf_pos-s->buf_len;
|
return s->pos+s->buf_pos-s->buf_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static int stream_seek(stream_t *s,unsigned int pos){
|
inline static int stream_seek(stream_t *s,off_t pos){
|
||||||
|
|
||||||
// if(verbose>=3) printf("seek to 0x%X\n",pos);
|
// if(verbose>=3) printf("seek to 0x%qX\n",(long long)pos);
|
||||||
|
|
||||||
if(pos<s->pos){
|
if(pos<s->pos){
|
||||||
int x=pos-(s->pos-s->buf_len);
|
off_t x=pos-(s->pos-s->buf_len);
|
||||||
if(x>=0){
|
if(x>=0){
|
||||||
s->buf_pos=x;
|
s->buf_pos=x;
|
||||||
// putchar('*');fflush(stdout);
|
// putchar('*');fflush(stdout);
|
||||||
|
Loading…
Reference in New Issue
Block a user