From 2dff69dc14ef8f59e8ae9e50dfa6b973d42f3369 Mon Sep 17 00:00:00 2001 From: "m.Rcu" <> Date: Tue, 24 Jan 2012 22:40:06 +0100 Subject: Add support for grab jpeg image. --- video.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'video.c') diff --git a/video.c b/video.c index 5e1d84a..02628e0 100644 --- a/video.c +++ b/video.c @@ -7739,7 +7739,7 @@ int64_t VideoGetClock(void) /// /// Grab full screen image. /// -uint8_t *VideoGrab(int *size, int *width, int *height) +uint8_t *VideoGrab(int *size, int *width, int *height, int write_header) { Debug(3, "video: grab\n"); @@ -7771,9 +7771,11 @@ uint8_t *VideoGrab(int *size, int *width, int *height) if (scale_height <= 0) { scale_height = *height; } - - n = snprintf(buf, sizeof(buf), "P6\n%d\n%d\n255\n", scale_width, - scale_height); + n = 0; + if (write_header) { + n = snprintf(buf, sizeof(buf), "P6\n%d\n%d\n255\n", scale_width, + scale_height); + } rgb = malloc(scale_width * scale_height * 3 + n); if (!rgb) { Error(_("video: out of memory\n")); -- cgit v1.2.3