[MPlayer-users] Patch to allow mencoders MF option to read its frame list from a file

Sam Mason sam at samason.me.uk
Fri Sep 19 13:39:07 CEST 2003


Hello everybody,

Here's a pretty trivial patch (against mplayer-1.0pre1) that adds
support for reading the MF list from a file (or standard input).

e.g. from a file:

  mencoder mf://@files.txt -mf type=jpeg -ovc lavc

from standard input:

  find -name "*.jpeg" | sort | mencoder mf://@- -mf type=jpeg -ovc lavc

Hope you find it useful,
  Sam
-------------- next part --------------
--- mf.c~	2003-04-25 11:20:15.000000000 +0100
+++ mf.c	2003-09-19 12:02:31.000000000 +0100
@@ -40,6 +40,44 @@
 
  mf=calloc( 1,sizeof( mf_t ) );
 
+ if( filename[0] == '@' )
+ {
+	 int close_needed = 0;
+
+	 FILE * file;
+
+	 if(strcmp(filename + 1, "-") == 0)
+		 file = stdin;
+	 else
+	 {
+		 close_needed = 1;
+
+		 file = fopen(filename + 1, "r");
+	 }
+
+	 fname=malloc( 255 );
+
+	 while(fscanf(file, " %255s ", fname) == 1)
+	 {
+		 if(stat(fname, &fs))
+		 {
+			 mp_msg(MSGT_STREAM,MSGL_V,"[mf] file not found: '%s'\n", fname);
+		 }
+		 else
+		 {
+			 mf->names=realloc( mf->names,( mf->nr_of_files + 1 ) * sizeof( char* ) );
+			 mf->names[mf->nr_of_files]=strdup( fname );
+			 //       mp_msg( MSGT_STREAM,MSGL_V,"[mf] added file %d.: %s\n",mf->nr_of_files,mf->names[mf->nr_of_files] );
+			 mf->nr_of_files++;
+		 }
+	 }
+
+	 if(close_needed)
+		 fclose(file);
+
+	 goto exit_mf;
+ }
+
  if( strchr( filename,',') )
   { 
    fname=malloc( 255 ); 


More information about the MPlayer-users mailing list