[MPlayer-dev-eng] [PATCH] enable vobsub in mencoder
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Wed Sep 30 09:24:06 CEST 2009
On Wed, Sep 30, 2009 at 01:09:29AM -0400, Dani Church wrote:
> @@ -524,6 +525,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);
> + }
> +
I assume this is a copy from mplayer.c.
While some people would like to just let mencoder rot, I think this
really needs to be made into a common function that mplayer and mencoder
share, otherwise at least one of them will become broken rather soon.
More information about the MPlayer-dev-eng
mailing list