[Mplayer-cvslog] CVS: main/libmpdemux open.c,1.43,1.44
Arpi of Ize
arpi at mplayerhq.hu
Fri Jun 7 02:42:11 CEST 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv30896
Modified Files:
open.c
Log Message:
common code to handle file/stdin/fifo opening, allows using named pipes and
seeking with direct file redirection (mplayer < file.avi)
based on patch by Eric Lammerts <eric at lammerts.org>
Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- open.c 2 May 2002 10:32:55 -0000 1.43
+++ open.c 7 Jun 2002 00:42:08 -0000 1.44
@@ -417,15 +417,6 @@
return(stream);
}
-
-//============ Open STDIN ============
- if(!strcmp(filename,"-")){
- // read from stdin
- mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_ReadSTDIN);
- f=0; // 0=stdin
- stream=new_stream(f,STREAMTYPE_STREAM);
- return stream;
- }
#ifdef STREAMING
url = url_new(filename);
@@ -442,13 +433,20 @@
}
#endif
-//============ Open plain FILE ============
+//============ Open STDIN or plain FILE ============
+ if(!strcmp(filename,"-")){
+ // read from stdin
+ mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_ReadSTDIN);
+ f=0; // 0=stdin
+ } else {
f=open(filename,O_RDONLY);
if(f<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename);return NULL; }
+ }
+
len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);
if (len == -1)
- perror("Error: lseek failed to obtain video file size");
- else
+ return new_stream(f,STREAMTYPE_STREAM); // open as stream
+
#ifdef _LARGEFILE_SOURCE
mp_msg(MSGT_OPEN,MSGL_V,"File size is %lld bytes\n", (long long)len);
#else
@@ -457,7 +455,6 @@
stream=new_stream(f,STREAMTYPE_FILE);
stream->end_pos=len;
return stream;
-
}
int dvd_parse_chapter_range(struct config *conf, const char *range){
More information about the MPlayer-cvslog
mailing list