changeset 1753:d0a97c73ee97 libavformat

Make x11grab output its warning that it couldn't find the mouse pointer only once. This prevents flooding of the terminal when grabbing from a different X-screen.
author takis
date Fri, 02 Feb 2007 17:54:50 +0000
parents 12a896fa993b
children 1f7a6dc01100
files x11grab.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/x11grab.c	Fri Feb 02 14:33:25 2007 +0000
+++ b/x11grab.c	Fri Feb 02 17:54:50 2007 +0000
@@ -70,6 +70,7 @@
     XImage *image;           /**< X11 image holding the grab */
     int use_shm;             /**< !0 when using XShm extension */
     XShmSegmentInfo shminfo; /**< When using XShm, keeps track of XShm infos */
+    int mouse_warning_shown;
 } x11_grab_t;
 
 /**
@@ -237,6 +238,7 @@
     x11grab->y_off = y_off;
     x11grab->image = image;
     x11grab->use_shm = use_shm;
+    x11grab->mouse_warning_shown = 0;
 
     st->codec->codec_type = CODEC_TYPE_VIDEO;
     st->codec->codec_id = CODEC_ID_RAWVIDEO;
@@ -268,7 +270,11 @@
     if (XQueryPointer(dpy, mrootwindow, &mrootwindow, &childwindow,
                       x, y, &dummy, &dummy, (unsigned int*)&dummy)) {
     } else {
-        av_log(s1, AV_LOG_INFO, "couldn't find mouse pointer\n");
+        x11_grab_t *s = s1->priv_data;
+        if (!s->mouse_warning_shown) {
+            av_log(s1, AV_LOG_INFO, "couldn't find mouse pointer\n");
+            s->mouse_warning_shown = 1;
+        }
         *x = -1;
         *y = -1;
     }