[Mplayer-cvslog] CVS: main configure,1.125,1.126 demuxer.c,1.14,1.15 demuxer.h,1.9,1.10 mplayer.c,1.197,1.198 seek.c,1.4,1.5 stream.c,1.11,1.12 stream.h,1.5,1.6
Arpi of Ize
arpi at mplayer.dev.hu
Wed Aug 1 01:18:19 CEST 2001
Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv17594
Modified Files:
configure demuxer.c demuxer.h mplayer.c seek.c stream.c
stream.h
Log Message:
largefile patch by Stephen Davies <steve at daviesfam.org>
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -r1.125 -r1.126
--- configure 31 Jul 2001 22:20:43 -0000 1.125
+++ configure 31 Jul 2001 23:18:16 -0000 1.126
@@ -6,6 +6,9 @@
#
# Changes in reversed order:
#
+# 2001/07/31 by Steve Davies
+# - added --enable-largefiles
+#
# 2001/07/12 by Juergen Keil
# - add support for non-x86 targets
# - add autoconf checks for loader/wine
@@ -122,6 +125,7 @@
data [/usr/local/share/mplayer]
--enable-debug[=1-3] compile debugging 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-mmx2 build with mmx2 support (PIII, Athlon) [autodetect]
--enable-3dnow build with 3dnow! support [autodetect]
@@ -962,6 +966,9 @@
--enable-debug)
_debug='-g'
;;
+ --enable-largefiles)
+ _largefiles=yes
+ ;;
--enable-debug=*)
_debug=`echo $_echo_n '-g'$_echo_c; echo $ac_option | cut -d '=' -f 2`
;;
@@ -1573,6 +1580,11 @@
# for MT applications:
if [ "$system_name" = "FreeBSD" ]; then
CFLAGS="$CFLAGS -D_THREAD_SAFE"
+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
Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- demuxer.c 29 Jul 2001 21:07:34 -0000 1.14
+++ demuxer.c 31 Jul 2001 23:18:16 -0000 1.15
@@ -1,5 +1,8 @@
//=================== DEMUXER v2.5 =========================
+#include <sys/types.h>
+#include <sys/stat.h>
+
#include <stdio.h>
#include <stdlib.h>
@@ -96,12 +99,12 @@
ds->first=ds->last=dp;
}
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",
- 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);
stream_read(stream,dp->buffer,len);
dp->pts=pts; //(float)pts/90000.0f;
@@ -574,4 +577,3 @@
demuxer->file_format=file_format;
return demuxer;
}
-
Index: demuxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- demuxer.h 21 Jul 2001 22:36:39 -0000 1.9
+++ demuxer.h 31 Jul 2001 23:18:16 -0000 1.10
@@ -18,10 +18,11 @@
#define DEMUXER_TIME_BPS 3
+// Holds one packet/frame/whatever
typedef struct demux_packet_st {
int len;
float pts;
- int pos; // pozicio indexben (AVI) ill. fileban (MPG)
+ off_t pos; // pozicio indexben (AVI) ill. fileban (MPG)
unsigned char* buffer;
int flags; // keyframe, etc
struct demux_packet_st* next;
@@ -34,8 +35,8 @@
float pts; // current buffer's pts
int pts_bytes; // number of bytes read after last pts stamp
int eof; // end of demuxed stream? (true if all buffer empty)
- int pos; // position in the input stream (file)
- int dpos; // position in the demuxed stream
+ off_t pos; // position in the input stream (file)
+ off_t dpos; // position in the demuxed stream
int pack_no; // serial number of packet
int flags; // flags of current packet (keyframe etc)
//---------------
@@ -55,12 +56,12 @@
typedef struct demuxer_st {
stream_t *stream;
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 file_format; // file format: mpeg/avi/asf
// int time_src;// time source (pts/file/bps)
- unsigned int movi_start;
- unsigned int movi_end;
+ off_t movi_start;
+ off_t movi_end;
//
demux_stream_t *audio;
demux_stream_t *video;
@@ -68,6 +69,7 @@
// index:
// AVIINDEXENTRY* idx;
+// FIXME: off_t???
void* idx;
int idx_size;
int idx_pos;
@@ -103,12 +105,12 @@
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_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 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;
}
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -r1.197 -r1.198
--- mplayer.c 30 Jul 2001 02:00:54 -0000 1.197
+++ mplayer.c 31 Jul 2001 23:18:16 -0000 1.198
@@ -1,24 +1,25 @@
// AVI & MPEG Player v0.18 (C) 2000-2001. by A'rpi/ESP-team
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <signal.h>
+#include "version.h"
+#include "config.h"
#include <sys/ioctl.h>
-#include <unistd.h>
-#include <time.h>
#include <sys/mman.h>
-
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/stat.h>
+
+#include <signal.h>
+
+#include <time.h>
+
#include <fcntl.h>
+#include <unistd.h>
-#include "version.h"
-#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#ifdef __FreeBSD__
#include <sys/cdrio.h>
@@ -227,7 +228,7 @@
int osd_level=2;
int divx_quality=0;
char *seek_to_sec=NULL;
-int seek_to_byte=0;
+off_t seek_to_byte=0;
int has_audio=1;
char *audio_codec=NULL; // override audio codec
char *video_codec=NULL; // override video codec
@@ -641,7 +642,7 @@
stream->end_pos=ret2;
} else {
//============ Open plain FILE ============
- int len;
+ off_t len;
if(!strcmp(filename,"-")){
// read from stdin
printf("Reading from stdin...\n");
@@ -656,6 +657,14 @@
f=open(filename,O_RDONLY);
if(f<0){ fprintf(stderr,"File not found: '%s'\n",filename);return 1; }
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->end_pos=len;
#ifdef STREAMING
Index: seek.c
===================================================================
RCS file: /cvsroot/mplayer/main/seek.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- seek.c 29 Jul 2001 21:07:34 -0000 1.4
+++ seek.c 31 Jul 2001 23:18:16 -0000 1.5
@@ -58,6 +58,7 @@
switch(demuxer->file_format){
+ //FIXME: OFF_T - Didn't check AVI case yet (avi files can't be >2G anyway?)
case DEMUXER_TYPE_AVI: {
//================= seek in AVI ==========================
int rel_seek_frames=rel_seek_secs*sh_video->fps;
@@ -187,12 +188,14 @@
}
break;
+ //FIXME: OFF_T - didn't test ASF case yet (don't have a large asf...)
+ //FIXME: reports good or bad to steve at daviesfam.org please
case DEMUXER_TYPE_ASF: {
//================= seek in ASF ==========================
float p_rate=10; // packets / sec
- int rel_seek_packs=rel_seek_secs*p_rate;
- int rel_seek_bytes=rel_seek_packs*asf_packetsize;
- int newpos;
+ off_t rel_seek_packs=rel_seek_secs*p_rate; // FIXME: int may be enough?
+ off_t rel_seek_bytes=rel_seek_packs*asf_packetsize;
+ off_t newpos;
//printf("ASF: packs: %d duration: %d \n",(int)fileh.packets,*((int*)&fileh.duration));
// printf("ASF_seek: %d secs -> %d packs -> %d bytes \n",
// rel_seek_secs,rel_seek_packs,rel_seek_bytes);
@@ -228,14 +231,18 @@
case DEMUXER_TYPE_MPEG_ES:
case DEMUXER_TYPE_MPEG_PS: {
//================= seek in MPEG ==========================
- int newpos;
+ off_t newpos;
if(!sh_video->i_bps) // unspecified?
newpos=demuxer->filepos+2324*75*rel_seek_secs; // 174.3 kbyte/sec
else
newpos=demuxer->filepos+(sh_video->i_bps)*rel_seek_secs;
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 */
+#endif
stream_seek(demuxer->stream,newpos);
// re-sync video:
Index: stream.c
===================================================================
RCS file: /cvsroot/mplayer/main/stream.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- stream.c 21 Jun 2001 00:06:40 -0000 1.11
+++ stream.c 31 Jul 2001 23:18:16 -0000 1.12
@@ -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 @@
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 @@
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 @@
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;
}
Index: stream.h
===================================================================
RCS file: /cvsroot/mplayer/main/stream.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- stream.h 4 Jun 2001 17:51:17 -0000 1.5
+++ stream.h 31 Jul 2001 23:18:16 -0000 1.6
@@ -20,16 +20,17 @@
typedef struct {
int fd;
- long pos;
+ off_t pos;
int eof;
int type; // 0=file 1=VCD
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];
} stream_t;
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){
return (s->buf_pos<s->buf_len)?s->buffer[s->buf_pos++]:
@@ -91,16 +92,16 @@
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;
}
-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){
- int x=pos-(s->pos-s->buf_len);
+ off_t x=pos-(s->pos-s->buf_len);
if(x>=0){
s->buf_pos=x;
// putchar('*');fflush(stdout);
More information about the MPlayer-cvslog
mailing list