From 4db72f6a8006ff137a7d6b8fcbc07da4fa94b9e0 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Fri, 25 Apr 2008 07:12:05 +0300 Subject: [PATCH] Move vo_gamma_* to options struct --- cfg-mplayer.h | 8 ++++---- command.c | 13 +++++++------ defaultopts.c | 5 +++++ libmpcodecs/vd.c | 31 ++++++++++--------------------- libvo/video_out.h | 9 --------- options.h | 8 ++++++++ 6 files changed, 34 insertions(+), 40 deletions(-) diff --git a/cfg-mplayer.h b/cfg-mplayer.h index e0b44205d3..c8e2f0f632 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -211,10 +211,10 @@ const m_option_t mplayer_opts[]={ {"xineramascreen", &xinerama_screen, CONF_TYPE_INT, CONF_RANGE, -2, 32, NULL}, - {"brightness",&vo_gamma_brightness, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL}, - {"saturation",&vo_gamma_saturation, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL}, - {"contrast",&vo_gamma_contrast, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL}, - {"hue",&vo_gamma_hue, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL}, + 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), {"keepaspect", &vo_keepaspect, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"nokeepaspect", &vo_keepaspect, CONF_TYPE_FLAG, 0, 1, 0, NULL}, diff --git a/command.c b/command.c index 501a35f8dc..cb277ac5c5 100644 --- a/command.c +++ b/command.c @@ -1127,7 +1127,8 @@ static int mp_property_framedropping(m_option_t *prop, int action, static int mp_property_gamma(m_option_t *prop, int action, void *arg, MPContext *mpctx) { - int *gamma = prop->priv, r, val; + int *gamma = (int *)((char *)&mpctx->opts + (int)prop->priv); + int r, val; if (!mpctx->sh_video) return M_PROPERTY_UNAVAILABLE; @@ -2026,15 +2027,15 @@ static const m_option_t mp_properties[] = { { "framedropping", mp_property_framedropping, CONF_TYPE_INT, M_OPT_RANGE, 0, 2, NULL }, { "gamma", mp_property_gamma, CONF_TYPE_INT, - M_OPT_RANGE, -100, 100, &vo_gamma_gamma }, + M_OPT_RANGE, -100, 100, (void *)offsetof(struct MPOpts, vo_gamma_gamma)}, { "brightness", mp_property_gamma, CONF_TYPE_INT, - M_OPT_RANGE, -100, 100, &vo_gamma_brightness }, + M_OPT_RANGE, -100, 100, (void *)offsetof(struct MPOpts, vo_gamma_brightness) }, { "contrast", mp_property_gamma, CONF_TYPE_INT, - M_OPT_RANGE, -100, 100, &vo_gamma_contrast }, + M_OPT_RANGE, -100, 100, (void *)offsetof(struct MPOpts, vo_gamma_contrast) }, { "saturation", mp_property_gamma, CONF_TYPE_INT, - M_OPT_RANGE, -100, 100, &vo_gamma_saturation }, + M_OPT_RANGE, -100, 100, (void *)offsetof(struct MPOpts, vo_gamma_saturation) }, { "hue", mp_property_gamma, CONF_TYPE_INT, - M_OPT_RANGE, -100, 100, &vo_gamma_hue }, + M_OPT_RANGE, -100, 100, (void *)offsetof(struct MPOpts, vo_gamma_hue) }, { "panscan", mp_property_panscan, CONF_TYPE_FLOAT, M_OPT_RANGE, 0, 1, NULL }, { "vsync", mp_property_vsync, CONF_TYPE_FLAG, diff --git a/defaultopts.c b/defaultopts.c index 24ee0dcb84..2ac08d9bc4 100644 --- a/defaultopts.c +++ b/defaultopts.c @@ -8,6 +8,11 @@ void set_default_mplayer_options(struct MPOpts *opts) .audio_driver_list = NULL, .video_driver_list = NULL, .fixed_vo = 0, + .vo_gamma_gamma = 1000, + .vo_gamma_brightness = 1000, + .vo_gamma_contrast = 1000, + .vo_gamma_saturation = 1000, + .vo_gamma_hue = 1000, .loop_times = -1, .user_correct_pts = -1, .audio_id = -1, diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index 9d3a2bb066..2d634bfe2a 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -103,17 +103,6 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = { #include "libvo/video_out.h" -/** global variables for gamma, brightness, contrast, saturation and hue - modified by mplayer.c and gui/mplayer/gtk/eq.c: - ranges -100 - 100 - 1000 if the vo default should be used -*/ -int vo_gamma_gamma = 1000; -int vo_gamma_brightness = 1000; -int vo_gamma_contrast = 1000; -int vo_gamma_saturation = 1000; -int vo_gamma_hue = 1000; - int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt) { @@ -323,16 +312,16 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h, sh->vf_initialized = 1; - if (vo_gamma_gamma != 1000) - set_video_colors(sh, "gamma", vo_gamma_gamma); - if (vo_gamma_brightness != 1000) - set_video_colors(sh, "brightness", vo_gamma_brightness); - if (vo_gamma_contrast != 1000) - set_video_colors(sh, "contrast", vo_gamma_contrast); - if (vo_gamma_saturation != 1000) - set_video_colors(sh, "saturation", vo_gamma_saturation); - if (vo_gamma_hue != 1000) - set_video_colors(sh, "hue", vo_gamma_hue); + 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); return 1; } diff --git a/libvo/video_out.h b/libvo/video_out.h index 1c13183222..24dd5918cf 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -256,15 +256,6 @@ extern int vo_keepaspect; extern int vo_rootwin; extern int vo_border; -extern int vo_gamma_gamma; -extern int vo_gamma_brightness; -extern int vo_gamma_saturation; -extern int vo_gamma_contrast; -extern int vo_gamma_hue; -extern int vo_gamma_red_intensity; -extern int vo_gamma_green_intensity; -extern int vo_gamma_blue_intensity; - extern int vo_nomouse_input; extern int vo_pts; diff --git a/options.h b/options.h index 324108252c..ce49ee34da 100644 --- a/options.h +++ b/options.h @@ -13,6 +13,14 @@ typedef struct MPOpts { int vidmode; int fullscreen; int vo_dbpp; + + // 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 correct_pts; int loop_times; int user_correct_pts;