1
mirror of https://github.com/mpv-player/mpv synced 2024-07-31 16:29:58 +02:00

Move opt_screen_size_[x|y] to options struct

This commit is contained in:
Uoti Urpala 2008-04-24 07:23:15 +03:00
parent 1351b50ea5
commit b14909a955
8 changed files with 25 additions and 30 deletions

View File

@ -23,9 +23,6 @@ extern float vo_panscanrange;
/* only used at startup (setting these values from configfile) */
extern char *vo_geometry;
extern int opt_screen_size_x;
extern int opt_screen_size_y;
extern char *ao_outputfilename;
extern int ao_pcm_waveheader;
@ -163,8 +160,8 @@ const m_option_t mplayer_opts[]={
#endif
// force window width/height or resolution (with -vm)
{"x", &opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL},
{"y", &opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL},
OPT_INTRANGE("x", screen_size_x, 0, 0, 4096),
OPT_INTRANGE("y", screen_size_y, 0, 0, 4096),
// set screen dimensions (when not detectable or virtual!=visible)
OPT_INTRANGE("screenw", vo_screenwidth, CONF_OLD, 0, 4096),
OPT_INTRANGE("screenh", vo_screenheight, CONF_OLD, 0, 4096),

View File

@ -111,8 +111,6 @@ vd_functions_t* mpcodecs_vd_drivers[] = {
#include "libvo/video_out.h"
// libvo opts:
int opt_screen_size_x=0;
int opt_screen_size_y=0;
float screen_size_xy=0;
float movie_aspect=-1.0;
int vo_flags=0;
@ -249,9 +247,9 @@ csp_again:
else if(sh->stream_aspect!=0.0) sh->aspect = sh->stream_aspect;
// if(!sh->aspect) sh->aspect=1.0;
if(opt_screen_size_x||opt_screen_size_y){
screen_size_x = opt_screen_size_x;
screen_size_y = opt_screen_size_y;
if(opts->screen_size_x||opts->screen_size_y){
screen_size_x = opts->screen_size_x;
screen_size_y = opts->screen_size_y;
if(!opts->vidmode){
if(!screen_size_x) screen_size_x=SCREEN_SIZE_X;
if(!screen_size_y) screen_size_y=SCREEN_SIZE_Y;

View File

@ -29,6 +29,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@ -66,9 +67,6 @@ static const struct vf_priv_s {
unsigned char* dirty_rows;
} vf_priv_dflt;
extern int opt_screen_size_x;
extern int opt_screen_size_y;
extern ass_track_t* ass_track;
extern float sub_delay;
extern int sub_visibility;
@ -77,12 +75,13 @@ static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
struct MPOpts *opts = vf->opts;
if (outfmt == IMGFMT_IF09) return 0;
vf->priv->outh = height + ass_top_margin + ass_bottom_margin;
vf->priv->outw = width;
if(!opt_screen_size_x && !opt_screen_size_y){
if (!opts->screen_size_x && !opts->screen_size_y) {
d_width = d_width * vf->priv->outw / width;
d_height = d_height * vf->priv->outh / height;
}

View File

@ -5,6 +5,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@ -21,14 +22,12 @@ static const struct vf_priv_s {
-1,-1
};
extern int opt_screen_size_x;
extern int opt_screen_size_y;
//===========================================================================//
static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
struct MPOpts *opts = vf->opts;
// calculate the missing parameters:
if(vf->priv->crop_w<=0 || vf->priv->crop_w>width) vf->priv->crop_w=width;
if(vf->priv->crop_h<=0 || vf->priv->crop_h>height) vf->priv->crop_h=height;
@ -61,7 +60,7 @@ static int config(struct vf_instance* vf,
mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_CropBadPositionWidthHeight);
return 0;
}
if(!opt_screen_size_x && !opt_screen_size_y){
if(!opts->screen_size_x && !opts->screen_size_y){
d_width=d_width*vf->priv->crop_w/width;
d_height=d_height*vf->priv->crop_h/height;
}

View File

@ -7,6 +7,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@ -44,9 +45,6 @@ static struct vf_priv_s {
0
};
extern int opt_screen_size_x;
extern int opt_screen_size_y;
//===========================================================================//
#ifdef OSD_SUPPORT
@ -189,7 +187,9 @@ static void draw_osd(struct vf_instance* vf_,int w,int h){
static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
unsigned int flags, unsigned int outfmt)
{
struct MPOpts *opts = vf->opts;
if(outfmt == IMGFMT_MPEGPES) {
vf->priv->passthrough = 1;
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
@ -225,7 +225,7 @@ static int config(struct vf_instance* vf,
if(vf->priv->exp_y<0 || vf->priv->exp_y+height>vf->priv->exp_h) vf->priv->exp_y=(vf->priv->exp_h-height)/2;
vf->priv->fb_ptr=NULL;
if(!opt_screen_size_x && !opt_screen_size_y){
if(!opts->screen_size_x && !opts->screen_size_y){
d_width=d_width*vf->priv->exp_w/width;
d_height=d_height*vf->priv->exp_h/height;
}

View File

@ -6,6 +6,7 @@
#include "config.h"
#include "mp_msg.h"
#include "cpudetect.h"
#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@ -79,9 +80,6 @@ struct vf_priv_s {
static const struct frame_stats ppzs = {PPZ,PPZ,PPZ,PPZ,PPZ,PPZ,PPZ,0,0,9999};
static const struct frame_stats pprs = {PPR,PPR,PPR,PPR,PPR,PPR,PPR,0,0,9999};
extern int opt_screen_size_x;
extern int opt_screen_size_y;
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
@ -1337,6 +1335,7 @@ static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
struct MPOpts *opts = vf->opts;
unsigned long cxm = 0;
unsigned long cym = 0;
struct vf_priv_s *p = vf->priv;
@ -1371,7 +1370,7 @@ static int config(struct vf_instance* vf,
if (p->crop_x + p->w > width ) p->crop_x = 0;
if (p->crop_y + p->h > height) p->crop_y = 0;
if(!opt_screen_size_x && !opt_screen_size_y){
if(!opts->screen_size_x && !opts->screen_size_y){
d_width = d_width * p->w/width;
d_height = d_height * p->h/height;
}

View File

@ -6,6 +6,7 @@
#include "config.h"
#include "mp_msg.h"
#include "cpudetect.h"
#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@ -41,8 +42,6 @@ static struct vf_priv_s {
NULL
};
extern int opt_screen_size_x;
extern int opt_screen_size_y;
extern float screen_size_xy;
//===========================================================================//
@ -112,6 +111,7 @@ static unsigned int find_best_out(vf_instance_t *vf){
static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
struct MPOpts *opts = vf->opts;
unsigned int best=find_best_out(vf);
int vo_flags;
int int_sws_flags=0;
@ -296,7 +296,8 @@ static int config(struct vf_instance* vf,
break; }
}
if(!opt_screen_size_x && !opt_screen_size_y && !(screen_size_xy >= 0.001)){
if (!opts->screen_size_x && !opts->screen_size_y
&& !(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) {

View File

@ -6,6 +6,8 @@ typedef struct MPOpts {
char **audio_driver_list;
int fixed_vo;
int vo_ontop;
int screen_size_x;
int screen_size_y;
int vo_screenwidth;
int vo_screenheight;
int vidmode;