# HG changeset patch # User albeu # Date 1133025017 0 # Node ID cd540846d052bcc1c171289b997fb19831f25880 # Parent 4b04284b7a924b1d82169f742aff40de85c13cfa Add support to get the list of files from a file containing one filename per line. Patch from devik (devik .at. cdi .dot. cz). diff -r 4b04284b7a92 -r cd540846d052 libmpdemux/mf.c --- a/libmpdemux/mf.c Sat Nov 26 16:01:43 2005 +0000 +++ b/libmpdemux/mf.c Sat Nov 26 17:10:17 2005 +0000 @@ -40,9 +40,38 @@ mf=calloc( 1,sizeof( mf_t ) ); + if( filename[0] == '@' ) + { + FILE *lst_f=fopen(filename + 1,"r"); + if ( lst_f ) + { + fname=malloc( 255 ); + while ( fgets( fname,255,lst_f ) ) + { + /* remove spaces from end of fname */ + char *t=fname + strlen( fname ) - 1; + while ( t > fname && isspace( *t ) ) *(t--)=0; + 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 ); + mf->nr_of_files++; + } + } + fclose( lst_f ); + + mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] number of files: %d\n",mf->nr_of_files ); + goto exit_mf; + } + mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] %s is not indirect filelist\n",filename+1 ); + } + if( strchr( filename,',') ) { - fname=malloc( 255 ); mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] filelist: %s\n",filename ); while ( ( fname=strsep( &filename,"," ) ) )