[Mplayer-cvslog] CVS: main mplayer.c,1.215,1.216 demux_mpg.c,1.26,1.27 demuxer.c,1.20,1.21 Makefile,1.61,1.62

Arpi of Ize arpi at mplayer.dev.hu
Sun Aug 12 19:27:26 CEST 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv7423

Modified Files:
	mplayer.c demux_mpg.c demuxer.c Makefile 
Log Message:
seek.c moved to demuxer.c, stream_reset in new_demuxer()

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.215
retrieving revision 1.216
diff -u -r1.215 -r1.216
--- mplayer.c	12 Aug 2001 15:46:09 -0000	1.215
+++ mplayer.c	12 Aug 2001 17:27:23 -0000	1.216
@@ -593,7 +593,7 @@
   stream=open_stream(filename,vcd_track,&file_format);
   if(!stream) return 1; // error...
   use_stdin=(!strcmp(filename,"-"));
-  seek_to_byte+=stream->start_pos; // required for VCD
+  stream->start_pos+=seek_to_byte;
 
 #ifdef HAVE_LIBCSS
   if (dvdimportkey) {

Index: demux_mpg.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_mpg.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- demux_mpg.c	8 Aug 2001 19:37:45 -0000	1.26
+++ demux_mpg.c	12 Aug 2001 17:27:23 -0000	1.27
@@ -341,7 +341,7 @@
   return 1;
 }
 
-extern off_t seek_to_byte;
+//extern off_t seek_to_byte;
 
 void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,int flags){
     demux_stream_t *d_audio=demuxer->audio;
@@ -356,7 +356,7 @@
         else
           newpos=demuxer->filepos+(sh_video->i_bps)*rel_seek_secs;
 
-        if(newpos<seek_to_byte) newpos=seek_to_byte; // for VCD
+        if(newpos<demuxer->stream->start_pos) newpos=demuxer->stream->start_pos; // for VCD
 #ifdef _LARGEFILE_SOURCE
         newpos&=~((long long)STREAM_BUFFER_SIZE-1);  /* sector boundary */
 #else

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- demuxer.c	12 Aug 2001 15:46:09 -0000	1.20
+++ demuxer.c	12 Aug 2001 17:27:23 -0000	1.21
@@ -57,6 +57,8 @@
   d->video=new_demuxer_stream(d,v_id);
   d->sub=new_demuxer_stream(d,s_id);
   d->type=type;
+  stream_reset(stream);
+  stream_seek(stream,stream->start_pos);
   return d;
 }
 
@@ -293,7 +295,7 @@
 extern int num_elementary_packetsPES;
 
 // commandline options, flags:
-extern int seek_to_byte;
+//extern int seek_to_byte;
 extern int force_ni;
 extern int pts_from_bps;
 
@@ -321,9 +323,7 @@
 
 //=============== Try to open as AVI file: =================
 if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_AVI){
-  stream_reset(stream);
   demuxer=new_demuxer(stream,DEMUXER_TYPE_AVI,audio_id,video_id,dvdsub_id);
-  stream_seek(demuxer->stream,seek_to_byte);
   { //---- RIFF header:
     int id=stream_read_dword_le(demuxer->stream); // "RIFF"
     if(id==mmioFOURCC('R','I','F','F')){
@@ -338,9 +338,7 @@
 }
 //=============== Try to open as ASF file: =================
 if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_ASF){
-  stream_reset(stream);
   demuxer=new_demuxer(stream,DEMUXER_TYPE_ASF,audio_id,video_id,dvdsub_id);
-  stream_seek(demuxer->stream,seek_to_byte);
   if(asf_check_header(demuxer)){
       printf("Detected ASF file format!\n");
       file_format=DEMUXER_TYPE_ASF;
@@ -350,9 +348,7 @@
 if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_MPEG_PS){
  int pes=1;
  while(pes>=0){
-  stream_reset(stream);
   demuxer=new_demuxer(stream,DEMUXER_TYPE_MPEG_PS,audio_id,video_id,dvdsub_id);
-  stream_seek(demuxer->stream,seek_to_byte);
   if(!pes) demuxer->synced=1; // hack!
   if(ds_fill_buffer(demuxer->video)){
     if(!pes)
@@ -380,9 +376,7 @@
 }
 //=============== Try to open as MPEG-ES file: =================
 if(file_format==DEMUXER_TYPE_MPEG_ES){ // little hack, see above!
-  stream_reset(stream);
   demuxer=new_demuxer(stream,DEMUXER_TYPE_MPEG_ES,audio_id,video_id,dvdsub_id);
-  stream_seek(demuxer->stream,seek_to_byte);
   if(!ds_fill_buffer(demuxer->video)){
     printf("Invalid MPEG-ES stream??? contact the author, it may be a bug :(\n");
     file_format=DEMUXER_TYPE_UNKNOWN;
@@ -393,9 +387,7 @@
 //=============== Try to open as MOV file: =================
 #if 1
 if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_MOV){
-  stream_reset(stream);
   demuxer=new_demuxer(stream,DEMUXER_TYPE_MOV,audio_id,video_id,dvdsub_id);
-  stream_seek(demuxer->stream,seek_to_byte);
   if(mov_check_file(demuxer)){
       printf("Detected QuickTime/MOV file format!\n");
       file_format=DEMUXER_TYPE_MOV;
@@ -489,3 +481,48 @@
 
 return demuxer;
 }
+
+
+
+int demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags);
+int demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,int flags);
+int demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,int flags);
+
+int demux_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
+    demux_stream_t *d_audio=demuxer->audio;
+    demux_stream_t *d_video=demuxer->video;
+    sh_audio_t *sh_audio=d_audio->sh;
+    sh_video_t *sh_video=d_video->sh;
+
+//if(demuxer->file_format==DEMUXER_TYPE_AVI && demuxer->idx_size<=0){
+//    printf("Can't seek in raw .AVI streams! (index required, try with the -idx switch!)  \n");
+//    return 0;
+//}
+
+    // clear demux buffers:
+    if(sh_audio){ ds_free_packs(d_audio);sh_audio->a_buffer_len=0;}
+    ds_free_packs(d_video);
+    
+    demuxer->stream->eof=0; // clear eof flag
+
+    if(sh_audio) sh_audio->timer=0;
+    sh_video->timer=0; // !!!!!!
+
+switch(demuxer->file_format){
+
+  case DEMUXER_TYPE_AVI:
+      demux_seek_avi(demuxer,rel_seek_secs,flags);  break;
+
+  case DEMUXER_TYPE_ASF:
+      demux_seek_asf(demuxer,rel_seek_secs,flags);  break;
+  
+  case DEMUXER_TYPE_MPEG_ES:
+  case DEMUXER_TYPE_MPEG_PS:
+      demux_seek_mpg(demuxer,rel_seek_secs,flags);  break;
+
+} // switch(demuxer->file_format)
+
+return 1;
+}
+
+

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/Makefile,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- Makefile	12 Aug 2001 01:57:56 -0000	1.61
+++ Makefile	12 Aug 2001 17:27:23 -0000	1.62
@@ -16,7 +16,7 @@
 #prefix = /usr/local
 BINDIR = ${prefix}/bin
 # BINDIR = /usr/local/bin
-SRCS = open.c seek.c parse_es.c find_sub.c aviprint.c dec_audio.c dec_video.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demux_mov.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c $(STREAM_SRCS)
+SRCS = open.c parse_es.c find_sub.c aviprint.c dec_audio.c dec_video.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demux_mov.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c $(STREAM_SRCS)
 OBJS = $(SRCS:.c=.o)
 CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo $(CSS_INC) $(EXTRA_INC) # -Wall
 A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 $(ALSA_LIB) $(ESD_LIB)




More information about the MPlayer-cvslog mailing list