[Mplayer-cvslog] CVS: main asfheader.c,1.9,1.10 aviheader.c,1.11,1.12 mplayer.c,1.101,1.102 stream.c,1.6,1.7 stream.h,1.3,1.4

GEREOFFY arpi_esp at users.sourceforge.net
Fri May 4 01:32:58 CEST 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv27227

Modified Files:
	asfheader.c aviheader.c mplayer.c stream.c stream.h 
Log Message:
allow playing from stdin

Index: asfheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/asfheader.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** asfheader.c	2001/04/23 22:51:13	1.9
--- asfheader.c	2001/05/03 23:32:55	1.10
***************
*** 181,184 ****
--- 181,187 ----
  
    } // switch GUID
+ 
+   if((*((unsigned int*)&objh.guid))==0x75b22636) break; // movi chunk
+ 
    if(!stream_seek(demuxer->stream,endpos)) break;
  } // while EOF

Index: aviheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/aviheader.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** aviheader.c	2001/04/23 22:51:13	1.11
--- aviheader.c	2001/05/03 23:32:55	1.12
***************
*** 50,53 ****
--- 50,54 ----
        demuxer->movi_end=demuxer->movi_start+len;
        if(verbose>=1) printf("Found movie at 0x%X - 0x%X\n",demuxer->movi_start,demuxer->movi_end);
+       if(index_mode==-2) break; // reading from non-seekable source (stdin)
        len=(len+1)&(~1);
        stream_skip(demuxer->stream,len);

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -C2 -r1.101 -r1.102
*** mplayer.c	2001/04/26 22:10:01	1.101
--- mplayer.c	2001/05/03 23:32:55	1.102
***************
*** 554,562 ****
  //============ Open plain FILE ============
    int len;
!   f=open(filename,O_RDONLY);
!   if(f<0){ printf("File not found: '%s'\n",filename);return 1; }
!   len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);
!   stream=new_stream(f,STREAMTYPE_FILE);
!   stream->end_pos=len;
  }
  
--- 554,569 ----
  //============ Open plain FILE ============
    int len;
!   if(!strcmp(filename,"-")){
!       // read from stdin
!       printf("Reading from stdin...\n");
!       f=0; // 0=stdin
!       stream=new_stream(f,STREAMTYPE_STREAM);
!   } else {
!       f=open(filename,O_RDONLY);
!       if(f<0){ printf("File not found: '%s'\n",filename);return 1; }
!       len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);
!       stream=new_stream(f,STREAMTYPE_FILE);
!       stream->end_pos=len;
!   }
  }
  
***************
*** 659,663 ****
   case DEMUXER_TYPE_AVI: {
    //---- AVI header:
!   read_avi_header(demuxer,index_mode);
    stream_reset(demuxer->stream);
    stream_seek(demuxer->stream,demuxer->movi_start);
--- 666,670 ----
   case DEMUXER_TYPE_AVI: {
    //---- AVI header:
!   read_avi_header(demuxer,f?index_mode:-2);
    stream_reset(demuxer->stream);
    stream_seek(demuxer->stream,demuxer->movi_start);
***************
*** 1158,1162 ****
    load_termcap(NULL); // load key-codes
  #endif
!   getch2_enable();
  
    //========= Catch terminate signals: ================
--- 1165,1169 ----
    load_termcap(NULL); // load key-codes
  #endif
!   if(f) getch2_enable();
  
    //========= Catch terminate signals: ================
***************
*** 1637,1641 ****
            lirc_mp_getinput()<=0 &&
  #endif
!           getch2(20)<=0 && mplayer_get_key()<=0){
  	  video_out->check_events();
        }
--- 1644,1648 ----
            lirc_mp_getinput()<=0 &&
  #endif
!           (!f || getch2(20)<=0) && mplayer_get_key()<=0){
  	  video_out->check_events();
        }
***************
*** 1654,1658 ****
        (c=lirc_mp_getinput())>0 ||
  #endif
!       (c=getch2(0))>0 || (c=mplayer_get_key())>0) switch(c){
      // seek 10 sec
      case KEY_RIGHT:
--- 1661,1665 ----
        (c=lirc_mp_getinput())>0 ||
  #endif
!       (f && (c=getch2(0)))>0 || (c=mplayer_get_key())>0) switch(c){
      // seek 10 sec
      case KEY_RIGHT:

Index: stream.c
===================================================================
RCS file: /cvsroot/mplayer/main/stream.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** stream.c	2001/04/23 21:25:09	1.6
--- stream.c	2001/05/03 23:32:55	1.7
***************
*** 25,28 ****
--- 25,29 ----
    switch(s->type){
    case STREAMTYPE_FILE:
+   case STREAMTYPE_STREAM:
      len=read(s->fd,s->buffer,STREAM_BUFFER_SIZE);break;
    case STREAMTYPE_VCD:
***************
*** 56,59 ****
--- 57,61 ----
    switch(s->type){
    case STREAMTYPE_FILE:
+   case STREAMTYPE_STREAM:
      newpos=pos&(~(STREAM_BUFFER_SIZE-1));break;
    case STREAMTYPE_VCD:
***************
*** 64,73 ****
  
  if(newpos==0 || newpos!=s->pos){
-   s->pos=newpos; // real seek
    switch(s->type){
    case STREAMTYPE_FILE:
      if(lseek(s->fd,s->pos,SEEK_SET)<0) s->eof=1;
      break;
    case STREAMTYPE_VCD:
  #ifdef VCD_CACHE
      vcd_cache_seek(s->pos/VCD_SECTOR_DATA);
--- 66,76 ----
  
  if(newpos==0 || newpos!=s->pos){
    switch(s->type){
    case STREAMTYPE_FILE:
+     s->pos=newpos; // real seek
      if(lseek(s->fd,s->pos,SEEK_SET)<0) s->eof=1;
      break;
    case STREAMTYPE_VCD:
+     s->pos=newpos; // real seek
  #ifdef VCD_CACHE
      vcd_cache_seek(s->pos/VCD_SECTOR_DATA);
***************
*** 75,78 ****
--- 78,91 ----
      vcd_set_msf(s->pos/VCD_SECTOR_DATA);
  #endif
+     break;
+   case STREAMTYPE_STREAM:
+     //s->pos=newpos; // real seek
+     if(newpos<s->pos){
+       printf("Cannot seek backward in linear streams!\n");
+       return 1;
+     }
+     while(s->pos<newpos){
+       if(stream_fill_buffer(s)<=0) break; // EOF
+     }
      break;
    }

Index: stream.h
===================================================================
RCS file: /cvsroot/mplayer/main/stream.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** stream.h	2001/04/23 21:25:09	1.3
--- stream.h	2001/05/03 23:32:56	1.4
***************
*** 4,7 ****
--- 4,8 ----
  #define STREAMTYPE_FILE 0
  #define STREAMTYPE_VCD  1
+ #define STREAMTYPE_STREAM 2    // same as FILE but no seeking (for stdin)
  
  #define VCD_SECTOR_SIZE 2352
***************
*** 110,114 ****
  
  inline static void stream_skip(stream_t *s,int len){
!   if(len<0 || len>2*STREAM_BUFFER_SIZE){
      // negative or big skip!
      stream_seek(s,stream_tell(s)+len);
--- 111,115 ----
  
  inline static void stream_skip(stream_t *s,int len){
!   if(len<0 || (len>2*STREAM_BUFFER_SIZE && s->type!=STREAMTYPE_STREAM)){
      // negative or big skip!
      stream_seek(s,stream_tell(s)+len);


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list