From 997c1197cfcaaf476af9b2f4bfa1c3f1978de842 Mon Sep 17 00:00:00 2001 From: Isaac Connor <isaac@zoneminder.com> Date: Tue, 10 May 2022 14:25:34 -0400 Subject: [PATCH] Implement decoding=Keyframes + OnDemand --- db/zm_create.sql.in | 2 +- db/zm_update-1.37.16.sql | 2 ++ src/zm_monitor.cpp | 3 +++ src/zm_monitor.h | 1 + web/includes/Monitor.php | 1 + 5 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 db/zm_update-1.37.16.sql diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index c2ef75afe..567cc5d43 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -461,7 +461,7 @@ CREATE TABLE `Monitors` ( `Recording` enum('None', 'OnMotion', 'Always') NOT NULL default 'Always', `Enabled` tinyint(3) unsigned NOT NULL default '1', `DecodingEnabled` tinyint(3) unsigned NOT NULL default '1', - `Decoding` enum('None','Ondemand','KeyFrames','Always') NOT NULL default 'Always', + `Decoding` enum('None','Ondemand','KeyFrames','KeyFrames+Ondemand', 'Always') NOT NULL default 'Always', `JanusEnabled` BOOLEAN NOT NULL default false, `JanusAudioEnabled` BOOLEAN NOT NULL default false, `LinkedMonitors` varchar(255), diff --git a/db/zm_update-1.37.16.sql b/db/zm_update-1.37.16.sql new file mode 100644 index 000000000..9a602c3b4 --- /dev/null +++ b/db/zm_update-1.37.16.sql @@ -0,0 +1,2 @@ +/*ALTER TABLE `Monitors` MODIFY `Decoding` enum('None','Ondemand','KeyFrames','Always') NOT NULL default 'Always';*/ + ALTER TABLE `Monitors` MODIFY `Decoding` enum('None','Ondemand','KeyFrames','KeyFrames+Ondemand', 'Always') NOT NULL default 'Always'; diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index b222c9b66..eb2550d33 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -144,6 +144,7 @@ std::string Decoding_Strings[] = { "None", "On demand", "Keyframes", + "Keyframes + Ondemand", "Always" }; @@ -2600,6 +2601,8 @@ bool Monitor::Decode() { ((decoding == DECODING_ONDEMAND) and this->hasViewers() ) or ((decoding == DECODING_KEYFRAMES) and packet->keyframe) + or + ((decoding == DECODING_KEYFRAMESONDEMAND) and (this->hasViewers() or packet->keyframe)) ) { // Allocate the image first so that it can be used by hwaccel diff --git a/src/zm_monitor.h b/src/zm_monitor.h index 9b34aea79..770bf8780 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -95,6 +95,7 @@ public: DECODING_NONE=1, DECODING_ONDEMAND, DECODING_KEYFRAMES, + DECODING_KEYFRAMESONDEMAND, DECODING_ALWAYS } DecodingOption; diff --git a/web/includes/Monitor.php b/web/includes/Monitor.php index cfafd1d61..f49fc174c 100644 --- a/web/includes/Monitor.php +++ b/web/includes/Monitor.php @@ -92,6 +92,7 @@ public static function getDecodingOptions() { 'None' => translate('None'), 'Ondemand' => translate('On Demand'), 'KeyFrames' => translate('KeyFrames Only'), + 'KeyFrames+Ondemand' => translate('Keyframes + Ondemand'), 'Always' => translate('Always'), ); }