summaryrefslogtreecommitdiffstats
path: root/player/video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-18 16:06:12 +0200
committerwm4 <wm4@nowhere>2016-09-18 16:08:21 +0200
commit2415b695724c15def54a039527ee9eb574ffb65f (patch)
tree97ed9e4c272bf3ac29764557db73b24d99503945 /player/video.c
parent3ecc6d0a7934c42395d863b74e47f903fe864760 (diff)
downloadmpv-2415b695724c15def54a039527ee9eb574ffb65f.tar.bz2
mpv-2415b695724c15def54a039527ee9eb574ffb65f.tar.xz
player: more option/property consistency fixes
Some properties had a different type from their equivalent options (such as mute, volume, deinterlace, edition). This wasn't really sane, as raw option values should be always within their bounds. On the other hand, these properties use a different type to reflect runtime limits (such as range of available editions), or simply to improve the "UI" (you don't want to cycle throuhg the completely useless "auto" value when cycling the "mute" property). Handle this by making them always return the option type, but also allowing them to provide a "constricted" type, which is used for UI purposes. All M_PROPERTY_GET_CONSTRICTED_TYPE changes are related to this. One consequence is that you can set the volume property to arbitrary high values just like with the --volume option, but using the "add" command it still restricts it to the --volume-max range. Also deprecate --chapter, as it is grossly incompatible to the chapter property. We pondered renaming it to --chapters, or introducing a more powerful --range option, but concluded that --start --end is actually enough. These changes appear to take care of the last gross property/option incompatibilities, although there might still be a few lurking.
Diffstat (limited to 'player/video.c')
-rw-r--r--player/video.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/player/video.c b/player/video.c
index 4c56ca1a00..3835ef5f95 100644
--- a/player/video.c
+++ b/player/video.c
@@ -264,14 +264,16 @@ int get_deinterlacing(struct MPContext *mpctx)
return enabled;
}
-void set_deinterlacing(struct MPContext *mpctx, bool enable)
+void set_deinterlacing(struct MPContext *mpctx, int opt_val)
{
- if (enable == (get_deinterlacing(mpctx) > 0))
+ if ((opt_val < 0 && mpctx->opts->deinterlace == opt_val) ||
+ (opt_val == (get_deinterlacing(mpctx) > 0)))
return;
- mpctx->opts->deinterlace = enable;
+ mpctx->opts->deinterlace = opt_val;
recreate_auto_filters(mpctx);
- mpctx->opts->deinterlace = get_deinterlacing(mpctx) > 0;
+ if (opt_val >= 0)
+ mpctx->opts->deinterlace = get_deinterlacing(mpctx) > 0;
}
static void recreate_video_filters(struct MPContext *mpctx)