[MPlayer-dev-eng] [PATCH] -forceaspect option
Oded Shimon
ods15 at ods15.dyndns.org
Fri Jul 1 17:54:02 CEST 2005
On Fri, Jul 01, 2005 at 05:24:55PM +0200, Diego Biurrun wrote:
> On Fri, Jul 01, 2005 at 05:42:35PM +0300, Oded Shimon wrote:
> >
> > --- 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},
>
> I was going to complain that you are messing up indentation here, but
> probably it is indented via random() already...
Yes, I was going to fix it until I realized the same thing. :)
> > --- 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 \
>
> Options need to go in alphabetical order.
Actually, I was trying to put it near -aspect and -noaspect . But now that
I think about it, they don't have that much in common/to do with each
other. Fixed.
BTW, -x and -y are MPlayer specific options, and -xy works also for
MEncoder..
Both work fine with both, and both don't really make sense with MEncoder. I
just think it should be consistent and whatever is decided should be
applied to both...
- 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 15:53:04 -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 15:53:04 -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 15:53:13 -0000
@@ -3188,6 +3188,10 @@
Flip image upside-down.
.
.TP
+.B \-forceaspect
+Force keeping movie aspect ratio even when -x or -y are set, by downscaling.
+.
+.TP
.B \-lavdopts <option1:option2:...> (DEBUG CODE)
Specify libavcodec decoding parameters.
.sp 1
More information about the MPlayer-dev-eng
mailing list