diff -urd mplayer-1.0_rc2_p20090731.orig/cfg-common-opts.h mplayer-1.0_rc2_p20090731/cfg-common-opts.h --- mplayer-1.0_rc2_p20090731.orig/cfg-common-opts.h 2009-06-15 22:49:22.000000000 -0400 +++ mplayer-1.0_rc2_p20090731/cfg-common-opts.h 2009-09-29 22:18:27.980601405 -0400 @@ -300,6 +300,8 @@ {"forcedsubsonly", &forced_subs_only, CONF_TYPE_FLAG, 0, 0, 1, NULL}, // specify IFO file for VOBSUB subtitle {"ifo", &spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, NULL}, + {"vobsub", &vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL}, + {"vobsubid", &vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL}, // enable Closed Captioning display {"subcc", &subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"nosubcc", &subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, NULL}, diff -urd mplayer-1.0_rc2_p20090731.orig/cfg-mplayer.h mplayer-1.0_rc2_p20090731/cfg-mplayer.h --- mplayer-1.0_rc2_p20090731.orig/cfg-mplayer.h 2009-05-28 21:53:39.000000000 -0400 +++ mplayer-1.0_rc2_p20090731/cfg-mplayer.h 2009-09-29 22:18:40.457226837 -0400 @@ -271,9 +271,6 @@ {"menu", "OSD menu support was not compiled in.\n", CONF_TYPE_PRINT,0, 0, 0, NULL}, #endif /* CONFIG_MENU */ - // these should be moved to -common, and supported in MEncoder - {"vobsub", &vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"vobsubid", &vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL}, #ifdef CONFIG_UNRAR_EXEC {"unrarexec", &unrar_executable, CONF_TYPE_STRING, 0, 0, 0, NULL}, #endif diff -urd mplayer-1.0_rc2_p20090731.orig/mencoder.c mplayer-1.0_rc2_p20090731/mencoder.c --- mplayer-1.0_rc2_p20090731.orig/mencoder.c 2009-05-28 21:53:39.000000000 -0400 +++ mplayer-1.0_rc2_p20090731/mencoder.c 2009-09-30 00:11:04.623227169 -0400 @@ -187,6 +187,7 @@ float sub_delay=0; float sub_fps=0; int sub_auto = 0; +char *vobsub_name=NULL; int subcc_enabled=0; int suboverlap_enabled = 1; @@ -525,6 +526,45 @@ mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_OpenedStream, file_format, (int)(stream->start_pos), (int)(stream->end_pos)); + + if (vobsub_name){ + vo_vobsub=vobsub_open(vobsub_name,spudec_ifo,1,&vo_spudec); + if(vo_vobsub==NULL) + mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub, + filename_recode(vobsub_name)); + } else if (sub_auto && filename){ + /* try to autodetect vobsub from movie filename ::atmos */ + char *buf = strdup(filename), *psub; + char *pdot = strrchr(buf, '.'); + char *pslash = strrchr(buf, '/'); +#if defined(__MINGW32__) || defined(__CYGWIN__) + if (!pslash) pslash = strrchr(buf, '\\'); +#endif + if (pdot && (!pslash || pdot > pslash)) + *pdot = '\0'; + 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,'/'); +#if defined(__MINGW32__) || defined(__CYGWIN__) + 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){ + vobsub_set_from_lang(vo_vobsub, dvdsub_lang); + } + #ifdef CONFIG_DVDREAD if(stream->type==STREAMTYPE_DVD){ if(audio_lang && audio_id==-1) audio_id=dvd_aid_from_lang(stream,audio_lang); @@ -1486,6 +1526,7 @@ if(sh_video){ uninit_video(sh_video);sh_video=NULL; } if(demuxer) free_demuxer(demuxer); if(stream) free_stream(stream); // kill cache thread + if(vo_vobsub) vobsub_close(vo_vobsub); at_eof = 0;