FIFO support for zoneminder zone debugging (#2594)

Adds fifo options for diagnostic images for much lower impact diagnostics mode.  Diagnostic images are only written when there is a client listening for them (otherwise they are skipped).  Also added a json stream for the detection data so you can see in real time the pixels or blobs detected for the motion.  This allows for easy real time stream of both delta and reference images (as video streams) along with the detection numbers.
This commit is contained in:
Mitch Capper
2019-05-16 12:37:03 -07:00
committed by Isaac Connor
parent 4f44db8cbf
commit eb005e8b9c
12 changed files with 419 additions and 22 deletions

View File

@@ -28,6 +28,7 @@
#include "zm_monitor.h"
#include "zm_monitorstream.h"
#include "zm_eventstream.h"
#include "zm_fifo.h"
bool ValidateAccess( User *user, int mon_id ) {
bool allowed = true;
@@ -54,7 +55,7 @@ int main( int argc, const char *argv[] ) {
srand( getpid() * time( 0 ) );
enum { ZMS_UNKNOWN, ZMS_MONITOR, ZMS_EVENT } source = ZMS_UNKNOWN;
enum { ZMS_UNKNOWN, ZMS_MONITOR, ZMS_EVENT, ZMS_FIFO } source = ZMS_UNKNOWN;
enum { ZMS_JPEG, ZMS_MPEG, ZMS_RAW, ZMS_ZIP, ZMS_SINGLE } mode = ZMS_JPEG;
char format[32] = "";
int monitor_id = 0;
@@ -110,6 +111,8 @@ int main( int argc, const char *argv[] ) {
value = (char *)"";
if ( !strcmp(name, "source") ) {
source = !strcmp(value, "event")?ZMS_EVENT:ZMS_MONITOR;
if (! strcmp( value,"fifo") )
source = ZMS_FIFO;
} else if ( !strcmp(name, "mode") ) {
mode = !strcmp(value, "jpeg")?ZMS_JPEG:ZMS_MPEG;
mode = !strcmp(value, "raw")?ZMS_RAW:mode;
@@ -274,6 +277,11 @@ int main( int argc, const char *argv[] ) {
#endif // HAVE_LIBAVCODEC
}
stream.runStream();
} else if (source == ZMS_FIFO ) {
FifoStream stream;
stream.setStreamMaxFPS( maxfps );
stream.setStreamStart( monitor_id, format );
stream.runStream();
} else if ( source == ZMS_EVENT ) {
if ( ! event_id ) {
Fatal( "Can't view an event without specifying an event_id." );