Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ZoneMinder/zoneminder
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Oct 25, 2024
2 parents d971823 + 3e1c557 commit c51c287
Show file tree
Hide file tree
Showing 7 changed files with 976 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/zm_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
inline const char *EventPrefix() const { return event_prefix.c_str(); }
inline bool Ready() const {
if (!packetqueue.get_max_keyframe_interval()) {
Debug(4, "No keyframe interval.");
Debug(4, "Not ready because no keyframe interval.");
return false;
}
if (decoding_image_count >= ready_count) {
Expand Down
5 changes: 3 additions & 2 deletions src/zm_packetqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ bool PacketQueue::queuePacket(std::shared_ptr<ZMPacket> add_packet) {
while (rit != pktQueue.rend()) {
std::shared_ptr<ZMPacket> prev_packet = *rit;
if (prev_packet->packet->stream_index == add_packet->packet->stream_index) {
if (prev_packet->keyframe) break;
packet_count ++;
if (prev_packet->keyframe) break;
}
++rit;
}
Expand Down Expand Up @@ -295,7 +295,7 @@ void PacketQueue::clearPackets(const std::shared_ptr<ZMPacket> &add_packet) {
return;
}

int keyframe_interval_count = 1;
int keyframe_interval_count = 0;
int video_packets_to_delete = 0; // This is a count of how many packets we will delete so we know when to stop looking

ZMLockedPacket *lp = new ZMLockedPacket(zm_packet);
Expand Down Expand Up @@ -428,6 +428,7 @@ void PacketQueue::clear() {
delete[] packet_counts;
packet_counts = nullptr;
max_stream_id = -1;
max_keyframe_interval_ = 0;

Debug(1, "Packetqueue is clear, notifying");
condition.notify_all();
Expand Down
66 changes: 38 additions & 28 deletions web/includes/config.php.in
Original file line number Diff line number Diff line change
Expand Up @@ -163,41 +163,51 @@ $timeFormatter = new IntlDateFormatter(null, IntlDateFormatter::NONE, IntlDateFo
require_once('database.php');
require_once('logger.php');
loadConfig();
$locale = ZM_LOCALE_DEFAULT;
if (!$locale) {
$locale = locale_get_default();
}
ZM\Logger::fetch()->initialise();

$locale = ZM_LOCALE_DEFAULT;
$locales = ResourceBundle::getLocales('');
if ($locale) {
try {
if (ZM_TIMEZONE) {
$dateFormatter = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::NONE, ZM_TIMEZONE);
$dateTimeFormatter = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::LONG, ZM_TIMEZONE);
$timeFormatter = new IntlDateFormatter($locale, IntlDateFormatter::NONE, IntlDateFormatter::LONG, ZM_TIMEZONE);
} else {
$dateFormatter = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
$dateTimeFormatter = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::LONG);
$timeFormatter = new IntlDateFormatter($locale, IntlDateFormatter::NONE, IntlDateFormatter::LONG);
}
} catch(Exception $e) {
error_log($e->getMessage());
$dateFormatter = new IntlDateFormatter(null, IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
$dateTimeFormatter = new IntlDateFormatter(null, IntlDateFormatter::SHORT, IntlDateFormatter::LONG);
$timeFormatter = new IntlDateFormatter(null, IntlDateFormatter::NONE, IntlDateFormatter::LONG);
if (!array_search($locale, $locales)) {
ZM\Warning("Locale $locale does not seem to be valid.");
$locale = locale_get_default();
}
} else {
Z\Debug("NO locale set");
}
if (ZM_DATE_FORMAT_PATTERN) {
$dateFormatter->setPattern(ZM_DATE_FORMAT_PATTERN);
#ZM\Debug('Using system locale');
$locale = locale_get_default();
}
if (ZM_DATETIME_FORMAT_PATTERN) {
$dateTimeFormatter->setPattern(ZM_DATETIME_FORMAT_PATTERN);

try {
if (ZM_TIMEZONE) {
$dateFormatter = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::NONE, ZM_TIMEZONE);
$dateTimeFormatter = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::LONG, ZM_TIMEZONE);
$timeFormatter = new IntlDateFormatter($locale, IntlDateFormatter::NONE, IntlDateFormatter::LONG, ZM_TIMEZONE);
} else {
$dateFormatter = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
$dateTimeFormatter = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::LONG);
$timeFormatter = new IntlDateFormatter($locale, IntlDateFormatter::NONE, IntlDateFormatter::LONG);
}
} catch(Exception $e) {
error_log($e->getMessage());
$dateFormatter = new IntlDateFormatter(null, IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
$dateTimeFormatter = new IntlDateFormatter(null, IntlDateFormatter::SHORT, IntlDateFormatter::LONG);
$timeFormatter = new IntlDateFormatter(null, IntlDateFormatter::NONE, IntlDateFormatter::LONG);
}
if (ZM_TIME_FORMAT_PATTERN) {
$timeFormatter->setPattern(ZM_TIME_FORMAT_PATTERN);

try {
# PHP 8.1.26 made these throw an exception if locale is invalid so have to try
if (ZM_DATE_FORMAT_PATTERN) {
$dateFormatter->setPattern(ZM_DATE_FORMAT_PATTERN);
}
if (ZM_DATETIME_FORMAT_PATTERN) {
$dateTimeFormatter->setPattern(ZM_DATETIME_FORMAT_PATTERN);
}
if (ZM_TIME_FORMAT_PATTERN) {
$timeFormatter->setPattern(ZM_TIME_FORMAT_PATTERN);
}
} catch(\Error $e) {
error_log($e->getMessage());
}
ZM\Logger::fetch()->initialise();

$GLOBALS['defaultUser'] = array(
'Id' => 0,
Expand Down
11 changes: 8 additions & 3 deletions web/js/MonitorStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,9 +864,14 @@ function MonitorStream(monitorData) {
}
this.analyse_frames = true;
this.show_analyse_frames = function(toggle) {
this.analyse_frames = toggle;
this.streamCmdParms.command = this.analyse_frames ? CMD_ANALYZE_ON : CMD_ANALYZE_OFF;
this.streamCmdReq(this.streamCmdParms);
const streamImage = this.getElement();
if (streamImage.nodeName == 'IMG') {
this.analyse_frames = toggle;
this.streamCmdParms.command = this.analyse_frames ? CMD_ANALYZE_ON : CMD_ANALYZE_OFF;
this.streamCmdReq(this.streamCmdParms);
} else {
console.log("Not streaming from zms, can't show analysis frames");
}
};

this.setMaxFPS = function(maxfps) {
Expand Down
Loading

0 comments on commit c51c287

Please sign in to comment.