From 0a39709c15890161388e6d32cceea2ff3350aa82 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Thu, 24 Apr 2008 07:28:20 +0300 Subject: [PATCH] Move screen_size_xy to options struct --- cfg-common-opts.h | 2 +- cfg-common.h | 1 - libmpcodecs/vd.c | 15 +++++++-------- libmpcodecs/vf_scale.c | 4 +--- options.h | 1 + 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/cfg-common-opts.h b/cfg-common-opts.h index 05c06e6bbe..0bb61499d8 100644 --- a/cfg-common-opts.h +++ b/cfg-common-opts.h @@ -229,7 +229,7 @@ OPT_FLAG_OFF("nozoom", softzoom, 0), {"aspect", &movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL}, {"noaspect", &movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, NULL}, - {"xy", &screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0.001, 4096, NULL}, + OPT_FLOATRANGE("xy", screen_size_xy, 0, 0.001, 4096), OPT_FLAG_CONSTANTS("flip", flip, 0, -1, 1), OPT_FLAG_CONSTANTS("noflip", flip, 0, -1, 0), diff --git a/cfg-common.h b/cfg-common.h index e5225e2504..bc4fdaa0f6 100644 --- a/cfg-common.h +++ b/cfg-common.h @@ -8,7 +8,6 @@ extern int mp_msg_color; extern int mp_msg_module; // codec/filter opts: (defined at libmpcodecs/vd.c) -extern float screen_size_xy; extern float movie_aspect; /* defined in codec-cfg.c */ diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index b475f848e3..3f25e7642e 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -111,7 +111,6 @@ vd_functions_t* mpcodecs_vd_drivers[] = { #include "libvo/video_out.h" // libvo opts: -float screen_size_xy=0; float movie_aspect=-1.0; int vo_flags=0; int vd_use_slices=1; @@ -260,15 +259,15 @@ csp_again: // check source format aspect, calculate prescale ::atmos screen_size_x=sh->disp_w; screen_size_y=sh->disp_h; - if(screen_size_xy>=0.001){ - if(screen_size_xy<=8){ + if(opts->screen_size_xy>=0.001){ + if(opts->screen_size_xy<=8){ // -xy means x+y scale - screen_size_x*=screen_size_xy; - screen_size_y*=screen_size_xy; + screen_size_x*=opts->screen_size_xy; + screen_size_y*=opts->screen_size_xy; } else { // -xy means forced width while keeping correct aspect - screen_size_x=screen_size_xy; - screen_size_y=screen_size_xy*sh->disp_h/sh->disp_w; + screen_size_x=opts->screen_size_xy; + screen_size_y=opts->screen_size_xy*sh->disp_h/sh->disp_w; } } if(sh->aspect>0.01){ @@ -277,7 +276,7 @@ csp_again: mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ASPECT=%1.4f\n", sh->aspect); w=(int)((float)screen_size_y*sh->aspect); w+=w%2; // round // we don't like horizontal downscale || user forced width: - if(w8){ + if(wscreen_size_xy>8){ screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect)); screen_size_y+=screen_size_y%2; // round } else screen_size_x=w; // keep new width diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index fe8632b2ec..d3ec57769c 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -42,8 +42,6 @@ static struct vf_priv_s { NULL }; -extern float screen_size_xy; - //===========================================================================// void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam); @@ -297,7 +295,7 @@ static int config(struct vf_instance* vf, } if (!opts->screen_size_x && !opts->screen_size_y - && !(screen_size_xy >= 0.001)) { + && !(opts->screen_size_xy >= 0.001)) { // Compute new d_width and d_height, preserving aspect // while ensuring that both are >= output size in pixels. if (vf->priv->h * d_width > vf->priv->w * d_height) { diff --git a/options.h b/options.h index fc470765fa..adcf6da109 100644 --- a/options.h +++ b/options.h @@ -21,6 +21,7 @@ typedef struct MPOpts { int sub_id; float playback_speed; int softzoom; + float screen_size_xy; int flip; struct lavc_param { int workaround_bugs;