[Mplayer-cvslog] CVS: main subreader.c,1.12,1.13 subreader.h,1.5,1.6 mplayer.c,1.126,1.127
GEREOFFY
arpi_esp at users.sourceforge.net
Sun May 27 23:00:00 CEST 2001
Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv24484
Modified Files:
subreader.c subreader.h mplayer.c
Log Message:
implemented ~/.mplayer/sub/filename.sub stuff
Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** subreader.c 2001/05/24 09:19:38 1.12
--- subreader.c 2001/05/27 20:59:58 1.13
***************
*** 374,377 ****
--- 374,378 ----
}
+ #if 0
char * strreplace( char * in,char * what,char * whereof )
{
***************
*** 384,395 ****
return in;
}
! char * sub_filename( char * fname )
{
! char * sub_name = NULL;
! char * sub_tmp = NULL;
! int i;
! #define SUB_EXTS 10
! char * sub_exts[SUB_EXTS] =
{ ".sub",
".SUB",
--- 385,398 ----
return in;
}
+ #endif
! char * sub_filename(char* path, char * fname )
{
! char * sub_name1;
! char * sub_name2;
! int i,j;
! FILE * f;
! int pos=0;
! char * sub_exts[] =
{ ".sub",
".SUB",
***************
*** 402,428 ****
".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<SUB_EXTS;i++ )
! {
! FILE * f;
!
! strcpy( sub_name,fname );
! f=fopen( strreplace( sub_name,sub_tmp,sub_exts[i] ),"rt" );
! if ( f != NULL )
! {
fclose( f );
printf( "SUB: Detected sub file: %s\n",sub_name );
return sub_name;
! }
}
return NULL;
}
--- 405,433 ----
".txt",
".TXT"};
!
if ( fname == NULL ) return NULL;
!
! sub_name1=strrchr(fname,'.');
! if (!sub_name1) return NULL;
! pos=sub_name1-fname;
!
! sub_name1=malloc(strlen(path)+strlen(fname)+8);
! strcpy(sub_name1,path);
! sub_name2=sub_name1+strlen(path);
! strncpy(sub_name2,fname,pos);
!
! for(j=0;j<=1;j++){
! char* sub_name=j?sub_name1:sub_name2;
! for ( i=0;i<(sizeof(sub_exts)/sizeof(char*));i++ ) {
! strcpy(sub_name2+pos,sub_exts[i]);
! // printf("trying: '%s'\n",sub_name);
! if((f=fopen( sub_name,"rt" ))) {
fclose( f );
printf( "SUB: Detected sub file: %s\n",sub_name );
return sub_name;
! }
}
+ }
+
return NULL;
}
Index: subreader.h
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** subreader.h 2001/05/17 09:17:16 1.5
--- subreader.h 2001/05/27 20:59:58 1.6
***************
*** 25,29 ****
subtitle* sub_read_file (char *filename);
! char * sub_filename( char * fname );
#endif
--- 25,29 ----
subtitle* sub_read_file (char *filename);
! char * sub_filename(char *path, char * fname );
#endif
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -C2 -r1.126 -r1.127
*** mplayer.c 2001/05/27 00:02:12 1.126
--- mplayer.c 2001/05/27 20:59:58 1.127
***************
*** 624,630 ****
{
// 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:
}
--- 624,630 ----
{
// auto load sub file ...
! subtitles=sub_read_file( sub_filename( get_path("sub/"), filename ) );
! }
! if ( subtitles == NULL ) subtitles=sub_read_file(get_path("default.sub")); // try default:
}
_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
More information about the MPlayer-cvslog
mailing list