From 47b2cdbb962ca28aeb1904cf8e38d591ad7a9b15 Mon Sep 17 00:00:00 2001 From: arjunrc Date: Fri, 29 Jan 2016 09:58:50 -0500 Subject: [PATCH 1/3] added CMD_QUIT to kill zms via command --- src/zm_event.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 5cf99de818..1f1fb0f0bd 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -1088,6 +1088,11 @@ void EventStream::processCommand( const CmdMsg *msg ) Debug( 1, "Got QUERY command, sending STATUS" ); break; } + case CMD_QUIT : + { + Info ("User initiated exit - CMD_QUIT"); + break; + } default : { // Do nothing, for now @@ -1125,6 +1130,9 @@ void EventStream::processCommand( const CmdMsg *msg ) exit( -1 ); } } + // quit after sending a status, if this was a quit request + if ((MsgCommand)msg->msg_data[0]==CMD_QUIT) + exit(0); updateFrameRate( (double)event_data->frame_count/event_data->duration ); } From 38bca6b95d24f71ff915d2a0035b23cf23503f67 Mon Sep 17 00:00:00 2001 From: arjunrc Date: Fri, 29 Jan 2016 09:58:57 -0500 Subject: [PATCH 2/3] added CMD_QUIT to kill zms via command --- src/zm_monitor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index b95b1b43c8..20b8b78020 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -3922,6 +3922,11 @@ void MonitorStream::processCommand( const CmdMsg *msg ) Debug( 1, "Got SCALE command, to %d", scale ); break; } + case CMD_QUIT : + { + Info ("User initiated exit - CMD_QUIT"); + break; + } case CMD_QUERY : { Debug( 1, "Got QUERY command, sending STATUS" ); @@ -3987,6 +3992,10 @@ void MonitorStream::processCommand( const CmdMsg *msg ) } } + // quit after sending a status, if this was a quit request + if ((MsgCommand)msg->msg_data[0]==CMD_QUIT) + exit(0); + updateFrameRate( monitor->GetFPS() ); } From 904f584fcbe4813ec5ba18e1e600c016337a1b19 Mon Sep 17 00:00:00 2001 From: arjunrc Date: Fri, 29 Jan 2016 10:00:02 -0500 Subject: [PATCH 3/3] CMD_QUIT definition --- src/zm_stream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_stream.h b/src/zm_stream.h index 9936688a8c..4f6442725a 100644 --- a/src/zm_stream.h +++ b/src/zm_stream.h @@ -57,7 +57,7 @@ class StreamBase } DataMsg; typedef enum { MSG_CMD=1, MSG_DATA_WATCH, MSG_DATA_EVENT } MsgType; - typedef enum { CMD_NONE=0, CMD_PAUSE, CMD_PLAY, CMD_STOP, CMD_FASTFWD, CMD_SLOWFWD, CMD_SLOWREV, CMD_FASTREV, CMD_ZOOMIN, CMD_ZOOMOUT, CMD_PAN, CMD_SCALE, CMD_PREV, CMD_NEXT, CMD_SEEK, CMD_VARPLAY, CMD_GET_IMAGE, CMD_QUERY=99 } MsgCommand; + typedef enum { CMD_NONE=0, CMD_PAUSE, CMD_PLAY, CMD_STOP, CMD_FASTFWD, CMD_SLOWFWD, CMD_SLOWREV, CMD_FASTREV, CMD_ZOOMIN, CMD_ZOOMOUT, CMD_PAN, CMD_SCALE, CMD_PREV, CMD_NEXT, CMD_SEEK, CMD_VARPLAY, CMD_GET_IMAGE, CMD_QUIT, CMD_QUERY=99 } MsgCommand; protected: Monitor *monitor;