[MPlayer-dev-eng] [PATCH 3/3] Provide some useful default for -vf expand
Petr Baudis
pasky at ucw.cz
Wed May 24 02:58:35 CEST 2006
Now, if -vf expand is passed no arguments, it does not expand at all,
while (quite possibly the most) frequently when you want to expand it's
to the fullscreen so that when playing a wide-angle movie the subtitles
appear outside the movie viewport (or for other reasons, like with
cvidix so that no annoying text discards you).
This patch will make -vf expand default to expanding the output viewport
height to make the viewport dimensions 4:3, which covers the sane
resolutions. With parameters or without -vf expand passed at all the
behaviour is same and with -vf expand passed nothing would happen before
which does not make much sense.
The patch comes from MOJE.
---
DOCS/man/en/mplayer.1 | 3 +++
libmpcodecs/vf_expand.c | 5 +++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index bff4c29..d2507d8 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -4657,6 +4657,9 @@ top left corner position (default: -1, u
Expands (not scales) movie resolution to the given value and places the
unscaled original at coordinates x, y.
Can be used for placing subtitles/\:OSD in the resulting black bands.
+If no values are given, it defaults to expanding the resolution to the
+4:3 ratio and placing the original in the middle (that should give
+a reasonable default for wide-angle videos).
.RSs
.IPs <w>,<h>
Expanded width,height (default: original width,height).
diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c
index 605ee5d..a64fbed 100644
--- a/libmpcodecs/vf_expand.c
+++ b/libmpcodecs/vf_expand.c
@@ -172,6 +172,11 @@ static int config(struct vf_instance_s*
unsigned int flags, unsigned int outfmt){
if (outfmt == IMGFMT_IF09) return 0;
// calculate the missing parameters:
+ if (vf->priv->exp_h == -1 && vf->priv->exp_w == -1 &&
+ vf->priv->exp_x == -1 && vf->priv->exp_y == -1) {
+ vf->priv->exp_h = -(width * 3 / 4 - height);
+ vf->priv->exp_y = -(vf->priv->exp_h / 2);
+ }
#if 0
if(vf->priv->exp_w<width) vf->priv->exp_w=width;
if(vf->priv->exp_h<height) vf->priv->exp_h=height;
More information about the MPlayer-dev-eng
mailing list