1
0
mirror of https://github.com/mpv-player/mpv synced 2025-05-02 00:04:16 +00:00

win32: add option to set VO MMCSS profile

This was requested.
This commit is contained in:
wm4 2015-12-06 19:20:23 +01:00
parent 9db50c6760
commit 159eb3f962
5 changed files with 17 additions and 1 deletions

View File

@ -3550,6 +3550,10 @@ Miscellaneous
other options such as e.g. user agent are not available with all protocols, other options such as e.g. user agent are not available with all protocols,
and printing errors for unknown options would end up being too noisy.) and printing errors for unknown options would end up being too noisy.)
``--vo-mmcss-profile=<name>``
(Windows only.)
Set the MMCSS profile for the video renderer thread (default: ``Playback``).
``--priority=<prio>`` ``--priority=<prio>``
(Windows only.) (Windows only.)
Set process priority for mpv according to the predefined priorities Set process priority for mpv according to the predefined priorities

View File

@ -977,6 +977,7 @@ cat > $TMPC << EOF
#define HAVE_C11_TLS 1 #define HAVE_C11_TLS 1
#define HAVE_EGL_ANGLE 0 #define HAVE_EGL_ANGLE 0
#define HAVE_GPL3 1 #define HAVE_GPL3 1
#define HAVE_WIN32 0
#ifdef __OpenBSD__ #ifdef __OpenBSD__
#define DEFAULT_CDROM_DEVICE "/dev/rcd0c" #define DEFAULT_CDROM_DEVICE "/dev/rcd0c"

View File

@ -456,6 +456,10 @@ const m_option_t mp_opts[] = {
({"auto", 0}, {"no", -1}, {"yes", 1})), ({"auto", 0}, {"no", -1}, {"yes", 1})),
OPT_FLAG("x11-bypass-compositor", vo.x11_bypass_compositor, 0), OPT_FLAG("x11-bypass-compositor", vo.x11_bypass_compositor, 0),
#endif #endif
#if HAVE_WIN32
OPT_STRING("vo-mmcss-profile", vo.mmcss_profile, M_OPT_FIXED),
#endif
OPT_STRING("heartbeat-cmd", heartbeat_cmd, 0), OPT_STRING("heartbeat-cmd", heartbeat_cmd, 0),
OPT_FLOAT("heartbeat-interval", heartbeat_interval, CONF_MIN, 0), OPT_FLOAT("heartbeat-interval", heartbeat_interval, CONF_MIN, 0),
@ -701,6 +705,7 @@ const struct MPOpts mp_default_opts = {
.WinID = -1, .WinID = -1,
.window_scale = 1.0, .window_scale = 1.0,
.x11_bypass_compositor = 1, .x11_bypass_compositor = 1,
.mmcss_profile = "Playback",
}, },
.allow_win_drag = 1, .allow_win_drag = 1,
.wintitle = "${?media-title:${media-title}}${!media-title:No file} - mpv", .wintitle = "${?media-title:${media-title}}${!media-title:No file} - mpv",

View File

@ -43,6 +43,8 @@ typedef struct mp_vo_opts {
float monitor_pixel_aspect; float monitor_pixel_aspect;
int force_window_position; int force_window_position;
char *mmcss_profile;
// vo_wayland, vo_drm // vo_wayland, vo_drm
struct sws_opts *sws_opts; struct sws_opts *sws_opts;
// vo_opengl, vo_opengl_cb // vo_opengl, vo_opengl_cb

View File

@ -1327,7 +1327,11 @@ int vo_w32_init(struct vo *vo)
// While the UI runs in its own thread, the thread in which this function // While the UI runs in its own thread, the thread in which this function
// runs in will be the renderer thread. Apply magic MMCSS cargo-cult, // runs in will be the renderer thread. Apply magic MMCSS cargo-cult,
// which might stop Windows from throttling clock rate and so on. // which might stop Windows from throttling clock rate and so on.
w32->avrt_handle = AvSetMmThreadCharacteristicsW(L"Playback", &(DWORD){0}); if (vo->opts->mmcss_profile[0]) {
wchar_t *profile = mp_from_utf8(NULL, vo->opts->mmcss_profile);
w32->avrt_handle = AvSetMmThreadCharacteristicsW(profile, &(DWORD){0});
talloc_free(profile);
}
return 1; return 1;
fail: fail: