mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-24 07:18:22 -04:00
Added last event id to shared memory for auto-filtering etc.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@125 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
1 parent
263f4766b1
commit
e4072d56af
3 files changed
+19
-1
No files matched your search
@@ -1460,6 +1460,7 @@ Monitor::Monitor( int p_id, char *p_name, int p_function, int p_device, int p_ch
|
||||
shared_images->state = IDLE;
|
||||
shared_images->last_write_index = image_buffer_count;
|
||||
shared_images->last_read_index = image_buffer_count;
|
||||
shared_images->last_event = 0;
|
||||
}
|
||||
shared_images->timestamps = (time_t *)(shm_ptr+sizeof(SharedImages));
|
||||
shared_images->images = (unsigned char *)(shm_ptr+sizeof(SharedImages)+(image_buffer_count*sizeof(time_t)));
|
||||
@@ -1593,6 +1594,11 @@ unsigned int Monitor::GetLastWriteIndex() const
|
||||
return( shared_images->last_write_index );
|
||||
}
|
||||
|
||||
unsigned int Monitor::GetLastEvent() const
|
||||
{
|
||||
return( shared_images->last_event );
|
||||
}
|
||||
|
||||
double Monitor::GetFPS() const
|
||||
{
|
||||
int index1 = shared_images->last_write_index;
|
||||
@@ -1775,6 +1781,7 @@ bool Monitor::Analyse()
|
||||
if ( image_count-last_alarm_count > post_event_count )
|
||||
{
|
||||
Info(( "%s: %03d - Left alarm state (%d) - %d(%d) images\n", name, image_count, event->id, event->frames, event->alarm_frames ));
|
||||
shared_images->last_event = event->id;
|
||||
delete event;
|
||||
shared_images->state = state = IDLE;
|
||||
}
|
||||
|
||||
@@ -604,6 +604,7 @@ protected:
|
||||
State state;
|
||||
int last_write_index;
|
||||
int last_read_index;
|
||||
int last_event;
|
||||
time_t *timestamps;
|
||||
unsigned char *images;
|
||||
} SharedImages;
|
||||
@@ -623,6 +624,7 @@ public:
|
||||
time_t GetTimestamp( int index=-1 ) const;
|
||||
unsigned int GetLastReadIndex() const;
|
||||
unsigned int GetLastWriteIndex() const;
|
||||
unsigned int GetLastEvent() const;
|
||||
double GetFPS() const;
|
||||
|
||||
void CheckFunction();
|
||||
|
||||
+10
-1
@@ -32,6 +32,7 @@ void Usage()
|
||||
fprintf( stderr, " ring buffer index if given\n" );
|
||||
fprintf( stderr, " -r, --read_index : Output ring buffer read index\n" );
|
||||
fprintf( stderr, " -w, --write_index : Output ring buffer write index\n" );
|
||||
fprintf( stderr, " -e, --event : Output last event index\n" );
|
||||
fprintf( stderr, " -f, --fps : Output last Frames Per Second captured reading\n" );
|
||||
fprintf( stderr, " -z, --zones : Write last captured image overlaid with zones to <monitor_name>-Zones.jpg\n" );
|
||||
fprintf( stderr, " -h, --help - This screen\n" );
|
||||
@@ -48,6 +49,7 @@ int main( int argc, char *argv[] )
|
||||
{"state", 0, 0, 's'},
|
||||
{"read_index", 0, 0, 'r'},
|
||||
{"write_index", 0, 0, 'w'},
|
||||
{"event", 0, 0, 'e'},
|
||||
{"fps", 0, 0, 'f'},
|
||||
{"zones", 0, 0, 'z'},
|
||||
{"help", 0, 0, 'h'},
|
||||
@@ -55,7 +57,7 @@ int main( int argc, char *argv[] )
|
||||
};
|
||||
|
||||
int id = 1;
|
||||
enum { BOGUS, STATE, IMAGE, TIME, READ_IDX, WRITE_IDX, FPS, ZONES } function = BOGUS;
|
||||
enum { BOGUS, STATE, IMAGE, TIME, READ_IDX, WRITE_IDX, EVENT, FPS, ZONES } function = BOGUS;
|
||||
int image_idx = -1;
|
||||
while (1)
|
||||
{
|
||||
@@ -97,6 +99,9 @@ int main( int argc, char *argv[] )
|
||||
case 'w':
|
||||
function = WRITE_IDX;
|
||||
break;
|
||||
case 'e':
|
||||
function = EVENT;
|
||||
break;
|
||||
case 'f':
|
||||
function = FPS;
|
||||
break;
|
||||
@@ -171,6 +176,10 @@ int main( int argc, char *argv[] )
|
||||
{
|
||||
printf( "%d\n", monitor->GetLastWriteIndex() );
|
||||
}
|
||||
else if ( function == EVENT )
|
||||
{
|
||||
printf( "%d\n", monitor->GetLastEvent() );
|
||||
}
|
||||
else if ( function == FPS )
|
||||
{
|
||||
printf( "%.2f\n", monitor->GetFPS() );
|
||||
|
||||
Reference in new issue
Block a user