diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-11-03 14:19:25 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-11-03 14:19:25 +0000 |
commit | 058afda0f86065aa72c3a13b3d562f4d9e38394f (patch) | |
tree | be18757d8ef99d3621d05fca129ac72c7c71e4b9 /mplayer.c | |
parent | 126f151cda7190277933de140054dd6c16f53064 (diff) | |
download | mpv-058afda0f86065aa72c3a13b3d562f4d9e38394f.tar.bz2 mpv-058afda0f86065aa72c3a13b3d562f4d9e38394f.tar.xz |
Autoload vobsub's from ~/.mplayer/sub
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16898 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -1591,10 +1591,26 @@ while (player_idle_mode && !filename) { mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,vobsub_name); }else if(sub_auto && filename && (strlen(filename)>=5)){ /* try to autodetect vobsub from movie filename ::atmos */ - char *buf = malloc((strlen(filename)-3) * sizeof(char)); + char *buf = malloc((strlen(filename)-3) * sizeof(char)),*psub; memset(buf,0,strlen(filename)-3); // make sure string is terminated strncpy(buf, filename, strlen(filename)-4); vo_vobsub=vobsub_open(buf,spudec_ifo,0,&vo_spudec); + /* try from ~/.mplayer/sub */ + if(!vo_vobsub && (psub = get_path( "sub/" ))) { + char *bname; + int l; + bname = strrchr(buf,'/'); +#ifdef WIN32 + if(!bname) bname = strrchr(buf,'\\'); +#endif + if(bname) bname++; + else bname = buf; + l = strlen(psub) + strlen(bname) + 1; + psub = realloc(psub,l); + strcat(psub,bname); + vo_vobsub=vobsub_open(psub,spudec_ifo,0,&vo_spudec); + free(psub); + } free(buf); } if(vo_vobsub){ |