Merge branch 'master' into replace_function_concept
This commit is contained in:
commit
a40b305065
|
@ -715,3 +715,6 @@ Debug(1, "wakeing");
|
|||
}
|
||||
}
|
||||
}
|
||||
int Event::MonitorId() {
|
||||
return monitor->Id();
|
||||
}
|
||||
|
|
|
@ -188,5 +188,6 @@ class Event {
|
|||
void SavePreAlarmFrames() {
|
||||
EmptyPreAlarmFrames();
|
||||
}
|
||||
int MonitorId();
|
||||
};
|
||||
#endif // ZM_EVENT_H
|
||||
|
|
|
@ -98,7 +98,7 @@ void Image::update_function_pointers() {
|
|||
delta8_abgr = &std_delta8_abgr;
|
||||
delta8_gray8 = &std_delta8_gray8;
|
||||
blend = &std_blend;
|
||||
Warning("Using slow std functions because pixels %d mod 4=%d", pixels, pixels%4);
|
||||
Debug(1, "Using slow std functions because pixels %d mod 4=%d", pixels, pixels%4);
|
||||
} else {
|
||||
// Use either sse or neon, or loop unrolled version
|
||||
delta8_rgb = fptr_delta8_rgb;
|
||||
|
@ -1090,14 +1090,16 @@ bool Image::WriteJpeg(const std::string &filename,
|
|||
const int &quality_override,
|
||||
SystemTimePoint timestamp,
|
||||
bool on_blocking_abort) const {
|
||||
// jpeg libs are not thread safe
|
||||
std::unique_lock<std::mutex> lck(jpeg_mutex);
|
||||
|
||||
if (config.colour_jpeg_files && (colours == ZM_COLOUR_GRAY8)) {
|
||||
Image temp_image(*this);
|
||||
temp_image.Colourise(ZM_COLOUR_RGB24, ZM_SUBPIX_ORDER_RGB);
|
||||
return temp_image.WriteJpeg(filename, quality_override, timestamp, on_blocking_abort);
|
||||
}
|
||||
|
||||
// jpeg libs are not thread safe
|
||||
std::unique_lock<std::mutex> lck(jpeg_mutex);
|
||||
|
||||
int quality = quality_override ? quality_override : config.jpeg_file_quality;
|
||||
|
||||
jpeg_compress_struct *cinfo = writejpg_ccinfo[quality];
|
||||
|
@ -1167,7 +1169,7 @@ bool Image::WriteJpeg(const std::string &filename,
|
|||
} else if (subpixelorder == ZM_SUBPIX_ORDER_ABGR) {
|
||||
cinfo->in_color_space = JCS_EXT_XBGR;
|
||||
} else {
|
||||
Warning("Unknwon subpixelorder %d", subpixelorder);
|
||||
Warning("Unknown subpixelorder %d", subpixelorder);
|
||||
/* Assume RGBA */
|
||||
cinfo->in_color_space = JCS_EXT_RGBX;
|
||||
}
|
||||
|
|
|
@ -1838,8 +1838,8 @@ bool Monitor::Analyse() {
|
|||
Debug(1, "Linked monitor %d %s is connected",
|
||||
linked_monitors[i]->Id(), linked_monitors[i]->Name());
|
||||
if (linked_monitors[i]->hasAlarmed()) {
|
||||
Debug(1, "Linked monitor %d %s is alarmed",
|
||||
linked_monitors[i]->Id(), linked_monitors[i]->Name());
|
||||
Debug(1, "Linked monitor %d %s is alarmed score will be %d",
|
||||
linked_monitors[i]->Id(), linked_monitors[i]->Name(), linked_monitors[i]->lastFrameScore());
|
||||
if (!event) {
|
||||
if (first_link) {
|
||||
if (cause.length())
|
||||
|
@ -1961,6 +1961,9 @@ bool Monitor::Analyse() {
|
|||
} // end if active and doing motion detection
|
||||
|
||||
|
||||
// Set this before any state changes so that it's value is picked up immediately by linked monitors
|
||||
shared_data->last_frame_score = score;
|
||||
|
||||
// If motion detecting, score will be > 0 on motion, but if skipping frames, might not be. So also test snap->score
|
||||
if ((score > 0) or (snap->score > 0)) {
|
||||
if ((state == IDLE) || (state == TAPE) || (state == PREALARM)) {
|
||||
|
@ -2173,7 +2176,6 @@ bool Monitor::Analyse() {
|
|||
last_signal = signal;
|
||||
} // end if videostream
|
||||
} // end if signal
|
||||
shared_data->last_frame_score = score;
|
||||
} else {
|
||||
Debug(3, "trigger == off");
|
||||
if (event) {
|
||||
|
@ -2775,7 +2777,11 @@ Event * Monitor::openEvent(
|
|||
|
||||
if (!event_start_command.empty()) {
|
||||
if (fork() == 0) {
|
||||
execlp(event_start_command.c_str(), event_start_command.c_str(), std::to_string(event->Id()).c_str(), nullptr);
|
||||
execlp(event_start_command.c_str(),
|
||||
event_start_command.c_str(),
|
||||
std::to_string(event->Id()).c_str(),
|
||||
std::to_string(event->MonitorId()).c_str(),
|
||||
nullptr);
|
||||
Error("Error execing %s", event_start_command.c_str());
|
||||
}
|
||||
}
|
||||
|
@ -2815,11 +2821,15 @@ void Monitor::closeEvent() {
|
|||
Debug(1, "Starting thread to close event");
|
||||
close_event_thread = std::thread([](Event *e, const std::string &command){
|
||||
int64_t event_id = e->Id();
|
||||
int monitor_id = e->MonitorId();
|
||||
delete e;
|
||||
|
||||
if (!command.empty()) {
|
||||
if (fork() == 0) {
|
||||
execlp(command.c_str(), command.c_str(), std::to_string(event_id).c_str(), nullptr);
|
||||
execlp(command.c_str(), command.c_str(),
|
||||
std::to_string(event_id).c_str(),
|
||||
std::to_string(monitor_id).c_str(), // monitor id
|
||||
nullptr);
|
||||
Error("Error execing %s", command.c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ $statusData = array(
|
|||
'StartTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||
'StartDateTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||
'EndDateTime' => true,
|
||||
'EndDateTimeShort' => array( 'sql' => 'date_format( EndDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||
'Width' => true,
|
||||
'Height' => true,
|
||||
'Length' => true,
|
||||
|
@ -141,6 +142,7 @@ $statusData = array(
|
|||
'StartTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||
'StartDateTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||
'EndDateTime' => true,
|
||||
'EndDateTimeShort' => array( 'sql' => 'date_format( EndDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||
'Width' => true,
|
||||
'Height' => true,
|
||||
'Length' => true,
|
||||
|
|
|
@ -26,7 +26,7 @@ function MonitorStream(monitorData) {
|
|||
|
||||
this.buttons = {}; // index by name
|
||||
this.setButton = function(name, element) {
|
||||
this.buttons.name = element;
|
||||
this.buttons[name] = element;
|
||||
};
|
||||
|
||||
this.element = null;
|
||||
|
@ -383,6 +383,8 @@ function MonitorStream(monitorData) {
|
|||
if ('enableAlarmButton' in this.buttons) {
|
||||
this.buttons.enableAlarmButton.addClass('disabled');
|
||||
this.buttons.enableAlarmButton.prop('title', disableAlarmsStr);
|
||||
} else {
|
||||
console.log('enableAlarmButton not found in buttons');
|
||||
}
|
||||
if ('forceAlarmButton' in this.buttons) {
|
||||
if (streamStatus.forced) {
|
||||
|
@ -393,8 +395,11 @@ function MonitorStream(monitorData) {
|
|||
this.buttons.forceAlarmButton.prop('title', forceAlarmStr);
|
||||
}
|
||||
this.buttons.forceAlarmButton.prop('disabled', false);
|
||||
} else {
|
||||
console.log('forceAlarmButton not found in buttons');
|
||||
}
|
||||
} else {
|
||||
console.log("streamStatus not enabled");
|
||||
if ('enableAlarmButton' in this.buttons) {
|
||||
this.buttons.enableAlarmButton.removeClass('disabled');
|
||||
this.buttons.enableAlarmButton.prop('title', enableAlarmsStr);
|
||||
|
@ -465,6 +470,8 @@ function MonitorStream(monitorData) {
|
|||
|
||||
this.alarmCommand = function(command) {
|
||||
if (this.ajaxQueue) {
|
||||
console.log("Aborting in progress ajax for alarm");
|
||||
// Doing this for responsiveness, but we could be aborting something important. Need smarter logic
|
||||
this.ajaxQueue.abort();
|
||||
}
|
||||
const alarmCmdParms = Object.assign({}, this.streamCmdParms);
|
||||
|
@ -488,9 +495,6 @@ function MonitorStream(monitorData) {
|
|||
}
|
||||
|
||||
this.streamCmdReq = function(streamCmdParms) {
|
||||
if (this.ajaxQueue) {
|
||||
this.ajaxQueue.abort();
|
||||
}
|
||||
this.ajaxQueue = jQuery.ajaxQueue({url: this.url, data: streamCmdParms, dataType: "json"})
|
||||
.done(this.getStreamCmdResponse.bind(this))
|
||||
.fail(this.onFailure.bind(this));
|
||||
|
|
|
@ -52,14 +52,19 @@ function vjsReplay() {
|
|||
var overLaid = $j("#videoobj");
|
||||
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;">No more events</p>');
|
||||
} else {
|
||||
var endTime = (Date.parse(eventData.EndDateTime)).getTime();
|
||||
if (!eventData.EndDateTime) {
|
||||
// No EndTime but have a next event, just go to it.
|
||||
streamNext(true);
|
||||
return;
|
||||
}
|
||||
var endTime = Date.parse(eventData.EndDateTime).getTime();
|
||||
var nextStartTime = nextEventStartTime.getTime(); //nextEventStartTime.getTime() is a mootools workaround, highjacks Date.parse
|
||||
if ( nextStartTime <= endTime ) {
|
||||
streamNext(true);
|
||||
return;
|
||||
}
|
||||
var overLaid = $j("#videoobj");
|
||||
vid.pause();
|
||||
var overLaid = $j("#videoobj");
|
||||
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;"></p>');
|
||||
var gapDuration = (new Date().getTime()) + (nextStartTime - endTime);
|
||||
var messageP = $j('.vjsMessage');
|
||||
|
|
|
@ -52,6 +52,7 @@ var eventData = {
|
|||
StartDateTime: '<?php echo $Event->StartDateTime() ?>',
|
||||
StartDateTimeShort: '<?php echo strftime(STRF_FMT_DATETIME_SHORT, strtotime($Event->StartDateTime())) ?>',
|
||||
EndDateTime: '<?php echo $Event->EndDateTime() ?>',
|
||||
EndDateTimeShort: '<?php echo $Event->EndDateTime()? strftime(STRF_FMT_DATETIME_SHORT, strtotime($Event->EndDateTime())) : '' ?>',
|
||||
Frames: '<?php echo $Event->Frames() ?>',
|
||||
AlarmFrames: '<?php echo $Event->AlarmFrames() ?>',
|
||||
TotScore: '<?php echo $Event->TotScore() ?>',
|
||||
|
@ -75,6 +76,7 @@ var eventDataStrings = {
|
|||
Cause: '<?php echo translate('Cause') ?>',
|
||||
Notes: '<?php echo translate('Notes') ?>',
|
||||
StartDateTimeShort: '<?php echo translate('AttrStartTime') ?>',
|
||||
EndDateTimeShort: '<?php echo translate('AttrEndTime') ?>',
|
||||
Length: '<?php echo translate('Duration') ?>',
|
||||
Frames: '<?php echo translate('AttrFrames') ?>',
|
||||
AlarmFrames: '<?php echo translate('AttrAlarmFrames') ?>',
|
||||
|
|
|
@ -835,6 +835,14 @@ function initPage() {
|
|||
monitorStream.setButton('enableAlarmButton', enableAlmBtn);
|
||||
monitorStream.setButton('forceAlarmButton', forceAlmBtn);
|
||||
monitorStream.setButton('zoomOutButton', $j('zoomOutBtn'));
|
||||
if (canEdit.Monitors) {
|
||||
// Will be enabled by streamStatus ajax
|
||||
enableAlmBtn.on('click', cmdAlarm);
|
||||
forceAlmBtn.on('click', cmdForce);
|
||||
} else {
|
||||
forceAlmBtn.prop('title', forceAlmBtn.prop('title') + ': disabled because cannot edit Monitors');
|
||||
enableAlmBtn.prop('title', enableAlmBtn.prop('title') + ': disabled because cannot edit Monitors');
|
||||
}
|
||||
|
||||
/*
|
||||
if (streamMode == 'single') {
|
||||
|
|
|
@ -159,8 +159,8 @@ xhtmlHeaders(__FILE__, $monitor->Name().' - '.translate('Feed'));
|
|||
<button type="button" id="backBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Back') ?>" disabled><i class="fa fa-arrow-left"></i></button>
|
||||
<button type="button" id="refreshBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Refresh') ?>" ><i class="fa fa-refresh"></i></button>
|
||||
<button type="button" id="settingsBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Settings') ?>" disabled><i class="fa fa-sliders"></i></button>
|
||||
<button type="button" id="enableAlmBtn" class="btn btn-normal" data-on-click="cmdAlarm" data-toggle="tooltip" data-placement="top" title="<?php echo translate('DisableAlarms') ?>" disabled><i class="fa fa-bell"></i></button>
|
||||
<button type="button" id="forceAlmBtn" class="btn btn-danger" data-on-click="cmdForce" data-toggle="tooltip" data-placement="top" title="<?php echo translate('ForceAlarm') ?>" disabled><i class="fa fa-exclamation-circle"></i></button>
|
||||
<button type="button" id="enableAlmBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('DisableAlarms') ?>" disabled><i class="fa fa-bell"></i></button>
|
||||
<button type="button" id="forceAlmBtn" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="<?php echo translate('ForceAlarm') ?>" disabled><i class="fa fa-exclamation-circle"></i></button>
|
||||
</div>
|
||||
<div id="headerButtons">
|
||||
<!--
|
||||
|
|
Loading…
Reference in New Issue