diff options
-rw-r--r-- | include/mpv.hpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 10 | ||||
-rw-r--r-- | src/mpv.cpp | 7 |
3 files changed, 12 insertions, 7 deletions
diff --git a/include/mpv.hpp b/include/mpv.hpp index 09ba2c1..29817c8 100644 --- a/include/mpv.hpp +++ b/include/mpv.hpp @@ -11,7 +11,7 @@ public: Mpv() = default; ~Mpv(); - bool create(bool use_system_mpv_config); + bool create(bool use_system_mpv_config, const char *profile = "gpu-hq"); bool destroy(); bool load_file(const char *path); diff --git a/src/main.cpp b/src/main.cpp index 501e43a..7c6f944 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -344,6 +344,7 @@ private: // X compositor bool focused_window_changed = true; bool focused_window_set = false; const char *mpv_file = nullptr; + const char *mpv_profile = "gpu-hq"; Mpv mpv; std::mutex mpv_render_update_mutex; std::condition_variable mpv_render_update_condition; @@ -484,7 +485,7 @@ void dprintf( const char *fmt, ... ) } static void usage() { - fprintf(stderr, "usage: vr-video-player [--sphere|--sphere360|--flat|--plane] [--left-right|--right-left] [--stretch|--no-stretch] [--zoom zoom-level] [--cursor-scale scale] [--cursor-wrap|--no-cursor-wrap] [--follow-focused|--video video|<window_id>] [--use-system-mpv-config] [--free-camera] [--reduce-flicker]\n"); + fprintf(stderr, "usage: vr-video-player [--sphere|--sphere360|--flat|--plane] [--left-right|--right-left] [--stretch|--no-stretch] [--zoom zoom-level] [--cursor-scale scale] [--cursor-wrap|--no-cursor-wrap] [--follow-focused|--video video|<window_id>] [--use-system-mpv-config] [--mpv-profile <profile>] [--free-camera] [--reduce-flicker]\n"); fprintf(stderr, "\n"); fprintf(stderr, "OPTIONS\n"); fprintf(stderr, " --sphere View the window as a stereoscopic 180 degrees screen (half sphere). The view will be attached to your head in vr. This is recommended for 180 degrees videos. This is the default value\n"); @@ -504,6 +505,7 @@ static void usage() { fprintf(stderr, " --follow-focused If this option is set, then the selected window will be the focused window. vr-video-player will automatically update when the focused window changes. Either this option, --video or window_id should be used\n"); fprintf(stderr, " --video <video> Select the video to play (using mpv). Either this option, --follow-focused or window_id should be used\n"); fprintf(stderr, " --use-system-mpv-config Use system (~/.config/mpv/mpv.conf) mpv config. Disabled by default\n"); + fprintf(stderr, " --mpv-profile <profile> Which mpv profile to use. Only applicable when using --video option. Optional, defaults to \"gpu-hq\"\n"); fprintf(stderr, " window_id The X11 window id of the window to view in vr. Either this option, --follow-focused or --video should be used\n"); fprintf(stderr, "\n"); fprintf(stderr, "EXAMPLES\n"); @@ -679,6 +681,9 @@ CMainApplication::CMainApplication( int argc, char *argv[] ) ++i; } else if(strcmp(argv[i], "--use-system-mpv-config") == 0) { use_system_mpv_config = true; + } else if(strcmp(argv[i], "--mpv-profile") == 0 && i < argc - 1) { + mpv_profile = argv[i + 1]; + ++i; } else if(strcmp(argv[i], "--free-camera") == 0) { free_camera = true; } else if(strcmp(argv[i], "--reduce-flicker") == 0) { @@ -964,12 +969,11 @@ bool CMainApplication::BInit() if(mpv_file) { mpv_thread = std::thread([&]{ set_current_context(m_pMpvContext); - if(!mpv.create(use_system_mpv_config)) + if(!mpv.create(use_system_mpv_config, mpv_profile)) return; mpv.load_file(mpv_file); set_current_context(NULL); - while(running) { diff --git a/src/mpv.cpp b/src/mpv.cpp index 6403bdc..0683ab2 100644 --- a/src/mpv.cpp +++ b/src/mpv.cpp @@ -64,7 +64,7 @@ Mpv::~Mpv() { destroy(); } -bool Mpv::create(bool use_system_mpv_config) { +bool Mpv::create(bool use_system_mpv_config, const char *profile) { if(created) return false; @@ -103,10 +103,11 @@ bool Mpv::create(bool use_system_mpv_config) { }; //mpv_set_option_string(mpv, "vd-lavc-dr", "yes"); - mpv_set_option_string(mpv, "vo", "libmpv"); mpv_set_option_string(mpv, "hwdec", "auto"); - mpv_set_option_string(mpv, "profile", "gpu-hq"); + mpv_set_option_string(mpv, "profile", profile); mpv_set_option_string(mpv, "gpu-api", "opengl"); + // This has to be set after mpv_set_option_string(... "profile") since that option overwrites this + mpv_set_option_string(mpv, "vo", "libmpv"); if(mpv_render_context_create(&mpv_gl, mpv, params) < 0) { fprintf(stderr, "Error: mpv_render_context_create failed\n"); |