mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-27 16:58:31 -04:00
Merge branch 'master' of github.com:ZoneMinder/zoneminder
This commit is contained in:
commit
55f50d93a8
7 files changed
+53
-50
No files matched your search
@@ -33,7 +33,7 @@ PacketQueue::PacketQueue():
|
||||
packet_counts(nullptr),
|
||||
deleting(false),
|
||||
keep_keyframes(false),
|
||||
has_warned(false)
|
||||
warned_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -148,8 +148,8 @@ bool PacketQueue::queuePacket(std::shared_ptr<ZMPacket> add_packet) {
|
||||
and
|
||||
(packet_counts[video_stream_id] > max_video_packet_count)
|
||||
) {
|
||||
if (!has_warned) {
|
||||
has_warned = true;
|
||||
if (!warned_count) {
|
||||
warned_count++;
|
||||
Warning("You have set the max video packets in the queue to %u."
|
||||
" The queue is full. Either Analysis is not keeping up or"
|
||||
" your camera's keyframe interval is larger than this setting."
|
||||
@@ -167,8 +167,11 @@ bool PacketQueue::queuePacket(std::shared_ptr<ZMPacket> add_packet) {
|
||||
|
||||
ZMLockedPacket lp(zm_packet);
|
||||
if (!lp.trylock()) {
|
||||
// Can't delete a locked packet, but can delete one after it.
|
||||
Warning("Found locked packet when trying to free up video packets. This basically means that decoding is not keeping up.");
|
||||
if (warned_count <2) {
|
||||
warned_count++;
|
||||
// Can't delete a locked packet, but can delete one after it.
|
||||
Warning("Found locked packet when trying to free up video packets. This basically means that decoding is not keeping up.");
|
||||
}
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
@@ -201,7 +204,7 @@ bool PacketQueue::queuePacket(std::shared_ptr<ZMPacket> add_packet) {
|
||||
break;
|
||||
} // end while
|
||||
} else {
|
||||
has_warned = false;
|
||||
warned_count--;
|
||||
} // end if not able catch up
|
||||
} // end lock scope
|
||||
// We signal on every packet because someday we may analyze sound
|
||||
|
||||
@@ -46,7 +46,7 @@ class PacketQueue {
|
||||
|
||||
std::mutex mutex;
|
||||
std::condition_variable condition;
|
||||
bool has_warned;
|
||||
int warned_count;
|
||||
|
||||
public:
|
||||
PacketQueue();
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ if ( canView('Events') or canView('Snapshots') ) {
|
||||
false,#Misc
|
||||
$exportFormat,
|
||||
false#,#Compress
|
||||
#$exportStructure
|
||||
, $exportStructure
|
||||
) ) {
|
||||
ajaxResponse(array(
|
||||
'exportFile'=>$exportFile,
|
||||
|
||||
+9
-12
@@ -95,9 +95,8 @@ function MonitorStream(monitorData) {
|
||||
console.log('Error finding frame');
|
||||
return;
|
||||
}
|
||||
stream_frame = $j('#monitor'+this.id);
|
||||
|
||||
if (((newscale == '0') || (newscale=='auto')) && (width=='auto')) {
|
||||
if (((newscale == '0') || (newscale == 0) || (newscale=='auto')) && (width=='auto' || !width)) {
|
||||
if (!this.bottomElement) {
|
||||
newscale = parseInt(100*monitor_frame.width() / this.width);
|
||||
// We don't want to change the existing css, cuz it might be 59% or 123px or auto;
|
||||
@@ -107,7 +106,6 @@ function MonitorStream(monitorData) {
|
||||
width = newSize.width+'px';
|
||||
height = newSize.height+'px';
|
||||
newscale = parseInt(newSize.autoScale);
|
||||
console.log("Have ottom selement, doing auto scale", newSize);
|
||||
}
|
||||
} else if (parseInt(width) || parseInt(height)) {
|
||||
if (width) {
|
||||
@@ -121,9 +119,9 @@ function MonitorStream(monitorData) {
|
||||
width = Math.round(parseInt(this.width) * newscale / 100)+'px';
|
||||
height = Math.round(parseInt(this.height) * newscale / 100)+'px';
|
||||
}
|
||||
monitor_frame.css('width', width);
|
||||
//img.style.width = width;
|
||||
img.style.height = height;
|
||||
if (width && width != '0px' && monitor_frame.css('width') == 'auto') monitor_frame.css('width', width);
|
||||
if (height && height != '0px') img.style.height = height;
|
||||
|
||||
this.setStreamScale(newscale);
|
||||
}; // setscale
|
||||
|
||||
@@ -139,11 +137,10 @@ function MonitorStream(monitorData) {
|
||||
}
|
||||
if (img.nodeName == 'IMG') {
|
||||
if (newscale > 100) newscale = 100; // we never request a larger image, as it just wastes bandwidth
|
||||
if (newscale < 0) newscale = 100;
|
||||
if (newscale <= 0) newscale = 100;
|
||||
const oldSrc = img.src;
|
||||
if (!oldSrc) {
|
||||
console.log('No src on img?!');
|
||||
console.log(img);
|
||||
console.log('No src on img?!', img);
|
||||
return;
|
||||
}
|
||||
const newSrc = oldSrc.replace(/scale=\d+/i, 'scale='+newscale);
|
||||
@@ -157,7 +154,7 @@ function MonitorStream(monitorData) {
|
||||
this.streamCommand(CMD_QUIT);
|
||||
}
|
||||
console.log("Changing src to " + newSrc);
|
||||
//img.src = '';
|
||||
img.src = '';
|
||||
img.src = newSrc;
|
||||
this.statusCmdTimer = setTimeout(this.statusQuery.bind(this), statusRefreshTimeout);
|
||||
}
|
||||
@@ -306,8 +303,8 @@ function MonitorStream(monitorData) {
|
||||
stateValue.removeClass();
|
||||
}
|
||||
}
|
||||
//const monitorState = $j('#monitorState'+this.id);
|
||||
//if (monitorState.length) this.setStateClass(monitorState, stateClass);
|
||||
const monitorFrame = $j('#monitor'+this.id);
|
||||
if (monitorFrame.length) this.setStateClass(monitorFrame, stateClass);
|
||||
|
||||
const isAlarmed = ( alarmState == STATE_ALARM || alarmState == STATE_ALERT );
|
||||
const wasAlarmed = ( this.lastAlarmState == STATE_ALARM || this.lastAlarmState == STATE_ALERT );
|
||||
|
||||
@@ -68,15 +68,15 @@
|
||||
background: none;
|
||||
}
|
||||
|
||||
#monitors .imageFeed img.idle {
|
||||
#monitors .idle .imageFeed img {
|
||||
border: 2px solid #ffffff;
|
||||
}
|
||||
|
||||
#monitors .imageFeed img.alarm {
|
||||
#monitors .alarm .imageFeed img {
|
||||
border: 2px solid #ff0000;
|
||||
}
|
||||
|
||||
#monitors .imageFeed img.alert {
|
||||
#monitors .alert .imageFeed img {
|
||||
border: 2px solid #ffa500;
|
||||
}
|
||||
|
||||
|
||||
@@ -583,7 +583,7 @@ function eventlist_html($Event, $exportDetail, $exportFrames, $exportStructure)
|
||||
';
|
||||
} # end if has jpegs
|
||||
if ($Event->DefaultVideo()) {
|
||||
$html .= '<a href="'.$Event->Id().'/'.$Event->DefaultVideo() .'">';
|
||||
$html .= '<a href="'.$Event->Id().($exportStructure == 'flat'?'_':'/').$Event->DefaultVideo() .'">';
|
||||
$html .= '<img width="'.ZM_WEB_LIST_THUMB_WIDTH.'" src="'. $Event->Id().($exportStructure=='flat'?'_':'/').'snapshot.jpg" alt="'.$Event->Id().'" loading="lazy" />';
|
||||
$html .= '</a><br/>'.PHP_EOL;
|
||||
}
|
||||
@@ -931,14 +931,21 @@ function exportEvents(
|
||||
ZM\Error("Can't mkdir $event_dir");
|
||||
}
|
||||
$event_exportFileList = exportFileList($event, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc);
|
||||
$exportFileList = array_merge($exportFileList, $event_exportFileList);
|
||||
#$exportFileList = array_merge($exportFileList, $event_exportFileList);
|
||||
foreach ($event_exportFileList as $file) {
|
||||
#if ( preg_match('/\.html$/', $file) )
|
||||
#continue;
|
||||
if ($exportStructure == 'flat') {
|
||||
$cmd = 'cp -as '.$event->Path().'/'.$file.' '.$export_dir.'/'.$event->Id().'_'.$file. ' 2>&1';
|
||||
if (false !== strpos($file, $event->Id())) {
|
||||
$cmd = 'cp -as '.$event->Path().'/'.$file.' '.$export_dir.'/'.$file. ' 2>&1';
|
||||
$exportFileList[] = $file;
|
||||
} else {
|
||||
$cmd = 'cp -as '.$event->Path().'/'.$file.' '.$export_dir.'/'.$event->Id().'_'.$file. ' 2>&1';
|
||||
$exportFileList[] = $event->Id().'_'.$file;
|
||||
}
|
||||
} else {
|
||||
$cmd = 'cp -as '.$event->Path().'/'.$file.' '.$export_dir.'/'.$event->Id().'/'.$file. ' 2>&1';
|
||||
$exportFileList[] = $event->Id().'/'.$file;
|
||||
}
|
||||
exec($cmd, $output, $return);
|
||||
ZM\Debug($cmd.' return code: '.$return.' output: '.print_r($output,true));
|
||||
@@ -954,16 +961,18 @@ function exportEvents(
|
||||
}
|
||||
//if ( !symlink(ZM_PATH_WEB.'/'.ZM_SKIN_PATH.'/js/video.js', $export_dir.'/video.js') )
|
||||
//Error("Failed linking video.js");
|
||||
//
|
||||
if (!($exportDetail or $exportFrames or $exportImages or $exportVideo or $exportMisc)) {
|
||||
$html_eventMaster_file = 'zmEventImagesMaster.html';
|
||||
$html_eventMaster_path = $export_dir.'/'.$html_eventMaster_file;
|
||||
|
||||
$html_eventMaster_file = 'zmEventImagesMaster.html';
|
||||
$html_eventMaster_path = $export_dir.'/'.$html_eventMaster_file;
|
||||
|
||||
if (($fp = fopen($html_eventMaster_path, 'w'))) {
|
||||
fwrite($fp, exportEventImagesMaster($eids, $exportDetail, $exportFrames, $exportStructure));
|
||||
fclose($fp);
|
||||
$exportFileList[] = $html_eventMaster_file;
|
||||
} else {
|
||||
ZM\Error("Can't open event images export file '$html_eventMaster_path'");
|
||||
if (($fp = fopen($html_eventMaster_path, 'w'))) {
|
||||
fwrite($fp, exportEventImagesMaster($eids, $exportDetail, $exportFrames, $exportStructure));
|
||||
fclose($fp);
|
||||
$exportFileList[] = $html_eventMaster_file;
|
||||
} else {
|
||||
ZM\Error("Can't open event images export file '$html_eventMaster_path'");
|
||||
}
|
||||
}
|
||||
|
||||
$listFile = $export_dir.'/'.$export_listFile;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
/**
|
||||
* called when the layoutControl select element is changed, or the page
|
||||
* is rendered
|
||||
* @param {*} new_layout - the name of a layout to switch to
|
||||
* @param {*} new_layout_id - the id of a layout to switch to
|
||||
*/
|
||||
function selectLayout(new_layout) {
|
||||
function selectLayout(new_layout_id) {
|
||||
const ddm = $j('#zmMontageLayout');
|
||||
if (new_layout && (typeof(new_layout) != 'object')) {
|
||||
console.log("Selecting " + new_layout);
|
||||
$j('#zmMontageLayout option').attr('selected', false);
|
||||
$j('#zmMontageLayout option:contains("'+new_layout+'")').attr('selected', true);
|
||||
if (new_layout_id && (typeof(new_layout_id) != 'object')) {
|
||||
console.log("Selecting " + new_layout_id);
|
||||
ddm.val(new_layout_id);
|
||||
}
|
||||
const layout_id = parseInt(ddm.val());
|
||||
if (!layout_id) {
|
||||
@@ -88,13 +87,12 @@ function changeWidth() {
|
||||
var height = $j('#height').val();
|
||||
console.log("changeWidth");
|
||||
|
||||
selectLayout('Freeform');
|
||||
selectLayout(freeform_layout_id);
|
||||
$j('#width').val(width);
|
||||
$j('#height').val(height);
|
||||
|
||||
for (var i = 0, length = monitors.length; i < length; i++) {
|
||||
var monitor = monitors[i];
|
||||
monitor.setScale('0', width, height);
|
||||
monitors[i].setScale('0', width, height);
|
||||
}
|
||||
$j('#scale').val('0');
|
||||
setCookie('zmMontageScale', '0', 3600);
|
||||
@@ -107,7 +105,7 @@ function changeWidth() {
|
||||
*/
|
||||
function changeScale() {
|
||||
var scale = $j('#scale').val();
|
||||
selectLayout('Freeform'); // Will also clear width and height
|
||||
selectLayout(freeform_layout_id); // Will also clear width and height
|
||||
$j('#scale').val(scale);
|
||||
setCookie('zmMontageScale', scale, 3600);
|
||||
setCookie('zmMontageWidth', 'auto', 3600);
|
||||
@@ -186,7 +184,7 @@ function cancel_layout(button) {
|
||||
//monitor_feed = $j('#imageFeed'+monitor.id);
|
||||
//monitor_feed.click(monitor.onclick);
|
||||
};
|
||||
selectLayout('Freeform');
|
||||
selectLayout(freeform_layout_id);
|
||||
}
|
||||
|
||||
function reloadWebSite(ndx) {
|
||||
@@ -216,11 +214,7 @@ function initPage() {
|
||||
monitors[i] = new MonitorStream(monitorData[i]);
|
||||
}
|
||||
selectLayout();
|
||||
const scale = $j('#scale').val();
|
||||
const width = $j('#width').val();
|
||||
const height = $j('#height').val();
|
||||
for (let i = 0, length = monitorData.length; i < length; i++) {
|
||||
monitors[i].setScale(scale, width, height);
|
||||
// Start the fps and status updates. give a random delay so that we don't assault the server
|
||||
const delay = Math.round( (Math.random()+0.5)*statusRefreshTimeout );
|
||||
monitors[i].start(delay);
|
||||
|
||||
Reference in new issue
Block a user