From 09d02e94d9c79f4d569c9805740b7b96ae44c274 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 23 Jul 2020 11:53:54 -0400 Subject: [PATCH] fix lack of c_str on path --- src/zm_event.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 0193172ac..b9b39c3ab 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -495,7 +495,7 @@ void Event::AddFramesInternal(int n_frames, int start_frame, Image **images, str frames++; if ( monitor->GetOptSaveJPEGs() & 1 ) { - std::string event_file = stringtf(staticConfig.capture_file_format, path, frames); + std::string event_file = stringtf(staticConfig.capture_file_format, path.c_str(), frames); Debug(1, "Writing pre-capture frame %d", frames); WriteFrameImage(images[i], *(timestamps[i]), event_file.c_str()); } @@ -606,8 +606,8 @@ void Event::AddFrame(Image *image, struct timeval timestamp, int score, Image *a score = 0; if ( monitor->GetOptSaveJPEGs() & 1 ) { - std::string event_file = stringtf(staticConfig.capture_file_format, path, frames); - Debug(1, "Writing capture frame %d to %s", frames, event_file.c_str()); + std::string event_file = stringtf(staticConfig.capture_file_format, path.c_str(), frames); + Debug(1, "Writing capture frame %d to %s using %s %d %s", frames, event_file.c_str()); if ( !WriteFrameImage(image, timestamp, event_file.c_str()) ) { Error("Failed to write frame image"); } @@ -635,7 +635,7 @@ void Event::AddFrame(Image *image, struct timeval timestamp, int score, Image *a if ( alarm_image ) { if ( monitor->GetOptSaveJPEGs() & 2 ) { - std::string event_file = stringtf(staticConfig.analyse_file_format, path, frames); + std::string event_file = stringtf(staticConfig.analyse_file_format, path.c_str(), frames); Debug(1, "Writing analysis frame %d", frames); if ( ! WriteFrameImage(alarm_image, timestamp, event_file.c_str(), true) ) { Error("Failed to write analysis frame image"); @@ -657,7 +657,7 @@ void Event::AddFrame(Image *image, struct timeval timestamp, int score, Image *a // The idea is to write out 1/sec frame_data.push(new Frame(id, frames, frame_type, timestamp, delta_time, score)); - if ( write_to_db || (frame_data.size() > (unsigned int)monitor->get_fps()) ) { + if ( write_to_db || ( monitor->get_fps() && (frame_data.size() > (unsigned int)monitor->get_fps())) ) { Debug(1, "Adding %d frames to DB because write_to_db:%d or frames > fps %d", frame_data.size(), write_to_db, (unsigned int)monitor->get_fps()); WriteDbFrames();