[MPlayer-dev-eng] [PATCH] -forceaspect option
Oded Shimon
ods15 at ods15.dyndns.org
Fri Jul 1 16:42:35 CEST 2005
On Fri, Jul 01, 2005 at 05:41:32PM +0300, Oded Shimon wrote:
> This is handy for me, because I use -vo sdl:fbdev, (stop telling me to not
> use SDL, buy me a better graphics card...) and for that I use -xy 800. but
> for some videos it ends up 800x650 or whatever, which causes MPlayer to
> crash (and occassionally lock up my terminal...). With this, I can use:
> -x 800 -y 600 -forceaspect
.. oops, forgot to attach.
- ods15
-------------- next part --------------
Index: libmpcodecs/vd.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd.c,v
retrieving revision 1.83
diff -u -r1.83 vd.c
--- libmpcodecs/vd.c 18 Apr 2005 15:52:37 -0000 1.83
+++ libmpcodecs/vd.c 1 Jul 2005 14:33:28 -0000
@@ -123,6 +123,7 @@
int opt_screen_size_y=0;
float screen_size_xy=0;
float movie_aspect=-1.0;
+int force_aspect=0;
int vo_flags=0;
int vd_use_slices=1;
@@ -300,6 +301,16 @@
mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MovieAspectUndefined);
}
}
+ if (force_aspect) {
+ float aspect = sh->aspect;
+ int w,h;
+ if (aspect < 0.01) aspect = (float)sh->disp_w/sh->disp_h;
+ mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MovieAspectIsSet,aspect);
+ w = (int)((float)screen_size_y * aspect); w += w%2; // round
+ h = (int)((float)screen_size_x / aspect); h += h%2; // round
+ if (screen_size_x > w) screen_size_x = w;
+ else screen_size_y = h;
+ }
vocfg_flags = (fullscreen ? VOFLAG_FULLSCREEN:0)
| (vidmode ? VOFLAG_MODESWITCHING:0)
Index: cfg-common.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-common.h,v
retrieving revision 1.145
diff -u -r1.145 cfg-common.h
--- cfg-common.h 13 May 2005 14:45:28 -0000 1.145
+++ cfg-common.h 1 Jul 2005 14:33:29 -0000
@@ -199,6 +199,8 @@
{"nozoom", &softzoom, CONF_TYPE_FLAG, 0, 1, 0, NULL},
{"aspect", &movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL},
{"noaspect", &movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, NULL},
+ {"forceaspect", &force_aspect, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+ {"noforceaspect", &force_aspect, CONF_TYPE_FLAG, 0, 1, 0, NULL},
{"xy", &screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0.001, 4096, NULL},
{"flip", &flip, CONF_TYPE_FLAG, 0, -1, 1, NULL},
@@ -302,6 +304,7 @@
extern int flip;
extern int vd_use_slices;
extern int divx_quality;
+extern int force_aspect;
/* defined in codec-cfg.c */
extern char * codecs_file;
Index: DOCS/man/en/mplayer.1
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v
retrieving revision 1.1022
diff -u -r1.1022 mplayer.1
--- DOCS/man/en/mplayer.1 20 Jun 2005 18:28:46 -0000 1.1022
+++ DOCS/man/en/mplayer.1 1 Jul 2005 14:33:37 -0000
@@ -3184,6 +3184,10 @@
Disable automatic movie aspect ratio compensation.
.
.TP
+.B \-forceaspect
+Force keeping movie aspect ratio even when -x or -y are set, by downscaling.
+.
+.TP
.B \-flip \
Flip image upside-down.
.
More information about the MPlayer-dev-eng
mailing list