summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2016-09-28 21:47:30 +1000
committerJames Ross-Gowan <rossymiles@gmail.com>2016-09-28 21:47:30 +1000
commitb712095d894c1ee8aba833e0263c40ce0a59e9c5 (patch)
treeb512d942a235317b69963e0ba59de7bfc3893e98 /player/command.c
parent3751065f9740244c95da963c0dd16a0bcd5b419c (diff)
downloadmpv-b712095d894c1ee8aba833e0263c40ce0a59e9c5.tar.bz2
mpv-b712095d894c1ee8aba833e0263c40ce0a59e9c5.tar.xz
win32: make --priority runtime-settable
I'm not sure if this option affects anything or if it's a placebo, especially since the VO thread is now registered with MMCSS. Still, I think --priority=high may have helped back when I used mplayer2 on a netbook. It's also possible that encoding-mode users would want to set --priority=idle. Anyway, it was one of the last M_OPT_FIXED options, so fix that.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index be6b31d1b3..9b771a2e1d 100644
--- a/player/command.c
+++ b/player/command.c
@@ -68,6 +68,10 @@
#include "core.h"
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
struct command_ctx {
// All properties, terminated with a {0} item.
struct m_property *properties;
@@ -5649,6 +5653,15 @@ void mp_notify(struct MPContext *mpctx, int event, void *arg)
mp_client_broadcast_event(mpctx, event, arg);
}
+static void update_priority(struct MPContext *mpctx)
+{
+#ifdef _WIN32
+ struct MPOpts *opts = mpctx->opts;
+ if (opts->w32_priority > 0)
+ SetPriorityClass(GetCurrentProcess(), opts->w32_priority);
+#endif
+}
+
void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags)
{
struct MPContext *mpctx = ctx;
@@ -5704,6 +5717,9 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags)
uninit_audio_out(mpctx);
mp_wakeup_core(mpctx);
}
+
+ if (flags & UPDATE_PRIORITY)
+ update_priority(mpctx);
}
void mp_notify_property(struct MPContext *mpctx, const char *property)