mirror of
https://github.com/Motion-Project/motion.git
synced 2026-02-18 15:16:31 -05:00
Added a startup delay of 2 sec. If not fps is wrong in movie if it starts within this time e.g. output_all.
This commit is contained in:
9
motion.c
9
motion.c
@@ -753,6 +753,8 @@ static int motion_init(struct context *cnt)
|
||||
|
||||
/* Prevent first few frames from triggering motion... */
|
||||
cnt->moved = 8;
|
||||
/* 2 sec startup delay so FPS is calculated correct */
|
||||
cnt->startup_frames = cnt->conf.frame_limit * 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -987,6 +989,9 @@ static void *motion_loop(void *arg)
|
||||
/* Increase the shots variable for each frame captured within this second */
|
||||
cnt->shots++;
|
||||
|
||||
if (cnt->startup_frames > 0)
|
||||
cnt->startup_frames--;
|
||||
|
||||
if (get_image){
|
||||
if (cnt->conf.minimum_frame_time) {
|
||||
minimum_frame_time_downcounter = cnt->conf.minimum_frame_time;
|
||||
@@ -1429,13 +1434,13 @@ static void *motion_loop(void *arg)
|
||||
* If post_capture is enabled we also take care of this in the this
|
||||
* code section.
|
||||
*/
|
||||
if (cnt->conf.output_all) {
|
||||
if ( cnt->conf.output_all && (cnt->startup_frames == 0) ) {
|
||||
cnt->detecting_motion = 1;
|
||||
/* Setup the postcap counter */
|
||||
cnt->postcap = cnt->conf.post_capture;
|
||||
cnt->current_image->flags |= (IMAGE_TRIGGER | IMAGE_SAVE);
|
||||
motion_detected(cnt, cnt->video_dev, cnt->current_image);
|
||||
} else if (cnt->current_image->flags & IMAGE_MOTION) {
|
||||
} else if ( (cnt->current_image->flags & IMAGE_MOTION) && (cnt->startup_frames == 0) ) {
|
||||
/* Did we detect motion (like the cat just walked in :) )?
|
||||
* If so, ensure the motion is sustained if minimum_motion_frames
|
||||
*/
|
||||
|
||||
1
motion.h
1
motion.h
@@ -348,6 +348,7 @@ struct context {
|
||||
time_t connectionlosttime; /* timestamp from connection lost */
|
||||
|
||||
int lastrate;
|
||||
unsigned short int startup_frames;
|
||||
unsigned short int moved;
|
||||
unsigned short int pause;
|
||||
int missing_frame_counter; /* counts failed attempts to fetch picture frame from camera */
|
||||
|
||||
Reference in New Issue
Block a user