[RFC PATCH weston 2/2] screenshooter: Add support to output multiple files
Tomohiro Komagata
tomohiro.komagata.aj at gmail.com
Mon Jun 26 16:06:43 UTC 2017
Signed-off-by: Tomohiro Komagata <tomohiro.komagata.aj at gmail.com>
---
compositor/weston-screenshooter.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/compositor/weston-screenshooter.c b/compositor/weston-screenshooter.c
index 9999909..f8db546 100644
--- a/compositor/weston-screenshooter.c
+++ b/compositor/weston-screenshooter.c
@@ -32,6 +32,7 @@
#include "weston.h"
#include "weston-screenshooter-server-protocol.h"
#include "shared/helpers.h"
+#include "file-util.h"
struct screenshooter {
struct weston_compositor *ec;
@@ -142,7 +143,8 @@ recorder_binding(struct weston_keyboard *keyboard, uint32_t time,
struct weston_output *output;
struct screenshooter *shooter = data;
struct weston_recorder *recorder = shooter->recorder;;
- static const char filename[] = "capture.wcap";
+ char filename[256], timestr[128];
+ int ret;
if (recorder) {
weston_recorder_stop(recorder);
@@ -154,6 +156,15 @@ recorder_binding(struct weston_keyboard *keyboard, uint32_t time,
output = container_of(ec->output_list.next,
struct weston_output, link);
+ if (current_time_str(timestr, sizeof(timestr),
+ "%F_%H-%M-%S") < 0)
+ return;
+
+ ret = snprintf(filename, sizeof(filename),
+ "capture-%s.wcap", timestr);
+ if (ret < 0 || (size_t)ret >= sizeof(filename))
+ return;
+
shooter->recorder = weston_recorder_start(output, filename);
}
}
--
2.7.4
More information about the wayland-devel
mailing list