add a non-const version of StartTime() which we need in order to assign to video_data->recording

This commit is contained in:
Isaac Connor 2017-04-12 13:36:39 -04:00
parent 669a23c408
commit 7e920eb5d3
1 changed files with 10 additions and 8 deletions

View File

@ -425,7 +425,7 @@ Monitor::Monitor(
trigger_data->trigger_text[0] = 0; trigger_data->trigger_text[0] = 0;
trigger_data->trigger_showtext[0] = 0; trigger_data->trigger_showtext[0] = 0;
shared_data->valid = true; shared_data->valid = true;
video_store_data->recording = false; video_store_data->recording = (struct timeval){0};
snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "nothing"); snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "nothing");
video_store_data->size = sizeof(VideoStoreData); video_store_data->size = sizeof(VideoStoreData);
//video_store_data->frameNumber = 0; //video_store_data->frameNumber = 0;
@ -1389,7 +1389,7 @@ bool Monitor::Analyse() {
shared_data->last_event = event->Id(); shared_data->last_event = event->Id();
//set up video store data //set up video store data
snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "%s", event->getEventFile()); snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "%s", event->getEventFile());
video_store_data->recording = true; video_store_data->recording = event->StartTime();
Info( "%s: %03d - Opening new event %d, section start", name, image_count, event->Id() ); Info( "%s: %03d - Opening new event %d, section start", name, image_count, event->Id() );
@ -1492,7 +1492,7 @@ bool Monitor::Analyse() {
shared_data->last_event = event->Id(); shared_data->last_event = event->Id();
//set up video store data //set up video store data
snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "%s", event->getEventFile()); snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "%s", event->getEventFile());
video_store_data->recording = true; video_store_data->recording = event->StartTime();
Info( "%s: %03d - Opening new event %d, alarm start", name, image_count, event->Id() ); Info( "%s: %03d - Opening new event %d, alarm start", name, image_count, event->Id() );
@ -1601,9 +1601,11 @@ bool Monitor::Analyse() {
event->updateNotes( noteSetMap ); event->updateNotes( noteSetMap );
} else if ( state == TAPE ) { } else if ( state == TAPE ) {
//Video Storage: activate only for supported cameras. Event::AddFrame knows whether or not we are recording video and saves frames accordingly //Video Storage: activate only for supported cameras. Event::AddFrame knows whether or not we are recording video and saves frames accordingly
if((GetOptVideoWriter() == 2) && camera->SupportsNativeVideo()) { //if((GetOptVideoWriter() == 2) && camera->SupportsNativeVideo()) {
video_store_data->recording = true; // I don't think this is required, and causes problems, as the event file hasn't been setup yet.
} //Warning("In state TAPE,
//video_store_data->recording = event->StartTime();
//}
if ( !(image_count%(frame_skip+1)) ) { if ( !(image_count%(frame_skip+1)) ) {
if ( config.bulk_frame_interval > 1 ) { if ( config.bulk_frame_interval > 1 ) {
event->AddFrame( snap_image, *timestamp, (event->Frames()<pre_event_count?0:-1) ); event->AddFrame( snap_image, *timestamp, (event->Frames()<pre_event_count?0:-1) );
@ -3010,7 +3012,7 @@ bool Monitor::closeEvent() {
gettimeofday( &(event->EndTime()), NULL ); gettimeofday( &(event->EndTime()), NULL );
} }
delete event; delete event;
video_store_data->recording = false; video_store_data->recording = (struct timeval){0};
event = 0; event = 0;
return( true ); return( true );
} }