diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-11-26 17:10:17 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-11-26 17:10:17 +0000 |
commit | fcd2d08125646774e3b2ecd0f496a1167aed736b (patch) | |
tree | cfe51e6a6f7c46641de9b794ec3851d0e230b4fd /libmpdemux/mf.c | |
parent | e617bf86cdf6e2076455931ac80971328b550db8 (diff) | |
download | mpv-fcd2d08125646774e3b2ecd0f496a1167aed736b.tar.bz2 mpv-fcd2d08125646774e3b2ecd0f496a1167aed736b.tar.xz |
Add support to get the list of files from a file containing one filename
per line. Patch from devik (devik .at. cdi .dot. cz).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17051 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/mf.c')
-rw-r--r-- | libmpdemux/mf.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/libmpdemux/mf.c b/libmpdemux/mf.c index ed11acbd7f..f138710b28 100644 --- a/libmpdemux/mf.c +++ b/libmpdemux/mf.c @@ -40,9 +40,38 @@ mf_t* open_mf(char * filename){ 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,"," ) ) ) |