Fix bulk frame code and move it to event. Revert base score to 0. Fix cause of continuous events. Move GetState to .h

This commit is contained in:
Isaac Connor 2021-02-03 16:57:44 -05:00
parent 35470951ad
commit cb60b6c141
2 changed files with 7 additions and 18 deletions

View File

@ -1136,10 +1136,6 @@ void Monitor::AddPrivacyBitmask(Zone *p_zones[]) {
privacy_bitmask = privacy_image->Buffer(); privacy_bitmask = privacy_image->Buffer();
} }
Monitor::State Monitor::GetState() const {
return (State)shared_data->state;
}
int Monitor::GetImage(int index, int scale) { int Monitor::GetImage(int index, int scale) {
if ( index < 0 || index > image_buffer_count ) { if ( index < 0 || index > image_buffer_count ) {
index = shared_data->last_write_index; index = shared_data->last_write_index;
@ -1807,7 +1803,7 @@ bool Monitor::Analyse() {
// if we have been told to be OFF, then we are off and don't do any processing. // if we have been told to be OFF, then we are off and don't do any processing.
if ( trigger_data->trigger_state != TRIGGER_OFF ) { if ( trigger_data->trigger_state != TRIGGER_OFF ) {
Debug(4, "Trigger not OFF state is (%d)", trigger_data->trigger_state); Debug(4, "Trigger not OFF state is (%d)", trigger_data->trigger_state);
int score = -1; int score = 0;
// Ready means that we have captured the warmpup # of frames // Ready means that we have captured the warmpup # of frames
if ( Ready() ) { if ( Ready() ) {
Debug(4, "Ready"); Debug(4, "Ready");
@ -1964,7 +1960,7 @@ bool Monitor::Analyse() {
ZMPacket *starting_packet = *(*start_it); ZMPacket *starting_packet = *(*start_it);
event = new Event(this, *(starting_packet->timestamp), cause, noteSetMap); event = new Event(this, *(starting_packet->timestamp), "Continuous", noteSetMap);
// Write out starting packets, do not modify packetqueue it will garbage collect itself // Write out starting packets, do not modify packetqueue it will garbage collect itself
while ( (*start_it) != snap_it ) { while ( (*start_it) != snap_it ) {
ZMPacket *p = packetqueue.get_packet(start_it); ZMPacket *p = packetqueue.get_packet(start_it);
@ -2004,7 +2000,7 @@ bool Monitor::Analyse() {
} // end if ! event } // end if ! event
} // end if RECORDING } // end if RECORDING
if ( score > 0 ) { if ( score ) {
if ( (state == IDLE) || (state == TAPE) || (state == PREALARM) ) { if ( (state == IDLE) || (state == TAPE) || (state == PREALARM) ) {
// If we should end then previous continuous event and start a new non-continuous event // If we should end then previous continuous event and start a new non-continuous event
if ( event && event->Frames() if ( event && event->Frames()
@ -2169,13 +2165,7 @@ bool Monitor::Analyse() {
if ( noteSetMap.size() > 0 ) if ( noteSetMap.size() > 0 )
event->updateNotes(noteSetMap); event->updateNotes(noteSetMap);
} else if ( state == TAPE ) { } else if ( state == TAPE ) {
//if ( !(analysis_image_count%(frame_skip+1)) ) { // bulk frame code moved to event.
//if ( config.bulk_frame_interval > 1 ) {
//event->AddFrame( snap_image, *timestamp, (event->Frames()<pre_event_count?0:-1) );
//} else {
//event->AddFrame( snap_image, *timestamp );
//}
//}
} // end if state machine } // end if state machine
if ( (function == MODECT or function == MOCORD) and snap->image ) { if ( (function == MODECT or function == MOCORD) and snap->image ) {
@ -2200,9 +2190,7 @@ bool Monitor::Analyse() {
trigger_data->trigger_state = TRIGGER_CANCEL; trigger_data->trigger_state = TRIGGER_CANCEL;
} // end if ( trigger_data->trigger_state != TRIGGER_OFF ) } // end if ( trigger_data->trigger_state != TRIGGER_OFF )
if ( event ) { if ( event ) event->AddPacket(snap);
event->AddPacket(snap);
}
// popPacket will have placed a second lock on snap, so release it here. // popPacket will have placed a second lock on snap, so release it here.
snap->unlock(); snap->unlock();

View File

@ -479,7 +479,8 @@ public:
unsigned int GetPreEventCount() const { return pre_event_count; }; unsigned int GetPreEventCount() const { return pre_event_count; };
int GetImageBufferCount() const { return image_buffer_count; }; int GetImageBufferCount() const { return image_buffer_count; };
State GetState() const; State GetState() const { return (State)shared_data->state; }
int GetImage( int index=-1, int scale=100 ); int GetImage( int index=-1, int scale=100 );
ZMPacket *getSnapshot( int index=-1 ) const; ZMPacket *getSnapshot( int index=-1 ) const;
struct timeval GetTimestamp( int index=-1 ) const; struct timeval GetTimestamp( int index=-1 ) const;