diff --git a/include/player.h b/include/player.h index 2969ced..2784a67 100644 --- a/include/player.h +++ b/include/player.h @@ -90,6 +90,7 @@ class Player { virtual GLAddrLoadFunc GetGLAddrFunc() = 0; virtual std::string GetClipboardString() = 0; virtual void GetMonitorSize(int *w, int *h) = 0; + virtual int GetMonitorRefreshRate() = 0; virtual void GetFramebufferSize(int *w, int *h) = 0; virtual void MakeContextCurrent() = 0; virtual void DeleteContext() = 0; diff --git a/include/window.h b/include/window.h index 981bf1f..cdccb57 100644 --- a/include/window.h +++ b/include/window.h @@ -45,6 +45,7 @@ class Window : Player { GLAddrLoadFunc GetGLAddrFunc() override; std::string GetClipboardString() override; void GetMonitorSize(int *w, int *h) override; + int GetMonitorRefreshRate() override; void GetFramebufferSize(int *w, int *h) override; void MakeContextCurrent() override; void DeleteContext() override; diff --git a/source/player.cpp b/source/player.cpp index 29aef7c..2caf90d 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -45,6 +45,10 @@ bool Player::init(std::map &options) { mpv->option("osd-playing-msg", "${media-title}"); mpv->option("screenshot-directory", "~~desktop/"); + // override-display-fps is renamed to display-fps-override in mpv 0.37.0 + mpv->option("override-display-fps", GetMonitorRefreshRate()); + mpv->option("display-fps-override", GetMonitorRefreshRate()); + if (!config->Data.Mpv.UseConfig) { writeMpvConf(); mpv->option("osc", "no"); diff --git a/source/window.cpp b/source/window.cpp index d8b3bc2..e9f0514 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -293,6 +293,11 @@ void Window::GetMonitorSize(int* w, int* h) { *h = mode->height; } +int Window::GetMonitorRefreshRate() { + const GLFWvidmode* mode = glfwGetVideoMode(getMonitor(window)); + return mode->refreshRate; +} + void Window::GetFramebufferSize(int* w, int* h) { glfwGetFramebufferSize(window, w, h); } void Window::MakeContextCurrent() { glfwMakeContextCurrent(window); }