[MPlayer-users] Re: expand (and subtitles, again?)
Rudo Thomas
rudo at matfyz.cz
Wed Jul 28 01:14:01 CEST 2004
> > Obviously, I would welcome something like the -2, but as an argument to
> > expand. Should I cook up a patch for this, or is something similar flying
> > around (or in CVS, for example)?
>
> I think I understand what you want now. [...]
> so if I understand well you might want that mplayer adds black bands on
> top of bottom of your movie so that, when you switch to full screen
> (hardware scaling), the whole (movie + black bands) takes the entire
> screen. is it correct?
Exactly.
> if it is, I think it should be done somewhere. I don't know any option
> to do that in CVS but I don't know much. nevertheless I'm sure it's a
> basic option of a windows version of mplayer. I tested it in mpf
> (MPlayer Front End):
> http://deje.uw.hu/
> But I don't know how this is done, namely of it is a basic option of
> mplayer or if it is a script of the frontend. maybe you can contact the
> author there.
Yes, I have also found that one. It is even on one of its screenshots! It sure
seems like there already is an option to do the trick. Strange, that I (we?)
have not found it. Yet.
> PS: scripting for this should be easy anyway. it must be something like
> looking at the aspect ratio of the movie in mplayer's output and
> calculate it to fit the aspect ratio of your screen.
>
> it's a great idea so if you get the answer please let me know.
Well, I have already done the patch. Please test it, if you can.
It adds another option ("aspect") to the expand filter, as well as a special
value (-2) to be passed as "w" or "h". It causes the actual value to be
computed so that the result has given aspect ratio (ie. w/h==aspect).
Example: mplayer -vf expand=h=-2:aspect=1.25
This expands a 720x300 movie to 720x576. Aspect setting of 1.33333 would have
resulted in 720x540 dimensions.
Also note that you have to have monitor aspect ratio set correctly to
experience the full-screen effect I was targetting. As I have my desktop set at
1280x1024, I need to add '-monitoraspect 1.25' to the command above.
The patch is included below. You can also grab it from
http://rudo.matfyz.cz/dload.php?file=aspect_for_vf_expand-mplayer-1.0pre5.diff
Bye for now.
Rudo.
-------------- next part --------------
diff -urN -X /home/rudo/archiv/dontdiff-mplayer MPlayer-1.0pre5-orig/libmpcodecs/vf_expand.c MPlayer-1.0pre5/libmpcodecs/vf_expand.c
--- MPlayer-1.0pre5-orig/libmpcodecs/vf_expand.c 2003-06-19 20:26:13.000000000 +0200
+++ MPlayer-1.0pre5/libmpcodecs/vf_expand.c 2004-07-27 20:47:39.888729376 +0200
@@ -27,11 +27,13 @@
int exp_w,exp_h;
int exp_x,exp_y;
int osd;
+ float aspect;
unsigned char* fb_ptr;
} vf_priv_dflt = {
-1,-1,
-1,-1,
0,
+ 0.,
NULL
};
@@ -167,11 +169,14 @@
if(vf->priv->exp_h<height) vf->priv->exp_h=height;
#else
if ( vf->priv->exp_w == -1 ) vf->priv->exp_w=width;
- else if (vf->priv->exp_w < -1 ) vf->priv->exp_w=width - vf->priv->exp_w;
- else if ( vf->priv->exp_w<width ) vf->priv->exp_w=width;
+ else if ( vf->priv->exp_w == -2 ) vf->priv->exp_w=vf->priv->exp_h*vf->priv->aspect;
+ else if ( vf->priv->exp_w < -2 ) vf->priv->exp_w=width - vf->priv->exp_w;
+ if ( vf->priv->exp_w<width ) vf->priv->exp_w=width;
+
if ( vf->priv->exp_h == -1 ) vf->priv->exp_h=height;
- else if ( vf->priv->exp_h < -1 ) vf->priv->exp_h=height - vf->priv->exp_h;
- else if( vf->priv->exp_h<height ) vf->priv->exp_h=height;
+ else if ( vf->priv->exp_h == -2 ) vf->priv->exp_h=vf->priv->exp_w/vf->priv->aspect;
+ else if ( vf->priv->exp_h < -2 ) vf->priv->exp_h=height - vf->priv->exp_h;
+ if( vf->priv->exp_h<height ) vf->priv->exp_h=height;
#endif
if(vf->priv->exp_x<0 || vf->priv->exp_x+width>vf->priv->exp_w) vf->priv->exp_x=(vf->priv->exp_w-width)/2;
if(vf->priv->exp_y<0 || vf->priv->exp_y+height>vf->priv->exp_h) vf->priv->exp_y=(vf->priv->exp_h-height)/2;
@@ -341,20 +346,27 @@
vf->priv->exp_w=
vf->priv->exp_h=-1;
vf->priv->osd=0;
+ vf->priv->aspect=0.;
// parse args ->
} // if(!vf->priv)
- if(args) sscanf(args, "%d:%d:%d:%d:%d",
+ if(args) sscanf(args, "%d:%d:%d:%d:%d:%f",
&vf->priv->exp_w,
&vf->priv->exp_h,
&vf->priv->exp_x,
&vf->priv->exp_y,
- &vf->priv->osd);
- mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d (-1=autodetect) osd: %d\n",
+ &vf->priv->osd,
+ &vf->priv->aspect);
+ if ((vf->priv->exp_w == -2 || vf->priv->exp_h == -2) && !(vf->priv->aspect)) {
+ mp_msg(MSGT_VFILTER, MSGL_FATAL, "Expand: h or w is -2, but aspect not set!\n");
+ return 0;
+ }
+ mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d (-1=autodetect) osd: %d aspect: %.4f\n",
vf->priv->exp_w,
vf->priv->exp_h,
vf->priv->exp_x,
vf->priv->exp_y,
- vf->priv->osd);
+ vf->priv->osd,
+ vf->priv->aspect);
return 1;
}
@@ -365,6 +377,7 @@
{"x", ST_OFF(exp_x), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
{"y", ST_OFF(exp_y), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
{"osd", ST_OFF(osd), CONF_TYPE_FLAG, 0 , 0, 1, NULL},
+ {"aspect", ST_OFF(aspect), CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
More information about the MPlayer-users
mailing list