[x264-devel] [PATCH] fix waitkey work on the display window instead of exec console

Limin Wang lance.lmwang at gmail.com
Wed Jan 31 12:39:00 CET 2007


Hi,

When I try with x264 visual function, it's very difficult to
go to next frame for getchar() will focus on the exec console.
After the patch, you can press any key in your current desktop
to get the next display frame.

Thanks,
Limin
-------------- next part --------------
Index: common/display.h
===================================================================
--- common/display.h	(revision 622)
+++ common/display.h	(working copy)
@@ -34,5 +34,6 @@
 void disp_point(int num, int x1, int y1);
 void disp_line(int num, int x1, int y1, int x2, int y2);
 void disp_rect(int num, int x1, int y1, int x2, int y2);
+void disp_waitkey();
 
 #endif
Index: common/display-x11.c
===================================================================
--- common/display-x11.c	(revision 622)
+++ common/display-x11.c	(working copy)
@@ -228,3 +228,17 @@
 	XDrawRectangle(disp_display, disp_window[num].window, gc, x1, y1, x2-x1, y2-y1);
 //	XSync(disp_display, 1);
 }
+
+/* wait for a keypress */
+void disp_waitkey()
+{
+    XEvent xev;
+
+    while (1) {
+        XNextEvent(disp_display, &xev);
+        if (xev.type==KeyPress) {
+            break;
+        }
+    }
+}
+
Index: common/visualize.c
===================================================================
--- common/visualize.c	(revision 622)
+++ common/visualize.c	(working copy)
@@ -324,7 +324,7 @@
     }
 
     disp_sync();
-    if (waitkey) getchar();
+    if (waitkey) disp_waitkey();
 }
 /* }}} */
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: not available
Url : http://mailman.videolan.org/pipermail/x264-devel/attachments/20070131/4f43b82e/attachment.pgp 


More information about the x264-devel mailing list