summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2013-03-04 17:40:21 +0100
committerAlexander Preisinger <alexander.preisinger@gmail.com>2013-03-04 17:40:21 +0100
commit7686cd7f043ef5b42ade64db21ec01c8c8d6281e (patch)
treeb8f2f3b73e2a7e19e6e999aa6ece03b381c87d14
parentdc226bb846f037e992ae4a9fa12aa2196e804e6d (diff)
downloadmpv-7686cd7f043ef5b42ade64db21ec01c8c8d6281e.tar.bz2
mpv-7686cd7f043ef5b42ade64db21ec01c8c8d6281e.tar.xz
vo: remove and cleanup globals
Removes almost every global variabel in vo.h and puts them in a special struct in MPOpts for video output related options. Also we completly remove the options/globals pts and refresh rate because they were unused.
-rw-r--r--core/cfg-mplayer.h67
-rw-r--r--core/command.c40
-rw-r--r--core/defaultopts.c36
-rw-r--r--core/m_option.h3
-rw-r--r--core/mplayer.c5
-rw-r--r--core/options.h73
-rw-r--r--sub/sub.c2
-rw-r--r--video/decode/vd.c20
-rw-r--r--video/out/aspect.c18
-rw-r--r--video/out/cocoa_common.m51
-rw-r--r--video/out/vo.c40
-rw-r--r--video/out/vo.h27
-rw-r--r--video/out/vo_caca.c4
-rw-r--r--video/out/vo_corevideo.m4
-rw-r--r--video/out/vo_opengl.c2
-rw-r--r--video/out/vo_opengl_old.c8
-rw-r--r--video/out/vo_sdl.c28
-rw-r--r--video/out/vo_vdpau.c5
-rw-r--r--video/out/vo_x11.c10
-rw-r--r--video/out/vo_xv.c8
-rw-r--r--video/out/w32_common.c91
-rw-r--r--video/out/wayland_common.c26
-rw-r--r--video/out/x11_common.c168
23 files changed, 375 insertions, 361 deletions
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h
index 651ec61a77..32058e92b6 100644
--- a/core/cfg-mplayer.h
+++ b/core/cfg-mplayer.h
@@ -529,8 +529,8 @@ const m_option_t mplayer_opts[]={
OPT_STRINGLIST("vo", video_driver_list, 0),
OPT_STRINGLIST("ao", audio_driver_list, 0),
OPT_FLAG("fixed-vo", fixed_vo, CONF_GLOBAL),
- OPT_FLAG("ontop", vo_ontop, 0),
- {"border", &vo_border, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+ OPT_FLAG("ontop", vo.ontop, 0),
+ OPT_FLAG("border", vo.border, 1),
OPT_STRING("mixer", mixer_device, 0),
OPT_STRING("mixer-channel", mixer_channel, 0),
@@ -550,30 +550,30 @@ const m_option_t mplayer_opts[]={
OPT_INT("abs", ao_buffersize, 0),
// set screen dimensions (when not detectable or virtual!=visible)
- OPT_INTRANGE("screenw", vo_screenwidth, CONF_GLOBAL, 0, 4096),
- OPT_INTRANGE("screenh", vo_screenheight, CONF_GLOBAL, 0, 4096),
- OPT_GEOMETRY("geometry", vo_geometry, 0),
- OPT_SIZE_BOX("autofit", vo_autofit, 0),
- OPT_SIZE_BOX("autofit-larger", vo_autofit_larger, 0),
- OPT_FLAG("force-window-position", force_window_position, 0),
+ OPT_INTRANGE("screenw", vo.screenwidth, CONF_GLOBAL, 0, 4096),
+ OPT_INTRANGE("screenh", vo.screenheight, CONF_GLOBAL, 0, 4096),
+ OPT_GEOMETRY("geometry", vo.geometry, 0),
+ OPT_SIZE_BOX("autofit", vo.autofit, 0),
+ OPT_SIZE_BOX("autofit-larger", vo.autofit_larger, 0),
+ OPT_FLAG("force-window-position", vo.force_window_position, 0),
// vo name (X classname) and window title strings
- OPT_STRING("name", vo_winname, 0),
- OPT_STRING("title", vo_wintitle, 0),
+ OPT_STRING("name", vo.winname, 0),
+ OPT_STRING("title", wintitle, 0),
// set aspect ratio of monitor - useful for 16:9 TV-out
- OPT_FLOATRANGE("monitoraspect", force_monitor_aspect, 0, 0.0, 9.0),
- OPT_FLOATRANGE("monitorpixelaspect", monitor_pixel_aspect, 0, 0.2, 9.0),
+ OPT_FLOATRANGE("monitoraspect", vo.force_monitor_aspect, 0, 0.0, 9.0),
+ OPT_FLOATRANGE("monitorpixelaspect", vo.monitor_pixel_aspect, 0, 0.2, 9.0),
// start in fullscreen mode:
OPT_FLAG("fullscreen", fullscreen, 0),
OPT_FLAG("fs", fullscreen, 0),
// set fullscreen switch method (workaround for buggy WMs)
- {"fsmode-dontuse", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
- {"colorkey", &vo_colorkey, CONF_TYPE_INT, 0, 0, 0, NULL},
- {"no-colorkey", &vo_colorkey, CONF_TYPE_STORE, 0, 0, 0x1000000, NULL},
+ OPT_INTRANGE("fsmode-dontuse", vo.fsmode, 0, 31, 4096),
+ OPT_INT("colorkey", vo.colorkey, 0),
+ OPT_INT("no-colorkey", vo.colorkey, 0x1000000),
// wait for v-sync (gl)
- {"vsync", &vo_vsync, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"panscan", &vo_panscan, CONF_TYPE_FLOAT, CONF_RANGE, 0, 1.0, NULL},
- OPT_FLOATRANGE("panscanrange", vo_panscanrange, 0, -19.0, 99.0),
- OPT_FLAG("force-rgba-osd-rendering", vo_force_rgba_osd, 0),
+ OPT_FLAG("vsync", vo.vsync, 1),
+ OPT_FLOATRANGE("panscan", vo.panscan, 0, 1.0, 99.0),
+ OPT_FLOATRANGE("panscanrange", vo.panscanrange, 0, -19.0, 99.0),
+ OPT_FLAG("force-rgba-osd-rendering", force_rgba_osd, 0),
OPT_CHOICE("colormatrix", requested_colorspace, 0,
({"auto", MP_CSP_AUTO},
{"BT.601", MP_CSP_BT_601},
@@ -588,30 +588,29 @@ const m_option_t mplayer_opts[]={
{"limited", MP_CSP_LEVELS_TV},
{"full", MP_CSP_LEVELS_PC})),
- OPT_CHOICE_OR_INT("cursor-autohide", cursor_autohide_delay, 0,
+ OPT_CHOICE_OR_INT("cursor-autohide", vo.cursor_autohide_delay, 0,
0, 30000, ({"no", -1}, {"always", -2})),
- {"refreshrate",&vo_refresh_rate,CONF_TYPE_INT,CONF_RANGE, 0,100, NULL},
- {"wid", &WinID, CONF_TYPE_INT64, 0, 0, 0, NULL},
+ OPT_INT64("wid", vo.WinID, -1),
#ifdef CONFIG_X11
- OPT_FLAG("stop-xscreensaver", vo_stop_screensaver, 0),
- OPT_STRINGLIST("fstype", vo_fstype_list, 0),
+ OPT_FLAG("stop-xscreensaver", vo.stop_screensaver, 0),
+ OPT_STRINGLIST("fstype", vo.fstype_list, 0),
#endif
{"heartbeat-cmd", &heartbeat_cmd, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"mouseinput", &vo_nomouse_input, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ OPT_FLAG("mouseinput", vo.nomouse_input, 0),
- OPT_CHOICE_OR_INT("screen", vo_screen_id, 0, 0, 32,
+ OPT_CHOICE_OR_INT("screen", vo.screen_id, 0, 0, 32,
({"default", -1})),
- OPT_CHOICE_OR_INT("fs-screen", vo_fsscreen_id, 0, 0, 32,
+ OPT_CHOICE_OR_INT("fs-screen", vo.fsscreen_id, 0, 0, 32,
({"all", -2}, {"current", -1})),
- OPT_INTRANGE("brightness", vo_gamma_brightness, 0, -100, 100),
- OPT_INTRANGE("saturation", vo_gamma_saturation, 0, -100, 100),
- OPT_INTRANGE("contrast", vo_gamma_contrast, 0, -100, 100),
- OPT_INTRANGE("hue", vo_gamma_hue, 0, -100, 100),
- OPT_INTRANGE("gamma", vo_gamma_gamma, 0, -100, 100),
- {"keepaspect", &vo_keepaspect, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+ OPT_INTRANGE("brightness", gamma_brightness, 0, -100, 100),
+ OPT_INTRANGE("saturation", gamma_saturation, 0, -100, 100),
+ OPT_INTRANGE("contrast", gamma_contrast, 0, -100, 100),
+ OPT_INTRANGE("hue", gamma_hue, 0, -100, 100),
+ OPT_INTRANGE("gamma", gamma_gamma, 0, -100, 100),
+ OPT_FLAG("keepaspect", vo.keepaspect, 1),
//---------------------- mplayer-only options ------------------------
@@ -676,7 +675,7 @@ const m_option_t mplayer_opts[]={
OPT_FLAG("idle", player_idle_mode, CONF_GLOBAL),
OPT_INTRANGE("key-fifo-size", input.key_fifo_size, CONF_GLOBAL, 2, 65000),
OPT_FLAG("consolecontrols", consolecontrols, CONF_GLOBAL),
- {"mouse-movements", &enable_mouse_movements, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
+ OPT_FLAG("mouse-movements", vo.enable_mouse_movements, 1),
OPT_INTRANGE("doubleclick-time", doubleclick_time, 0, 0, 1000),
#ifdef CONFIG_TV
{"tvscan", (void *) tvscan_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
diff --git a/core/command.c b/core/command.c
index 1fe6937e6b..271db5b117 100644
--- a/core/command.c
+++ b/core/command.c
@@ -85,13 +85,13 @@ static void rescale_input_coordinates(struct MPContext *mpctx, int ix, int iy,
struct MPOpts *opts = &mpctx->opts;
struct vo *vo = mpctx->video_out;
//remove the borders, if any, and rescale to the range [0,1],[0,1]
- if (vo_fs) { //we are in full-screen mode
- if (opts->vo_screenwidth > vo->dwidth)
+ if (opts->vo.fs) { //we are in full-screen mode
+ if (opts->vo.screenwidth > vo->dwidth)
// there are borders along the x axis
- ix -= (opts->vo_screenwidth - vo->dwidth) / 2;
- if (opts->vo_screenheight > vo->dheight)
+ ix -= (opts->vo.screenwidth - vo->dwidth) / 2;
+ if (opts->vo.screenheight > vo->dheight)
// there are borders along the y axis (usual way)
- iy -= (opts->vo_screenheight - vo->dheight) / 2;
+ iy -= (opts->vo.screenheight - vo->dheight) / 2;
if (ix < 0 || ix > vo->dwidth) {
*dx = *dy = -1.0;
@@ -108,8 +108,8 @@ static void rescale_input_coordinates(struct MPContext *mpctx, int ix, int iy,
mp_msg(MSGT_CPLAYER, MSGL_V,
"\r\nrescaled coordinates: %.3f, %.3f, screen (%d x %d), vodisplay: (%d, %d), fullscreen: %d\r\n",
- *dx, *dy, opts->vo_screenwidth, opts->vo_screenheight, vo->dwidth,
- vo->dheight, vo_fs);
+ *dx, *dy, opts->vo.screenwidth, opts->vo.screenheight, vo->dwidth,
+ vo->dheight, opts->vo.fs);
}
// Property-option bridge.
@@ -845,19 +845,21 @@ static int mp_property_program(m_option_t *prop, int action, void *arg,
/// Fullscreen state (RW)
-static int mp_property_fullscreen(m_option_t *prop, int action, void *arg,
+static int mp_property_fullscreen(m_option_t *prop,
+ int action,
+ void *arg,
MPContext *mpctx)
{
-
+ struct MPOpts *opts = mpctx->video_out->opts;
if (!mpctx->video_out)
return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_SET) {
- if (vo_fs == !!*(int *) arg)
+ if (opts->vo.fs == !!*(int *) arg)
return M_PROPERTY_OK;
if (mpctx->video_out->config_ok)
vo_control(mpctx->video_out, VOCTRL_FULLSCREEN, 0);
- mpctx->opts.fullscreen = vo_fs;
+ mpctx->opts.fullscreen = opts->vo.fs;
return M_PROPERTY_OK;
}
return mp_property_generic_option(prop, action, arg, mpctx);
@@ -1022,7 +1024,7 @@ static int mp_property_ontop(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
return mp_property_vo_flag(prop, action, arg, VOCTRL_ONTOP,
- &mpctx->opts.vo_ontop, mpctx);
+ &mpctx->opts.vo.ontop, mpctx);
}
/// Show window borders (RW)
@@ -1030,11 +1032,11 @@ static int mp_property_border(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
return mp_property_vo_flag(prop, action, arg, VOCTRL_BORDER,
- &vo_border, mpctx);
+ &mpctx->opts.vo.border, mpctx);
}
static int mp_property_framedrop(m_option_t *prop, int action,
- void *arg, MPContext *mpctx)
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -1383,15 +1385,15 @@ static const m_option_t mp_properties[] = {
M_OPTION_PROPERTY_CUSTOM("border", mp_property_border),
M_OPTION_PROPERTY_CUSTOM("framedrop", mp_property_framedrop),
M_OPTION_PROPERTY_CUSTOM_("gamma", mp_property_gamma,
- .offset = offsetof(struct MPOpts, vo_gamma_gamma)),
+ .offset = offsetof(struct MPOpts, gamma_gamma)),
M_OPTION_PROPERTY_CUSTOM_("brightness", mp_property_gamma,
- .offset = offsetof(struct MPOpts, vo_gamma_brightness)),
+ .offset = offsetof(struct MPOpts, gamma_brightness)),
M_OPTION_PROPERTY_CUSTOM_("contrast", mp_property_gamma,
- .offset = offsetof(struct MPOpts, vo_gamma_contrast)),
+ .offset = offsetof(struct MPOpts, gamma_contrast)),
M_OPTION_PROPERTY_CUSTOM_("saturation", mp_property_gamma,
- .offset = offsetof(struct MPOpts, vo_gamma_saturation)),
+ .offset = offsetof(struct MPOpts, gamma_saturation)),
M_OPTION_PROPERTY_CUSTOM_("hue", mp_property_gamma,
- .offset = offsetof(struct MPOpts, vo_gamma_hue)),
+ .offset = offsetof(struct MPOpts, gamma_hue)),
M_OPTION_PROPERTY_CUSTOM("panscan", mp_property_panscan),
M_OPTION_PROPERTY_CUSTOM_("vsync", mp_property_vsync),
{ "video-format", mp_property_video_format, CONF_TYPE_STRING,
diff --git a/core/defaultopts.c b/core/defaultopts.c
index a3c315b186..b551f05da1 100644
--- a/core/defaultopts.c
+++ b/core/defaultopts.c
@@ -18,18 +18,30 @@ void set_default_mplayer_options(struct MPOpts *opts)
.mixer_init_volume = -1,
.mixer_init_mute = -1,
.ao_buffersize = -1,
- .vo_wintitle = "mpv - ${media-title}",
- .monitor_pixel_aspect = 1.0,
- .vo_panscanrange = 1.0,
- .cursor_autohide_delay = 1000,
- .vo_screen_id = -1,
- .vo_fsscreen_id = -1,
- .vo_gamma_gamma = 1000,
- .vo_gamma_brightness = 1000,
- .vo_gamma_contrast = 1000,
- .vo_gamma_saturation = 1000,
- .vo_gamma_hue = 1000,
- .vo_stop_screensaver = 1,
+ .vo = {
+ .cursor_autohide_delay = 1000,
+ .monitor_pixel_aspect = 1.0,
+ .panscanrange = 1.0,
+ .fs = false,
+ .screen_id = -1,
+ .fsscreen_id = -1,
+ .vsync = 1,
+ .stop_screensaver = 1,
+ .nomouse_input = 0,
+ .fsmode = 0,
+ .panscan = 0.0f,
+ .keepaspect = 1,
+ .border = 1,
+ .colorkey = 0x0000ff00, // default colorkey is green
+ // (0xff000000 means that colorkey has been disabled)
+ .WinID = -1,
+ },
+ .wintitle = "mpv - ${media-title}",
+ .gamma_gamma = 1000,
+ .gamma_brightness = 1000,
+ .gamma_contrast = 1000,
+ .gamma_saturation = 1000,
+ .gamma_hue = 1000,
.osd_level = 1,
.osd_duration = 1000,
.loop_times = -1,
diff --git a/core/m_option.h b/core/m_option.h
index d06e189449..ef2df4e12c 100644
--- a/core/m_option.h
+++ b/core/m_option.h
@@ -544,6 +544,9 @@ static inline void m_option_free(const m_option_t *opt, void *dst)
#define OPT_INT(...) \
OPT_GENERAL(int, __VA_ARGS__, .type = &m_option_type_int)
+#define OPT_INT64(...) \
+ OPT_GENERAL(int64_t, __VA_ARGS__, .type = &m_option_type_int64)
+
#define OPT_RANGE_(ctype, optname, varname, flags, minval, maxval, ...) \
OPT_GENERAL(ctype, optname, varname, (flags) | CONF_RANGE, \
.min = minval, .max = maxval, __VA_ARGS__)
diff --git a/core/mplayer.c b/core/mplayer.c
index a4c9c09960..b56415151d 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -2309,7 +2309,7 @@ static void vo_update_window_title(struct MPContext *mpctx)
{
if (!mpctx->video_out)
return;
- char *title = mp_property_expand_string(mpctx, mpctx->opts.vo_wintitle);
+ char *title = mp_property_expand_string(mpctx, mpctx->opts.wintitle);
talloc_free(mpctx->video_out->window_title);
mpctx->video_out->window_title = talloc_steal(mpctx, title);
}
@@ -3215,7 +3215,6 @@ static void run_playloop(struct MPContext *mpctx)
double buffered_audio = -1;
while (mpctx->sh_video) { // never loops, for "break;" only
struct vo *vo = mpctx->video_out;
- vo_pts = mpctx->sh_video->timer * 90000.0;
vo_fps = mpctx->sh_video->fps;
video_left = vo->hasframe || vo->frame_loaded;
@@ -4262,7 +4261,7 @@ static bool handle_help_options(struct MPContext *mpctx)
opt_exit = 1;
}
#ifdef CONFIG_X11
- if (opts->vo_fstype_list && strcmp(opts->vo_fstype_list[0], "help") == 0) {
+ if (opts->vo.fstype_list && strcmp(opts->vo.fstype_list[0], "help") == 0) {
fstype_help();
mp_msg(MSGT_FIXME, MSGL_FIXME, "\n");
opt_exit = 1;
diff --git a/core/options.h b/core/options.h
index a5f4c4023b..c9517f0ead 100644
--- a/core/options.h
+++ b/core/options.h
@@ -1,13 +1,13 @@
#ifndef MPLAYER_OPTIONS_H
#define MPLAYER_OPTIONS_H
+#include <stdbool.h>
#include "core/m_option.h"
typedef struct MPOpts {
char **video_driver_list;
char **audio_driver_list;
int fixed_vo;
- int vo_ontop;
char *mixer_device;
char *mixer_channel;
int softvol;
@@ -16,38 +16,61 @@ typedef struct MPOpts {
float softvol_max;
int gapless_audio;
int ao_buffersize;
- int vo_screenwidth;
- int vo_screenheight;
- int vo_screen_id;
- int vo_fsscreen_id;
- struct m_geometry vo_geometry;
- struct m_geometry vo_autofit;
- struct m_geometry vo_autofit_larger;
- int force_window_position;
- char *vo_winname;
- char *vo_wintitle;
- float force_monitor_aspect;
- float monitor_pixel_aspect;
+
+ struct output_conf {
+ int screenwidth;
+ int screenheight;
+ int ontop;
+ bool fs;
+ int vsync;
+ int screen_id;
+ int fsscreen_id;
+ int stop_screensaver;
+ char *winname;
+ char** fstype_list;
+
+ float panscan;
+ float panscanrange;
+
+ struct m_geometry geometry;
+ struct m_geometry autofit;
+ struct m_geometry autofit_larger;
+
+ int fsmode;
+ int keepaspect;
+ int border;
+
+ int colorkey;
+
+ int nomouse_input;
+ int enable_mouse_movements;
+ int cursor_autohide_delay;
+
+ int64_t WinID;
+
+ float force_monitor_aspect;
+ float monitor_pixel_aspect;
+ int force_window_position;
+ } vo;
+
+ char *wintitle;
+ int force_rgba_osd;
+
+ // ranges -100 - 100, 1000 if the vo default should be used
+ int gamma_gamma;
+ int gamma_brightness;
+ int gamma_contrast;
+ int gamma_saturation;
+ int gamma_hue;
+
int fullscreen;
- float vo_panscanrange;
- int vo_force_rgba_osd;
int requested_colorspace;
int requested_input_range;
int requested_output_range;
- int cursor_autohide_delay;
- char** vo_fstype_list;
- int vo_stop_screensaver;
char *audio_decoders;
char *video_decoders;
- // ranges -100 - 100, 1000 if the vo default should be used
- int vo_gamma_gamma;
- int vo_gamma_brightness;
- int vo_gamma_contrast;
- int vo_gamma_saturation;
- int vo_gamma_hue;
-
int osd_level;
int osd_duration;
int osd_fractions;
diff --git a/sub/sub.c b/sub/sub.c
index 2f51b7a8a5..b0c9e22d7a 100644
--- a/sub/sub.c
+++ b/sub/sub.c
@@ -158,7 +158,7 @@ static void render_object(struct osd_state *osd, struct osd_object *obj,
bool formats[SUBBITMAP_COUNT];
memcpy(formats, sub_formats, sizeof(formats));
- if (opts->vo_force_rgba_osd)
+ if (opts->force_rgba_osd)
formats[SUBBITMAP_LIBASS] = false;
*out_imgs = (struct sub_bitmaps) {0};
diff --git a/video/decode/vd.c b/video/decode/vd.c
index b43570f0ad..0ca685e2bb 100644
--- a/video/decode/vd.c
+++ b/video/decode/vd.c
@@ -169,16 +169,16 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int out_fmt)
set_video_colorspace(sh);
- if (opts->vo_gamma_gamma != 1000)
- set_video_colors(sh, "gamma", opts->vo_gamma_gamma);
- if (opts->vo_gamma_brightness != 1000)
- set_video_colors(sh, "brightness", opts->vo_gamma_brightness);
- if (opts->vo_gamma_contrast != 1000)
- set_video_colors(sh, "contrast", opts->vo_gamma_contrast);
- if (opts->vo_gamma_saturation != 1000)
- set_video_colors(sh, "saturation", opts->vo_gamma_saturation);
- if (opts->vo_gamma_hue != 1000)
- set_video_colors(sh, "hue", opts->vo_gamma_hue);
+ if (opts->gamma_gamma != 1000)
+ set_video_colors(sh, "gamma", opts->gamma_gamma);
+ if (opts->gamma_brightness != 1000)
+ set_video_colors(sh, "brightness", opts->gamma_brightness);
+ if (opts->gamma_contrast != 1000)
+ set_video_colors(sh, "contrast", opts->gamma_contrast);
+ if (opts->gamma_saturation != 1000)
+ set_video_colors(sh, "saturation", opts->gamma_saturation);
+ if (opts->gamma_hue != 1000)
+ set_video_colors(sh, "hue", opts->gamma_hue);
return 1;
}
diff --git a/video/out/aspect.c b/video/out/aspect.c
index 05e40a73e9..e7ca37a82d 100644
--- a/video/out/aspect.c
+++ b/video/out/aspect.c
@@ -45,10 +45,10 @@ void aspect_save_screenres(struct vo *vo, int scrw, int scrh)
scrw = (scrh * 4 + 2) / 3;
vo->aspdat.scrw = scrw;
vo->aspdat.scrh = scrh;
- if (opts->force_monitor_aspect)
- vo->monitor_par = opts->force_monitor_aspect * scrh / scrw;
+ if (opts->vo.force_monitor_aspect)
+ vo->monitor_par = opts->vo.force_monitor_aspect * scrh / scrw;
else
- vo->monitor_par = 1.0 / opts->monitor_pixel_aspect;
+ vo->monitor_par = 1.0 / opts->vo.monitor_pixel_aspect;
}
/* aspect is called with the source resolution and the
@@ -88,7 +88,7 @@ static void get_max_dims(struct vo *vo, int *w, int *h, int zoom)
struct aspect_data *aspdat = &vo->aspdat;
*w = zoom ? aspdat->scrw : aspdat->prew;
*h = zoom ? aspdat->scrh : aspdat->preh;
- if (zoom && WinID >= 0)
+ if (zoom && vo->opts->vo.WinID >= 0)
zoom = A_WINZOOM;
if (zoom == A_WINZOOM) {
*w = vo->dwidth;
@@ -101,7 +101,7 @@ void aspect(struct vo *vo, int *srcw, int *srch, int zoom)
int fitw;
int fith;
get_max_dims(vo, &fitw, &fith, zoom);
- if (!zoom && vo->opts->vo_geometry.wh_valid) {
+ if (!zoom && vo->opts->vo.geometry.wh_valid) {
mp_msg(MSGT_VO, MSGL_DBG2, "aspect(0) no aspect forced!\n");
return; // the user doesn't want to fix aspect
}
@@ -123,16 +123,16 @@ static void panscan_calc_internal(struct vo *vo, int zoom)
get_max_dims(vo, &max_w, &max_h, zoom);
struct MPOpts *opts = vo->opts;
- if (opts->vo_panscanrange > 0) {
+ if (opts->vo.panscanrange > 0) {
aspect(vo, &fwidth, &fheight, zoom);
vo_panscan_area = max_h - fheight;
if (!vo_panscan_area)
vo_panscan_area = max_w - fwidth;
- vo_panscan_area *= opts->vo_panscanrange;
+ vo_panscan_area *= opts->vo.panscanrange;
} else
- vo_panscan_area = -opts->vo_panscanrange * max_h;
+ vo_panscan_area = -opts->vo.panscanrange * max_h;
- vo->panscan_amount = vo_fs || zoom == A_WINZOOM ? vo_panscan : 0;
+ vo->panscan_amount = opts->vo.fs || zoom == A_WINZOOM ? opts->vo.panscan : 0;
vo->panscan_x = vo_panscan_area * vo->panscan_amount * vo->aspdat.asp;
vo->panscan_y = vo_panscan_area * vo->panscan_amount;
}
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index add42de953..b376e392c0 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -122,7 +122,7 @@ struct vo_cocoa_state {
int display_cursor;
int cursor_timer;
- int cursor_autohide_delay;
+ int vo.cursor_autohide_delay;
bool did_resize;
bool out_fs_resize;
@@ -150,7 +150,7 @@ static struct vo_cocoa_state *vo_cocoa_init_state(struct vo *vo)
.windowed_frame = {{0,0},{0,0}},
.out_fs_resize = NO,
.display_cursor = 1,
- .cursor_autohide_delay = vo->opts->cursor_autohide_delay,
+ .vo.cursor_autohide_delay = vo->opts->vo.cursor_autohide_delay,
.power_mgmt_assertion = kIOPMNullAssertionID,
.accumulated_scroll = 0,
};
@@ -281,10 +281,10 @@ static void update_screen_info(struct vo *vo)
struct MPOpts *opts = vo->opts;
NSScreen *ws, *fss;
- get_screen_handle(opts->vo_screen_id, s->window, &ws);
+ get_screen_handle(opts->vo.screen_id, s->window, &ws);
s->screen_frame = [ws frame];
- get_screen_handle(opts->vo_fsscreen_id, s->window, &fss);
+ get_screen_handle(opts->vo.fsscreen_id, s->window, &fss);
s->fsscreen_frame = [fss frame];
}
@@ -296,10 +296,10 @@ void vo_cocoa_update_xinerama_info(struct vo *vo)
update_screen_info(vo);
aspect_save_screenres(vo, s->screen_frame.size.width,
s->screen_frame.size.height);
- opts->vo_screenwidth = s->screen_frame.size.width;
- opts->vo_screenheight = s->screen_frame.size.height;
- xinerama_x = s->screen_frame.origin.x;
- xinerama_y = s->screen_frame.origin.y;
+ opts->vo.screenwidth = s->screen_frame.size.width;
+ opts->vo.screenheight = s->screen_frame.size.height;
+ vo->xinerama_x = s->screen_frame.origin.x;
+ vo->xinerama_y = s->screen_frame.origin.y;
}
int vo_cocoa_change_attributes(struct vo *vo)
@@ -339,8 +339,8 @@ static void vo_set_level(struct vo *vo, int ontop)
void vo_cocoa_ontop(struct vo *vo)
{
struct MPOpts *opts = vo->opts;
- opts->vo_ontop = !opts->vo_ontop;
- vo_set_level(vo, opts->vo_ontop);
+ opts->vo.ontop = !opts->vo.ontop;
+ vo_set_level(vo, opts->vo.ontop);
}
static void update_state_sizes(struct vo_cocoa_state *s,
@@ -355,7 +355,7 @@ static int create_window(struct vo *vo, uint32_t d_width, uint32_t d_height,
uint32_t flags, int gl3profile)
{
struct vo_cocoa_state *s = vo->cocoa;
- const NSRect window_rect = NSMakeRect(xinerama_x, xinerama_y,
+ const NSRect window_rect = NSMakeRect(vo->xinerama_x, vo->xinerama_y,
d_width, d_height);
const NSRect glview_rect = NSMakeRect(0, 0, 100, 100);
@@ -418,7 +418,7 @@ static void update_window(struct vo *vo)
if (s->current_video_size.width != s->previous_video_size.width ||
s->current_video_size.height != s->previous_video_size.height) {
- if (vo_fs) {
+ if (vo->opts->vo.fs) {
// we will resize as soon as we get out of fullscreen
s->out_fs_resize = YES;
} else {
@@ -463,7 +463,7 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
if (flags & VOFLAG_FULLSCREEN)
vo_cocoa_fullscreen(vo);
- vo_set_level(vo, opts->vo_ontop);
+ vo_set_level(vo, opts->vo.ontop);
[s->window setContentSize:s->current_video_size];
[s->window setContentAspectRatio:s->current_video_size];
@@ -491,12 +491,12 @@ static void vo_cocoa_display_cursor(struct vo *vo, int requested_state)
{
struct vo_cocoa_state *s = vo->cocoa;
if (requested_state) {
- if (!vo_fs || s->cursor_autohide_delay > -2) {
+ if (!vo->opts->vo.fs || s->vo.cursor_autohide_delay > -2) {
s->display_cursor = requested_state;
CGDisplayShowCursor(kCGDirectMainDisplay);
}
} else {
- if (s->cursor_autohide_delay != -1) {
+ if (s->vo.cursor_autohide_delay != -1) {
s->display_cursor = requested_state;
CGDisplayHideCursor(kCGDirectMainDisplay);
}
@@ -510,8 +510,8 @@ int vo_cocoa_check_events(struct vo *vo)
int ms_time = (int) ([[NSProcessInfo processInfo] systemUptime] * 1000);
// automatically hide mouse cursor
- if (vo_fs && s->display_cursor &&
- (ms_time - s->cursor_timer >= s->cursor_autohide_delay)) {
+ if (vo->opts->vo.fs && s->display_cursor &&
+ (ms_time - s->cursor_timer >= s->vo.cursor_autohide_delay)) {
vo_cocoa_display_cursor(vo, 0);
s->cursor_timer = ms_time;
}
@@ -648,7 +648,8 @@ void create_menu()
- (void)fullscreen
{
struct vo_cocoa_state *s = _vo->cocoa;
- if (!vo_fs) {
+ struct MPOpts *opts = _vo->opts;
+ if (!opts->vo.fs) {
update_screen_info(_vo);
if (current_screen_has_dock_or_menubar(_vo))
[NSApp setPresentationOptions:NSApplicationPresentationHideDock|
@@ -657,7 +658,7 @@ void create_menu()
[self setHasShadow:NO];
[self setStyleMask:s->fullscreen_mask];
[self setFrame:s->fsscreen_frame display:YES animate:NO];
- vo_fs = VO_TRUE;
+ opts->vo.fs = true;
vo_cocoa_display_cursor(_vo, 0);
[self setMovableByWindowBackground: NO];
} else {
@@ -671,7 +672,7 @@ void create_menu()
s->out_fs_resize = NO;
}
[self setContentAspectRatio:s->current_video_size];
- vo_fs = VO_FALSE;
+ opts->vo.fs = false;
vo_cocoa_display_cursor(_vo, 1);
[self setMovableByWindowBackground: YES];
}
@@ -695,7 +696,7 @@ void create_menu()
{
// this is only valid as a starting value. it will be rewritten in the
// -fullscreen method.
- return !vo_fs;
+ return !_vo->opts->o_fs;
}
- (void)handleQuitEvent:(NSAppleEventDescriptor*)e
@@ -730,7 +731,7 @@ void create_menu()
- (void)mouseMoved: (NSEvent *) theEvent
{
- if (vo_fs)
+ if (_vo->opts->vo.fs)
vo_cocoa_display_cursor(_vo, 1);
}
@@ -851,7 +852,7 @@ void create_menu()
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
{
- if (vo_fs && current_screen_has_dock_or_menubar(_vo)) {
+ if (_vo->opts->vo.fs && current_screen_has_dock_or_menubar(_vo)) {
struct vo_cocoa_state *s = _vo->cocoa;
[self setLevel:s->window_level];
[NSApp setPresentationOptions:NSApplicationPresentationHideDock|
@@ -861,7 +862,7 @@ void create_menu()
- (void)applicationWillResignActive:(NSNotification *)aNotification
{
- if (vo_fs) {
+ if (_vo->opts->vo.fs) {
[self setLevel:NSNormalWindowLevel];
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
}
@@ -888,7 +889,7 @@ void create_menu()
- (void)mulSize:(float)multiplier
{
- if (!vo_fs) {
+ if (!_vo->opts->vo.fs) {
NSSize size = {
.width = _vo->aspdat.prew * multiplier,
.height = _vo->aspdat.preh * multiplier
diff --git a/video/out/vo.c b/video/out/vo.c
index 52ed04d3b5..5841d6fd52 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -42,25 +42,8 @@
#include "video/vfcap.h"
#include "sub/sub.h"
-int xinerama_x;
-int xinerama_y;
-
-int vo_nomouse_input = 0;
-int vo_vsync = 1;
-int vo_fs = 0;
-int vo_fsmode = 0;
-float vo_panscan = 0.0f;
-int vo_refresh_rate=0;
-int vo_keepaspect=1;
-int vo_border=1;
-int64_t WinID = -1;
-
-int vo_pts=0; // for hw decoding
float vo_fps=0;
-int vo_colorkey = 0x0000ff00; // default colorkey is green
- // (0xff000000 means that colorkey has been disabled)
-
//
// Externally visible list of all vo drivers
//
@@ -407,22 +390,22 @@ static void determine_window_geometry(struct vo *vo, int d_w, int d_h)
{
struct MPOpts *opts = vo->opts;
- int scr_w = opts->vo_screenwidth;
- int scr_h = opts->vo_screenheight;
+ int scr_w = opts->vo.screenwidth;
+ int scr_h = opts->vo.screenheight;
// This is only for applying monitor pixel aspect
aspect(vo, &d_w, &d_h, A_NOZOOM);
- apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->vo_autofit, true);
- apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->vo_autofit_larger, false);
+ apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->vo.autofit, true);
+ apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->vo.autofit_larger, false);
- vo->dx = (int)(opts->vo_screenwidth - d_w) / 2;
- vo->dy = (int)(opts->vo_screenheight - d_h) / 2;
+ vo->dx = (int)(opts->vo.screenwidth - d_w) / 2;
+ vo->dy = (int)(opts->vo.screenheight - d_h) / 2;</