diff -u motion-3.2.11/motion.c motion-3.2.11my/motion.c --- motion-3.2.11/motion.c 2008-09-21 17:20:58.000000000 -0600 +++ motion-3.2.11my/motion.c 2009-04-27 20:09:29.751665605 -0600 @@ -562,6 +562,7 @@ cnt->lightswitch_framecounter = 0; cnt->detecting_motion = 0; cnt->makemovie = 0; + cnt->autobright_counter = 0; motion_log(LOG_DEBUG, 0, "Thread %d started", (unsigned long)pthread_getspecific(tls_key_threadnr)); diff -u motion-3.2.11/motion.h motion-3.2.11my/motion.h --- motion-3.2.11/motion.h 2008-09-21 17:20:58.000000000 -0600 +++ motion-3.2.11my/motion.h 2009-04-27 20:09:22.428413294 -0600 @@ -339,6 +339,8 @@ char text_event_string[PATH_MAX]; /* The text for conv. spec. %C - we assume PATH_MAX normally 4096 characters is fine */ int postcap; /* downcounter, frames left to to send post event */ + + int autobright_counter; /* used to delay adjustments to brightness */ short int shots; unsigned short int detecting_motion; diff -u motion-3.2.11/video_common.c motion-3.2.11my/video_common.c --- motion-3.2.11/video_common.c 2008-09-21 17:20:58.000000000 -0600 +++ motion-3.2.11my/video_common.c 2009-04-27 20:33:59.090667567 -0600 @@ -465,6 +465,7 @@ #define AUTOBRIGHT_DAMPER 5 #define AUTOBRIGHT_MAX 255 #define AUTOBRIGHT_MIN 0 +#define AUTOBRIGHT_DELAY 5 int vid_do_autobright(struct context *cnt, struct video_dev *viddev) { @@ -476,6 +477,12 @@ unsigned char *image = cnt->imgs.image_virgin; /* Or cnt->current_image ? */ int make_change = 0; + + if (cnt->autobright_counter) { + /* too soon since last adjustment, don't make another one */ + cnt->autobright_counter--; + return 0; + } if (cnt->conf.brightness) brightness_target = cnt->conf.brightness; @@ -506,6 +513,8 @@ make_change = 1; } } + if (make_change) + cnt->autobright_counter = AUTOBRIGHT_DELAY; return make_change; }