summaryrefslogtreecommitdiff
path: root/src/screenshooter.c
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2013-12-17 14:18:01 +0200
committerKristian Høgsberg <krh@bitplanet.net>2013-12-17 10:59:06 -0800
commite22f3bb5da5d22f1bb6056de1069f7f1c08cc62b (patch)
tree03ba01893bcb0d4da734f18f580b05466b5ef3cc /src/screenshooter.c
parentc2010b3af025ea70aa8b7688cca56b0082567f34 (diff)
downloadweston-e22f3bb5da5d22f1bb6056de1069f7f1c08cc62b.tar.gz
screenshooter: Record one extra frame when recording stops
If the compositor hasn't been rendering for a while when the recording stops, the time difference between the last rendered frame and that moment won't be in the encoded video. Fix that by forcing one extra frame to be recorded when the user presses the recorder key binding. https://bugs.freedesktop.org/show_bug.cgi?id=71142
Diffstat (limited to 'src/screenshooter.c')
-rw-r--r--src/screenshooter.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/screenshooter.c b/src/screenshooter.c
index 0c657bc8..2d05ad61 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -267,7 +267,7 @@ struct weston_recorder {
uint32_t total;
int fd;
struct wl_listener frame_listener;
- int count;
+ int count, destroying;
};
static uint32_t *
@@ -356,6 +356,9 @@ transform_rect(struct weston_output *output, pixman_box32_t *r)
}
static void
+weston_recorder_destroy(struct weston_recorder *recorder);
+
+static void
weston_recorder_frame_notify(struct wl_listener *listener, void *data)
{
struct weston_recorder *recorder =
@@ -456,6 +459,9 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data)
pixman_region32_fini(&damage);
recorder->count++;
+
+ if (recorder->destroying)
+ weston_recorder_destroy(recorder);
}
static void
@@ -477,6 +483,7 @@ weston_recorder_create(struct weston_output *output, const char *filename)
recorder->rect = malloc(size);
recorder->total = 0;
recorder->count = 0;
+ recorder->destroying = 0;
recorder->output = output;
if (do_yflip)
@@ -553,7 +560,8 @@ recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *da
"stopping recorder, total file size %dM, %d frames\n",
recorder->total / (1024 * 1024), recorder->count);
- weston_recorder_destroy(recorder);
+ recorder->destroying = 1;
+ weston_output_schedule_repaint(recorder->output);
} else {
weston_log("starting recorder, file %s\n", filename);
weston_recorder_create(output, filename);