diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 8c0d3938f..23a0f71e2 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -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 diff --git a/src/zm_monitorstream.cpp b/src/zm_monitorstream.cpp index fe6a51fa5..27e82b83b 100644 --- a/src/zm_monitorstream.cpp +++ b/src/zm_monitorstream.cpp @@ -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; diff --git a/src/zm_stream.h b/src/zm_stream.h index 827908e6d..d89d97e7f 100644 --- a/src/zm_stream.h +++ b/src/zm_stream.h @@ -90,6 +90,8 @@ protected: CMD_GET_IMAGE, CMD_QUIT, CMD_MAXFPS, + CMD_ANALYZE_ON, + CMD_ANALYZE_OFF, CMD_QUERY=99 } MsgCommand; diff --git a/web/includes/config.php.in b/web/includes/config.php.in index fcd3a936d..b30aebdea 100644 --- a/web/includes/config.php.in +++ b/web/includes/config.php.in @@ -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); //