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() {
|
void SavePreAlarmFrames() {
|
||||||
EmptyPreAlarmFrames();
|
EmptyPreAlarmFrames();
|
||||||
}
|
}
|
||||||
|
int MonitorId();
|
||||||
};
|
};
|
||||||
#endif // ZM_EVENT_H
|
#endif // ZM_EVENT_H
|
||||||
|
|
|
@ -98,7 +98,7 @@ void Image::update_function_pointers() {
|
||||||
delta8_abgr = &std_delta8_abgr;
|
delta8_abgr = &std_delta8_abgr;
|
||||||
delta8_gray8 = &std_delta8_gray8;
|
delta8_gray8 = &std_delta8_gray8;
|
||||||
blend = &std_blend;
|
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 {
|
} else {
|
||||||
// Use either sse or neon, or loop unrolled version
|
// Use either sse or neon, or loop unrolled version
|
||||||
delta8_rgb = fptr_delta8_rgb;
|
delta8_rgb = fptr_delta8_rgb;
|
||||||
|
@ -1090,14 +1090,16 @@ bool Image::WriteJpeg(const std::string &filename,
|
||||||
const int &quality_override,
|
const int &quality_override,
|
||||||
SystemTimePoint timestamp,
|
SystemTimePoint timestamp,
|
||||||
bool on_blocking_abort) const {
|
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)) {
|
if (config.colour_jpeg_files && (colours == ZM_COLOUR_GRAY8)) {
|
||||||
Image temp_image(*this);
|
Image temp_image(*this);
|
||||||
temp_image.Colourise(ZM_COLOUR_RGB24, ZM_SUBPIX_ORDER_RGB);
|
temp_image.Colourise(ZM_COLOUR_RGB24, ZM_SUBPIX_ORDER_RGB);
|
||||||
return temp_image.WriteJpeg(filename, quality_override, timestamp, on_blocking_abort);
|
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;
|
int quality = quality_override ? quality_override : config.jpeg_file_quality;
|
||||||
|
|
||||||
jpeg_compress_struct *cinfo = writejpg_ccinfo[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) {
|
} else if (subpixelorder == ZM_SUBPIX_ORDER_ABGR) {
|
||||||
cinfo->in_color_space = JCS_EXT_XBGR;
|
cinfo->in_color_space = JCS_EXT_XBGR;
|
||||||
} else {
|
} else {
|
||||||
Warning("Unknwon subpixelorder %d", subpixelorder);
|
Warning("Unknown subpixelorder %d", subpixelorder);
|
||||||
/* Assume RGBA */
|
/* Assume RGBA */
|
||||||
cinfo->in_color_space = JCS_EXT_RGBX;
|
cinfo->in_color_space = JCS_EXT_RGBX;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1838,8 +1838,8 @@ bool Monitor::Analyse() {
|
||||||
Debug(1, "Linked monitor %d %s is connected",
|
Debug(1, "Linked monitor %d %s is connected",
|
||||||
linked_monitors[i]->Id(), linked_monitors[i]->Name());
|
linked_monitors[i]->Id(), linked_monitors[i]->Name());
|
||||||
if (linked_monitors[i]->hasAlarmed()) {
|
if (linked_monitors[i]->hasAlarmed()) {
|
||||||
Debug(1, "Linked monitor %d %s is alarmed",
|
Debug(1, "Linked monitor %d %s is alarmed score will be %d",
|
||||||
linked_monitors[i]->Id(), linked_monitors[i]->Name());
|
linked_monitors[i]->Id(), linked_monitors[i]->Name(), linked_monitors[i]->lastFrameScore());
|
||||||
if (!event) {
|
if (!event) {
|
||||||
if (first_link) {
|
if (first_link) {
|
||||||
if (cause.length())
|
if (cause.length())
|
||||||
|
@ -1961,6 +1961,9 @@ bool Monitor::Analyse() {
|
||||||
} // end if active and doing motion detection
|
} // 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 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 ((score > 0) or (snap->score > 0)) {
|
||||||
if ((state == IDLE) || (state == TAPE) || (state == PREALARM)) {
|
if ((state == IDLE) || (state == TAPE) || (state == PREALARM)) {
|
||||||
|
@ -2173,7 +2176,6 @@ bool Monitor::Analyse() {
|
||||||
last_signal = signal;
|
last_signal = signal;
|
||||||
} // end if videostream
|
} // end if videostream
|
||||||
} // end if signal
|
} // end if signal
|
||||||
shared_data->last_frame_score = score;
|
|
||||||
} else {
|
} else {
|
||||||
Debug(3, "trigger == off");
|
Debug(3, "trigger == off");
|
||||||
if (event) {
|
if (event) {
|
||||||
|
@ -2775,7 +2777,11 @@ Event * Monitor::openEvent(
|
||||||
|
|
||||||
if (!event_start_command.empty()) {
|
if (!event_start_command.empty()) {
|
||||||
if (fork() == 0) {
|
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());
|
Error("Error execing %s", event_start_command.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2815,11 +2821,15 @@ void Monitor::closeEvent() {
|
||||||
Debug(1, "Starting thread to close event");
|
Debug(1, "Starting thread to close event");
|
||||||
close_event_thread = std::thread([](Event *e, const std::string &command){
|
close_event_thread = std::thread([](Event *e, const std::string &command){
|
||||||
int64_t event_id = e->Id();
|
int64_t event_id = e->Id();
|
||||||
|
int monitor_id = e->MonitorId();
|
||||||
delete e;
|
delete e;
|
||||||
|
|
||||||
if (!command.empty()) {
|
if (!command.empty()) {
|
||||||
if (fork() == 0) {
|
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());
|
Error("Error execing %s", command.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,7 @@ $statusData = array(
|
||||||
'StartTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
'StartTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||||
'StartDateTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
'StartDateTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||||
'EndDateTime' => true,
|
'EndDateTime' => true,
|
||||||
|
'EndDateTimeShort' => array( 'sql' => 'date_format( EndDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||||
'Width' => true,
|
'Width' => true,
|
||||||
'Height' => true,
|
'Height' => true,
|
||||||
'Length' => true,
|
'Length' => true,
|
||||||
|
@ -141,6 +142,7 @@ $statusData = array(
|
||||||
'StartTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
'StartTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||||
'StartDateTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
'StartDateTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||||
'EndDateTime' => true,
|
'EndDateTime' => true,
|
||||||
|
'EndDateTimeShort' => array( 'sql' => 'date_format( EndDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ),
|
||||||
'Width' => true,
|
'Width' => true,
|
||||||
'Height' => true,
|
'Height' => true,
|
||||||
'Length' => true,
|
'Length' => true,
|
||||||
|
|
|
@ -26,7 +26,7 @@ function MonitorStream(monitorData) {
|
||||||
|
|
||||||
this.buttons = {}; // index by name
|
this.buttons = {}; // index by name
|
||||||
this.setButton = function(name, element) {
|
this.setButton = function(name, element) {
|
||||||
this.buttons.name = element;
|
this.buttons[name] = element;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.element = null;
|
this.element = null;
|
||||||
|
@ -383,6 +383,8 @@ function MonitorStream(monitorData) {
|
||||||
if ('enableAlarmButton' in this.buttons) {
|
if ('enableAlarmButton' in this.buttons) {
|
||||||
this.buttons.enableAlarmButton.addClass('disabled');
|
this.buttons.enableAlarmButton.addClass('disabled');
|
||||||
this.buttons.enableAlarmButton.prop('title', disableAlarmsStr);
|
this.buttons.enableAlarmButton.prop('title', disableAlarmsStr);
|
||||||
|
} else {
|
||||||
|
console.log('enableAlarmButton not found in buttons');
|
||||||
}
|
}
|
||||||
if ('forceAlarmButton' in this.buttons) {
|
if ('forceAlarmButton' in this.buttons) {
|
||||||
if (streamStatus.forced) {
|
if (streamStatus.forced) {
|
||||||
|
@ -393,8 +395,11 @@ function MonitorStream(monitorData) {
|
||||||
this.buttons.forceAlarmButton.prop('title', forceAlarmStr);
|
this.buttons.forceAlarmButton.prop('title', forceAlarmStr);
|
||||||
}
|
}
|
||||||
this.buttons.forceAlarmButton.prop('disabled', false);
|
this.buttons.forceAlarmButton.prop('disabled', false);
|
||||||
|
} else {
|
||||||
|
console.log('forceAlarmButton not found in buttons');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
console.log("streamStatus not enabled");
|
||||||
if ('enableAlarmButton' in this.buttons) {
|
if ('enableAlarmButton' in this.buttons) {
|
||||||
this.buttons.enableAlarmButton.removeClass('disabled');
|
this.buttons.enableAlarmButton.removeClass('disabled');
|
||||||
this.buttons.enableAlarmButton.prop('title', enableAlarmsStr);
|
this.buttons.enableAlarmButton.prop('title', enableAlarmsStr);
|
||||||
|
@ -465,6 +470,8 @@ function MonitorStream(monitorData) {
|
||||||
|
|
||||||
this.alarmCommand = function(command) {
|
this.alarmCommand = function(command) {
|
||||||
if (this.ajaxQueue) {
|
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();
|
this.ajaxQueue.abort();
|
||||||
}
|
}
|
||||||
const alarmCmdParms = Object.assign({}, this.streamCmdParms);
|
const alarmCmdParms = Object.assign({}, this.streamCmdParms);
|
||||||
|
@ -488,9 +495,6 @@ function MonitorStream(monitorData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.streamCmdReq = function(streamCmdParms) {
|
this.streamCmdReq = function(streamCmdParms) {
|
||||||
if (this.ajaxQueue) {
|
|
||||||
this.ajaxQueue.abort();
|
|
||||||
}
|
|
||||||
this.ajaxQueue = jQuery.ajaxQueue({url: this.url, data: streamCmdParms, dataType: "json"})
|
this.ajaxQueue = jQuery.ajaxQueue({url: this.url, data: streamCmdParms, dataType: "json"})
|
||||||
.done(this.getStreamCmdResponse.bind(this))
|
.done(this.getStreamCmdResponse.bind(this))
|
||||||
.fail(this.onFailure.bind(this));
|
.fail(this.onFailure.bind(this));
|
||||||
|
|
|
@ -52,14 +52,19 @@ function vjsReplay() {
|
||||||
var overLaid = $j("#videoobj");
|
var overLaid = $j("#videoobj");
|
||||||
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;">No more events</p>');
|
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;">No more events</p>');
|
||||||
} else {
|
} 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
|
var nextStartTime = nextEventStartTime.getTime(); //nextEventStartTime.getTime() is a mootools workaround, highjacks Date.parse
|
||||||
if ( nextStartTime <= endTime ) {
|
if ( nextStartTime <= endTime ) {
|
||||||
streamNext(true);
|
streamNext(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var overLaid = $j("#videoobj");
|
|
||||||
vid.pause();
|
vid.pause();
|
||||||
|
var overLaid = $j("#videoobj");
|
||||||
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;"></p>');
|
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;"></p>');
|
||||||
var gapDuration = (new Date().getTime()) + (nextStartTime - endTime);
|
var gapDuration = (new Date().getTime()) + (nextStartTime - endTime);
|
||||||
var messageP = $j('.vjsMessage');
|
var messageP = $j('.vjsMessage');
|
||||||
|
|
|
@ -52,6 +52,7 @@ var eventData = {
|
||||||
StartDateTime: '<?php echo $Event->StartDateTime() ?>',
|
StartDateTime: '<?php echo $Event->StartDateTime() ?>',
|
||||||
StartDateTimeShort: '<?php echo strftime(STRF_FMT_DATETIME_SHORT, strtotime($Event->StartDateTime())) ?>',
|
StartDateTimeShort: '<?php echo strftime(STRF_FMT_DATETIME_SHORT, strtotime($Event->StartDateTime())) ?>',
|
||||||
EndDateTime: '<?php echo $Event->EndDateTime() ?>',
|
EndDateTime: '<?php echo $Event->EndDateTime() ?>',
|
||||||
|
EndDateTimeShort: '<?php echo $Event->EndDateTime()? strftime(STRF_FMT_DATETIME_SHORT, strtotime($Event->EndDateTime())) : '' ?>',
|
||||||
Frames: '<?php echo $Event->Frames() ?>',
|
Frames: '<?php echo $Event->Frames() ?>',
|
||||||
AlarmFrames: '<?php echo $Event->AlarmFrames() ?>',
|
AlarmFrames: '<?php echo $Event->AlarmFrames() ?>',
|
||||||
TotScore: '<?php echo $Event->TotScore() ?>',
|
TotScore: '<?php echo $Event->TotScore() ?>',
|
||||||
|
@ -75,6 +76,7 @@ var eventDataStrings = {
|
||||||
Cause: '<?php echo translate('Cause') ?>',
|
Cause: '<?php echo translate('Cause') ?>',
|
||||||
Notes: '<?php echo translate('Notes') ?>',
|
Notes: '<?php echo translate('Notes') ?>',
|
||||||
StartDateTimeShort: '<?php echo translate('AttrStartTime') ?>',
|
StartDateTimeShort: '<?php echo translate('AttrStartTime') ?>',
|
||||||
|
EndDateTimeShort: '<?php echo translate('AttrEndTime') ?>',
|
||||||
Length: '<?php echo translate('Duration') ?>',
|
Length: '<?php echo translate('Duration') ?>',
|
||||||
Frames: '<?php echo translate('AttrFrames') ?>',
|
Frames: '<?php echo translate('AttrFrames') ?>',
|
||||||
AlarmFrames: '<?php echo translate('AttrAlarmFrames') ?>',
|
AlarmFrames: '<?php echo translate('AttrAlarmFrames') ?>',
|
||||||
|
|
|
@ -835,6 +835,14 @@ function initPage() {
|
||||||
monitorStream.setButton('enableAlarmButton', enableAlmBtn);
|
monitorStream.setButton('enableAlarmButton', enableAlmBtn);
|
||||||
monitorStream.setButton('forceAlarmButton', forceAlmBtn);
|
monitorStream.setButton('forceAlarmButton', forceAlmBtn);
|
||||||
monitorStream.setButton('zoomOutButton', $j('zoomOutBtn'));
|
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') {
|
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="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="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="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="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-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="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>
|
||||||
<div id="headerButtons">
|
<div id="headerButtons">
|
||||||
<!--
|
<!--
|
||||||
|
|
Loading…
Reference in New Issue