summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-24 07:23:15 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-25 03:34:27 +0300
commitb14909a955259c3b9c3494a5096ceed81397926c (patch)
treef40a07013cfadad52aca1847038370345582b062
parent1351b50ea5e12d0b316c0670a525f1a75be3100b (diff)
downloadmpv-b14909a955259c3b9c3494a5096ceed81397926c.tar.bz2
mpv-b14909a955259c3b9c3494a5096ceed81397926c.tar.xz
Move opt_screen_size_[x|y] to options struct
-rw-r--r--cfg-mplayer.h7
-rw-r--r--libmpcodecs/vd.c8
-rw-r--r--libmpcodecs/vf_ass.c7
-rw-r--r--libmpcodecs/vf_crop.c7
-rw-r--r--libmpcodecs/vf_expand.c10
-rw-r--r--libmpcodecs/vf_filmdint.c7
-rw-r--r--libmpcodecs/vf_scale.c7
-rw-r--r--options.h2
8 files changed, 25 insertions, 30 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 1d20fe1fd7..e0b44205d3 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -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),
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index 528b150c1a..b475f848e3 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -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;
diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c
index 1790782111..e4a82741b9 100644
--- a/libmpcodecs/vf_ass.c
+++ b/libmpcodecs/vf_ass.c
@@ -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;
}
diff --git a/libmpcodecs/vf_crop.c b/libmpcodecs/vf_crop.c
index 865ecf8d6a..ca14927956 100644
--- a/libmpcodecs/vf_crop.c
+++ b/libmpcodecs/vf_crop.c
@@ -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;
}
diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c
index 4b46f04e23..d775961eec 100644
--- a/libmpcodecs/vf_expand.c
+++ b/libmpcodecs/vf_expand.c
@@ -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;
}
diff --git a/libmpcodecs/vf_filmdint.c b/libmpcodecs/vf_filmdint.c
index 0b98e22f15..f479569536 100644
--- a/libmpcodecs/vf_filmdint.c
+++ b/libmpcodecs/vf_filmdint.c
@@ -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;
}
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index 38e75d8843..fe8632b2ec 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -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) {
diff --git a/options.h b/options.h
index 3369948080..fc470765fa 100644
--- a/options.h
+++ b/options.h
@@ -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;