aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-11-25 09:46:29 +0100
committerdec05eba <dec05eba@protonmail.com>2023-11-25 09:46:29 +0100
commitd44c2609e73c0a9f6030b62a6b39399bf1db1fd4 (patch)
tree02f1fa95f52bfc103f51461ab6fdf8ac56a0c6bf /src
parent90e22e4415d6fabab09bc505a062f38b74f5f1a3 (diff)
Add --mpv-profile option, force libmpv (fixes custom system profile option)
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp10
-rw-r--r--src/mpv.cpp7
2 files changed, 11 insertions, 6 deletions
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");