[MPlayer-dev-eng] [PATCH] remove default.sub fallback
Diego Biurrun
diego at biurrun.de
Thu Apr 20 01:34:02 CEST 2006
On Tue, Apr 18, 2006 at 09:28:44PM +0200, Reimar Döffinger wrote:
> On Tue, Apr 18, 2006 at 02:42:08PM +0200, Diego Biurrun wrote:
> > On Tue, Apr 18, 2006 at 02:11:52PM +0200, Diego Biurrun wrote:
> > > As discussed on -cvslog.. Here is a patch, have I overlooked something?
> > >
> > > --- mencoder.c 30 Mar 2006 23:44:35 -0000 1.348
> > > +++ mencoder.c 18 Apr 2006 12:10:59 -0000
> > > @@ -657,7 +657,7 @@
> > > tmp = sub_filenames((psub ? psub : ""), filename);
> > > free(psub);
> > > }
> > > - subdata=sub_read_file(tmp ? tmp[0] : "default.sub", sh_video->fps);
> > > + subdata=sub_read_file(tmp ? tmp[0] : tmp, sh_video->fps);
> >
> > tmp is initialized to NULL above, but it's probably better to make this
> > explicit and change the line to
> >
> > + subdata=sub_read_file(tmp ? tmp[0] : NULL, sh_video->fps);
>
> IMHO move the
> if (filename) up so it is if (sub_auto && filename), then tmp will
> always be != NULL and you can just use tmp[0].
.. something like the patch below?
Diego
--- mplayer.c 19 Apr 2006 21:06:11 -0000 1.931
+++ mplayer.c 19 Apr 2006 23:31:58 -0000
@@ -3109,14 +3111,6 @@
free(tmp[i++]);
}
free(tmp);
- if (set_of_sub_size == 0)
- {
- struct stat st;
- mem_ptr = get_path("default.sub");
- if (stat(mem_ptr, &st) == 0)
- add_subtitles (mem_ptr, sh_video->fps, 0);
- free(mem_ptr); // release the buffer created by get_path()
- }
}
if (set_of_sub_size > 0) {
// setup global sub numbering
--- mencoder.c 30 Mar 2006 23:44:35 -0000 1.348
+++ mencoder.c 19 Apr 2006 23:31:58 -0000
@@ -649,15 +649,13 @@
subdata=sub_read_file(sub_name[0], sh_video->fps);
if(!subdata) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,sub_name[0]);
} else
- if(sub_auto) { // auto load sub file ...
+ if(sub_auto && filename) { // auto load sub file ...
char **tmp = NULL;
int i = 0;
- if (filename) {
- char *psub = get_path( "sub/" );
- tmp = sub_filenames((psub ? psub : ""), filename);
- free(psub);
- }
- subdata=sub_read_file(tmp ? tmp[0] : "default.sub", sh_video->fps);
+ char *psub = get_path( "sub/" );
+ tmp = sub_filenames((psub ? psub : ""), filename);
+ free(psub);
+ subdata=sub_read_file(tmp[0], sh_video->fps);
while (tmp && tmp[i])
free(tmp[i++]);
free(tmp);
More information about the MPlayer-dev-eng
mailing list