Add CMD_ANALYZE_ON and OFF

This commit is contained in:
Isaac Connor 2020-09-08 17:41:36 -04:00
parent 24bb43bbeb
commit df0a0c7853
4 changed files with 13 additions and 10 deletions

View File

@ -1023,7 +1023,11 @@ bool Monitor::connect() {
image_buffer[i] = new Image(width, height, camera->Colours(), camera->SubpixelOrder(), &(shared_images[i*camera->ImageSize()]));
image_buffer[i]->HoldBuffer(true); /* Don't release the internal buffer or replace it with another */
}
alarm_image.AssignDirect(width, height, camera->Colours(), camera->SubpixelOrder(), &(shared_images[image_buffer_count*camera->ImageSize()]));
alarm_image.AssignDirect(width, height, camera->Colours(), camera->SubpixelOrder(),
&(shared_images[image_buffer_count*camera->ImageSize()]),
camera->ImageSize(),
ZM_BUFTYPE_DONTFREE
);
alarm_image.HoldBuffer(true); /* Don't release the internal buffer or replace it with another */
Debug(3, "Allocated %zu %zu image buffers", image_buffer.capacity(), image_buffer.size());
@ -1220,12 +1224,8 @@ void Monitor::AddPrivacyBitmask() {
privacy_bitmask = privacy_image->Buffer();
}
Monitor::State Monitor::GetState() const {
return (State)shared_data->state;
}
Image &Monitor::GetAlarmImage() {
return alarm_image;
Image *Monitor::GetAlarmImage() {
return &alarm_image;
}
int Monitor::GetImage(int32_t index, int scale) {
@ -2129,7 +2129,6 @@ bool Monitor::Analyse() {
shared_data->state = state = TAPE;
}
}
<<<<<<< HEAD
} else if (state == PREALARM) {
// Back to IDLE
shared_data->state = state = ((function != MOCORD) ? IDLE : TAPE);
@ -2161,7 +2160,7 @@ bool Monitor::Analyse() {
snap->analysis_image->Overlay(*(zone.AlarmImage()));
} // end if zone is alarmed
} // end foreach zone
alarm_image.Assign(snap->analysis_imageimage);
alarm_image.Assign(*snap->analysis_image);
} // end if savejpegs
// incremement pre alarm image count

View File

@ -743,7 +743,7 @@ void MonitorStream::runStream() {
if (frame_count == 0) {
// Chrome will not display the first frame until it receives another.
// Firefox is fine. So just send the first frame twice.
if (!sendFrame(image, last_frame_timestamp)) {
if (!sendFrame(send_image, last_frame_timestamp)) {
Debug(2, "sendFrame failed, quiting.");
zm_terminate = true;
break;

View File

@ -90,6 +90,8 @@ protected:
CMD_GET_IMAGE,
CMD_QUIT,
CMD_MAXFPS,
CMD_ANALYZE_ON,
CMD_ANALYZE_OFF,
CMD_QUERY=99
} MsgCommand;

View File

@ -120,6 +120,8 @@ define('CMD_SEEK', 14 );
define('CMD_VARPLAY', 15);
define('CMD_QUIT', 17);
define('CMD_MAXFPS', 18);
define('CMD_ANALYZE_ON', 19);
define('CMD_ANALYZE_OFF', 20);
define('CMD_QUERY', 99);
//