[gnome-shell] ShellRecorder: Fix interaction of glReadPixels with Cogl
- From: Owen Taylor <otaylor src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] ShellRecorder: Fix interaction of glReadPixels with Cogl
- Date: Thu, 28 Jan 2010 18:56:40 +0000 (UTC)
commit 8db212db995e36ffe2759fafc4f7192ed8060e52
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Wed Jan 27 08:24:36 2010 -0500
ShellRecorder: Fix interaction of glReadPixels with Cogl
The screen recording wasn't working because of two bad interactions
with Cogl:
- Buffered primitives weren't being flushed out
- Cogl changes the pixel store values away from their default values
Thanks for Jon Nettleton for tracking down the source of the
problems with the recorder.
https://bugzilla.gnome.org/show_bug.cgi?id=598390
src/shell-recorder.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/shell-recorder.c b/src/shell-recorder.c
index 4c0304e..cba642b 100644
--- a/src/shell-recorder.c
+++ b/src/shell-recorder.c
@@ -504,6 +504,24 @@ recorder_record_frame (ShellRecorder *recorder)
GST_BUFFER_TIMESTAMP(buffer) = get_wall_time() - recorder->start_time;
+ /* We could use cogl_read_pixels, but it only currently supports
+ * COGL_PIXEL_FORMAT_RGBA_8888, while we prefer the native framebuffer
+ * format. (COGL_PIXEL_FORMAT_ARGB_8888_PRE,
+ * COGL_PIXEL_FORMAT_BGRA_PRE, depending on endianess)
+ *
+ * http://bugzilla.openedhand.com/show_bug.cgi?id=1959
+ */
+
+ /* Flush any primitives that Cogl has batched up */
+ cogl_flush ();
+
+ /* Set the parameters for how data is stored; these are the initial
+ * values but Cogl will have modified them for its own purposes */
+ glPixelStorei (GL_PACK_ALIGNMENT, 4);
+ glPixelStorei (GL_PACK_ROW_LENGTH, 0);
+ glPixelStorei (GL_PACK_SKIP_PIXELS, 0);
+ glPixelStorei (GL_PACK_SKIP_ROWS, 0);
+
glReadBuffer (GL_BACK_LEFT);
glReadPixels (0, 0,
recorder->stage_width, recorder->stage_height,
@@ -1038,6 +1056,10 @@ recorder_pipeline_add_source (RecorderPipeline *pipeline)
* that we might have a smaller buffer to flip; on the other hand flipping
* YUV 422 is more complicated than flipping RGB. Probably a toss-up.
*
+ * When available MESA_pack_invert extension could be used to avoid the
+ * flip entirely, since the data is actually stored in the frame buffer
+ * in the order that we expect.
+ *
* We use gst_parse_launch to avoid having to know the enum value for flip-vertical
*/
videoflip = gst_parse_launch_full ("videoflip method=vertical-flip", NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]