aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-12-01 20:19:30 +0100
committerdec05eba <dec05eba@protonmail.com>2023-12-01 20:19:33 +0100
commited44145fe7db7e3adabdd09a79e21b3fdf84687d (patch)
treea459ca2c098c9d39fea09e2bdc7e4bc6de6ca332
parent38e4cf5a39c1f5762b5052cc06b4698d17e76be8 (diff)
Add --overlay-width option
-rw-r--r--TODO2
-rw-r--r--project.conf3
-rw-r--r--src/main.cpp9
3 files changed, 12 insertions, 2 deletions
diff --git a/TODO b/TODO
index 1a4cdfe..e0541b5 100644
--- a/TODO
+++ b/TODO
@@ -7,3 +7,5 @@ Automatically use the right vr option when using mpv by looking at the file name
Make stereo audio follow headset rotation in 180/360 mode (assume facing forward is the default audio mode).
Fix sphere360... AAAAAA.
Use egl instead of glx for xcomposite window capture because nvidia glx has a limitation where only 1 pixmap can be created for a window which means that with some compositors (gnome for example with CSD or picom in GLX mode) it will fail to create a texture and the captured texture will instead be black. Nvidia with egl doesn't have this limitation.
+Add option to capture monitors. This would be useful specifically with the --overlay option.
+Allow selecting window/monitor in overlay.
diff --git a/project.conf b/project.conf
index 701b959..71351af 100644
--- a/project.conf
+++ b/project.conf
@@ -12,4 +12,5 @@ openvr = "1"
x11 = "1"
xcomposite = ">=0.2"
xfixes = ">=5"
-mpv = ">=1" \ No newline at end of file
+mpv = ">=1"
+libxdo = ">=2"
diff --git a/src/main.cpp b/src/main.cpp
index 36556ea..5afeef3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -423,6 +423,7 @@ private: // X compositor
VideoBuffers *overlay_buffers = nullptr;
GLuint m_unOverlayProgramID = 0;
const char *overlay_key = "vr-video-player";
+ float overlay_width = 2.5f;
xdo_t *overlay_xdo = nullptr;
Atom overlay_icon_atom;
bool overlay_mouse_controls = true;
@@ -516,7 +517,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] [--mpv-profile <profile>] [--free-camera] [--reduce-flicker] [--overlay] [--overlay-key <key>] [--overlay-mouse|--no-overlay-mouse]\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] [--overlay] [--overlay-key <key>] [--overlay-mouse|--no-overlay-mouse] [--overlay-width <width>]\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");
@@ -541,6 +542,7 @@ static void usage() {
fprintf(stderr, " --overlay-key <key> Name used to identify the OpenVR overlay. Defaults to \"vr-video-player\".\n");
fprintf(stderr, " --overlay-mouse Enable the translation of VR events into mouse events when running as an overlay. This is the default value.\n");
fprintf(stderr, " --no-overlay-mouse Disable the translation of VR events into mouse events when running as an overlay.\n");
+ fprintf(stderr, " --overlay-width <width> Overlay width in meters. Defaults to 2.5.\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");
@@ -728,6 +730,9 @@ CMainApplication::CMainApplication( int argc, char *argv[] )
} else if(strcmp(argv[i], "--overlay-key") == 0 && i < argc - 1) {
overlay_key = argv[i + 1];
++i;
+ } else if(strcmp(argv[i], "--overlay-width") == 0 && i < argc - 1) {
+ overlay_width = atof(argv[i + 1]);
+ ++i;
} else if(strcmp(argv[i], "--overlay-mouse") == 0) {
overlay_mouse_controls = true;
} else if(strcmp(argv[i], "--no-overlay-mouse") == 0) {
@@ -1234,6 +1239,8 @@ bool CMainApplication::BInitOverlay()
if (projection_mode == ProjectionMode::FLAT && stretch)
vr::VROverlay()->SetOverlayTexelAspect(overlay_handle, 2.0);
+ vr::VROverlay()->SetOverlayWidthInMeters(overlay_handle, overlay_width);
+
overlay_xdo = xdo_new_with_opened_display(x_display, nullptr, 0);
overlay_icon_atom = XInternAtom(x_display, "_NET_WM_ICON", 0);