aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/x11grab.c
diff options
context:
space:
mode:
authorPanagiotis Issaris <takis.issaris@uhasselt.be>2007-02-02 17:54:50 +0000
committerPanagiotis Issaris <takis.issaris@uhasselt.be>2007-02-02 17:54:50 +0000
commitca4544409e32d692504b44e4ae804c3538993904 (patch)
tree5045aef613fb55e804a5d1c24d878b2c88f0c828 /libavformat/x11grab.c
parent8165ee939434ffc9ea9b95d01ce6cb75615223a4 (diff)
downloadffmpeg-ca4544409e32d692504b44e4ae804c3538993904.tar.gz
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. Originally committed as revision 7808 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/x11grab.c')
-rw-r--r--libavformat/x11grab.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/x11grab.c b/libavformat/x11grab.c
index 66e3be537c..86b13ed548 100644
--- a/libavformat/x11grab.c
+++ b/libavformat/x11grab.c
@@ -70,6 +70,7 @@ typedef struct x11_grab_s
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_read_header(AVFormatContext *s1, AVFormatParameters *ap)
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 @@ get_pointer_coordinates(int *x, int *y, Display *dpy, AVFormatContext *s1)
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;
}