summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-04-20 22:16:17 +0200
committerwm4 <wm4@nowhere>2019-09-13 13:54:50 +0200
commita05250a25eaa545c3f81106044bb94b870d50e3d (patch)
tree11c58cd67207a6347236467293df3e4be95a0ae8
parent31983061247f6b57155a52c9a6937db9c7104d3f (diff)
downloadmpv-examples-a05250a25eaa545c3f81106044bb94b870d50e3d.tar.bz2
mpv-examples-a05250a25eaa545c3f81106044bb94b870d50e3d.tar.xz
sdl: demonstrate GPU-renderered screenshots
-rw-r--r--libmpv/sdl/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libmpv/sdl/main.c b/libmpv/sdl/main.c
index 3aab525..e45bb99 100644
--- a/libmpv/sdl/main.c
+++ b/libmpv/sdl/main.c
@@ -131,6 +131,16 @@ int main(int argc, char *argv[])
const char *cmd_pause[] = {"cycle", "pause", NULL};
mpv_command_async(mpv, 0, cmd_pause);
}
+ if (event.key.keysym.sym == SDLK_s) {
+ // Also requires MPV_RENDER_PARAM_ADVANCED_CONTROL if you want
+ // screenshots to be rendered on GPU (like --vo=gpu would do).
+ const char *cmd_scr[] = {"screenshot-to-file",
+ "screenshot.png",
+ "window",
+ NULL};
+ printf("attempting to save screenshot to %s\n", cmd_scr[1]);
+ mpv_command_async(mpv, 0, cmd_scr);
+ }
break;
default:
// Happens when there is new work for the render thread (such as