mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 00:02:13 +00:00
Move screen_size_xy to options struct
This commit is contained in:
parent
b14909a955
commit
0a39709c15
@ -229,7 +229,7 @@
|
|||||||
OPT_FLAG_OFF("nozoom", softzoom, 0),
|
OPT_FLAG_OFF("nozoom", softzoom, 0),
|
||||||
{"aspect", &movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.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},
|
{"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("flip", flip, 0, -1, 1),
|
||||||
OPT_FLAG_CONSTANTS("noflip", flip, 0, -1, 0),
|
OPT_FLAG_CONSTANTS("noflip", flip, 0, -1, 0),
|
||||||
|
@ -8,7 +8,6 @@ extern int mp_msg_color;
|
|||||||
extern int mp_msg_module;
|
extern int mp_msg_module;
|
||||||
|
|
||||||
// codec/filter opts: (defined at libmpcodecs/vd.c)
|
// codec/filter opts: (defined at libmpcodecs/vd.c)
|
||||||
extern float screen_size_xy;
|
|
||||||
extern float movie_aspect;
|
extern float movie_aspect;
|
||||||
|
|
||||||
/* defined in codec-cfg.c */
|
/* defined in codec-cfg.c */
|
||||||
|
@ -111,7 +111,6 @@ vd_functions_t* mpcodecs_vd_drivers[] = {
|
|||||||
#include "libvo/video_out.h"
|
#include "libvo/video_out.h"
|
||||||
|
|
||||||
// libvo opts:
|
// libvo opts:
|
||||||
float screen_size_xy=0;
|
|
||||||
float movie_aspect=-1.0;
|
float movie_aspect=-1.0;
|
||||||
int vo_flags=0;
|
int vo_flags=0;
|
||||||
int vd_use_slices=1;
|
int vd_use_slices=1;
|
||||||
@ -260,15 +259,15 @@ csp_again:
|
|||||||
// check source format aspect, calculate prescale ::atmos
|
// check source format aspect, calculate prescale ::atmos
|
||||||
screen_size_x=sh->disp_w;
|
screen_size_x=sh->disp_w;
|
||||||
screen_size_y=sh->disp_h;
|
screen_size_y=sh->disp_h;
|
||||||
if(screen_size_xy>=0.001){
|
if(opts->screen_size_xy>=0.001){
|
||||||
if(screen_size_xy<=8){
|
if(opts->screen_size_xy<=8){
|
||||||
// -xy means x+y scale
|
// -xy means x+y scale
|
||||||
screen_size_x*=screen_size_xy;
|
screen_size_x*=opts->screen_size_xy;
|
||||||
screen_size_y*=screen_size_xy;
|
screen_size_y*=opts->screen_size_xy;
|
||||||
} else {
|
} else {
|
||||||
// -xy means forced width while keeping correct aspect
|
// -xy means forced width while keeping correct aspect
|
||||||
screen_size_x=screen_size_xy;
|
screen_size_x=opts->screen_size_xy;
|
||||||
screen_size_y=screen_size_xy*sh->disp_h/sh->disp_w;
|
screen_size_y=opts->screen_size_xy*sh->disp_h/sh->disp_w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(sh->aspect>0.01){
|
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);
|
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
|
w=(int)((float)screen_size_y*sh->aspect); w+=w%2; // round
|
||||||
// we don't like horizontal downscale || user forced width:
|
// we don't like horizontal downscale || user forced width:
|
||||||
if(w<screen_size_x || screen_size_xy>8){
|
if(w<screen_size_x || opts->screen_size_xy>8){
|
||||||
screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect));
|
screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect));
|
||||||
screen_size_y+=screen_size_y%2; // round
|
screen_size_y+=screen_size_y%2; // round
|
||||||
} else screen_size_x=w; // keep new width
|
} else screen_size_x=w; // keep new width
|
||||||
|
@ -42,8 +42,6 @@ static struct vf_priv_s {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
extern float screen_size_xy;
|
|
||||||
|
|
||||||
//===========================================================================//
|
//===========================================================================//
|
||||||
|
|
||||||
void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam);
|
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
|
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
|
// Compute new d_width and d_height, preserving aspect
|
||||||
// while ensuring that both are >= output size in pixels.
|
// while ensuring that both are >= output size in pixels.
|
||||||
if (vf->priv->h * d_width > vf->priv->w * d_height) {
|
if (vf->priv->h * d_width > vf->priv->w * d_height) {
|
||||||
|
Loading…
Reference in New Issue
Block a user