# HG changeset patch # User arpi_esp # Date 990997198 0 # Node ID bad858a47870aeb2f515aa13aec5ba7a16be5259 # Parent ceb1ae196e3a82cfd75992baf5c18dfdbffb2a7d implemented ~/.mplayer/sub/filename.sub stuff diff -r ceb1ae196e3a -r bad858a47870 mplayer.c --- a/mplayer.c Sun May 27 20:18:52 2001 +0000 +++ b/mplayer.c Sun May 27 20:59:58 2001 +0000 @@ -623,9 +623,9 @@ if ( sub_auto ) { // auto load sub file ... - subtitles=sub_read_file( sub_filename( filename ) ); - if ( subtitles == NULL ) subtitles=sub_read_file(get_path("default.sub")); // try default: - } else subtitles=sub_read_file(get_path("default.sub")); // try default: + subtitles=sub_read_file( sub_filename( get_path("sub/"), filename ) ); + } + if ( subtitles == NULL ) subtitles=sub_read_file(get_path("default.sub")); // try default: } diff -r ceb1ae196e3a -r bad858a47870 subreader.c --- a/subreader.c Sun May 27 20:18:52 2001 +0000 +++ b/subreader.c Sun May 27 20:59:58 2001 +0000 @@ -373,6 +373,7 @@ return first; } +#if 0 char * strreplace( char * in,char * what,char * whereof ) { int i; @@ -383,14 +384,16 @@ if ( strlen( what ) > strlen( whereof ) ) tmp[i]=0; return in; } +#endif -char * sub_filename( char * fname ) +char * sub_filename(char* path, char * fname ) { - char * sub_name = NULL; - char * sub_tmp = NULL; - int i; -#define SUB_EXTS 10 - char * sub_exts[SUB_EXTS] = + char * sub_name1; + char * sub_name2; + int i,j; + FILE * f; + int pos=0; + char * sub_exts[] = { ".sub", ".SUB", ".srt", @@ -401,29 +404,31 @@ ".RT", ".txt", ".TXT"}; - + if ( fname == NULL ) return NULL; - for( i=strlen( fname );i>0;i-- ) - if( fname[i] == '.' ) - { - sub_tmp=(char *)&fname[i]; - break; - } - if ( i == 0 ) return NULL; - sub_name=strdup( fname ); - for ( i=0;i