From 56bdd537575a3dd4531222ed6045707238266c70 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Nov 2018 10:40:44 -0500 Subject: [PATCH 1/2] Use the global dbh in ZoneMinder::Database instead of keeping our own copy of it in Logger --- scripts/ZoneMinder/lib/ZoneMinder/Logger.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm index 16535d9e3..2d15c045d 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm @@ -441,11 +441,11 @@ sub databaseLevel { $databaseLevel = $this->limit($databaseLevel); if ( $this->{databaseLevel} != $databaseLevel ) { if ( ( $databaseLevel > NOLOG ) and ( $this->{databaseLevel} <= NOLOG ) ) { - if ( !$this->{dbh} ) { - $this->{dbh} = ZoneMinder::Database::zmDbConnect(); + if ( ! ( $ZoneMinder::Database::dbh or ZoneMinder::Database::zmDbConnect() ) ) { + Warning("Failed connecting to db. Not using database logging."); + $this->{databaseLevel} = NOLOG; + return NOLOG; } - } elsif ( $databaseLevel <= NOLOG && $this->{databaseLevel} > NOLOG ) { - undef($this->{dbh}); } $this->{databaseLevel} = $databaseLevel; } @@ -558,12 +558,12 @@ sub logPrint { } if ( $level <= $this->{databaseLevel} ) { - if ( ! ( $this->{dbh} and $this->{dbh}->ping() ) ) { + if ( ! ( $ZoneMinder::Database::dbh and $ZoneMinder::Database::dbh->ping() ) ) { $this->{sth} = undef; # Turn this off because zDbConnect will do logging calls. my $oldlevel = $this->{databaseLevel}; $this->{databaseLevel} = NOLOG; - if ( ! ( $this->{dbh} = ZoneMinder::Database::zmDbConnect() ) ) { + if ( ! ZoneMinder::Database::zmDbConnect() ) { #print(STDERR "Can't log to database: "); return; } @@ -571,10 +571,10 @@ sub logPrint { } my $sql = 'INSERT INTO Logs ( TimeKey, Component, ServerId, Pid, Level, Code, Message, File, Line ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, NULL )'; - $this->{sth} = $this->{dbh}->prepare_cached($sql) if ! $this->{sth}; + $this->{sth} = $ZoneMinder::Database::dbh->prepare_cached($sql) if ! $this->{sth}; if ( !$this->{sth} ) { $this->{databaseLevel} = NOLOG; - Error("Can't prepare log entry '$sql': ".$this->{dbh}->errstr()); + Error("Can't prepare log entry '$sql': ".$ZoneMinder::Database::dbh->errstr()); return; } @@ -590,7 +590,7 @@ sub logPrint { ); if ( !$res ) { $this->{databaseLevel} = NOLOG; - Error("Can't execute log entry '$sql': ".$this->{dbh}->errstr()); + Error("Can't execute log entry '$sql': ".$ZoneMinder::Database::dbh->errstr()); } } # end if doing db logging } # end if level < effectivelevel From 1844a7eb292dec6188af0836feaea938b99537a7 Mon Sep 17 00:00:00 2001 From: Aktarus <11706557+aktarus82@users.noreply.github.com> Date: Fri, 9 Nov 2018 13:59:06 +0100 Subject: [PATCH 2/2] Update definemonitor.rst (#2299) --- docs/userguide/definemonitor.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/userguide/definemonitor.rst b/docs/userguide/definemonitor.rst index bf12a1bc5..bcd195570 100644 --- a/docs/userguide/definemonitor.rst +++ b/docs/userguide/definemonitor.rst @@ -164,6 +164,29 @@ Height (pixels) Web Site Refresh If the website in question has static content, optionally enter a time period in seconds for ZoneMinder to refresh the content. +Storage Tab +----------- + +The storage section allows for each monitor to configure if and how video and audio are recorded. + +Save JPEGs + Records video in individual JPEG frames. Storing JPEG frames requires more storage space than h264 but it allows to view an event anytime while it is being recorded. + + * Disabled – video is not recorded as JPEG frames. If this setting is selected, then "Video Writer" should be enabled otherwise there is no video recording at all. + * Frames only – video is recorded in individual JPEG frames. + * Analysis images only (if available) – video is recorded in invidual JPEG frames with an overlay of the motion detection analysis information. Note that this overlay remains permanently visible in the frames. + * Frames + Analysis images (if available) – video is recorded twice, once as normal individual JPEG frames and once in invidual JPEG frames with analysis information overlaid. + +Video Writer + Records video in real video format. It provides much better compression results than saving JPEGs, thus longer video history can be stored. + + * Disabled – video is not recorded in video format. If this setting is selected, then "Save JPEGs" should be enabled otherwise there is no video recording at all. + * X264 Encode – the video or picture frames received from the camera are transcoded into h264 and stored as a video. This option is useful if the camera cannot natively stream h264. + * H264 Camera Passthrough – this option assumes that the camera is already sending an h264 stream. Video will be recorded as is, without any post-processing in zoneminder. Video characteristics such as bitrate, encoding mode, etc. should be set directly in the camera. + +Recording Audio + Check the box labeled "Whether to store the audio stream when saving an event." in order to save audio (if available) when events are recorded. + Timestamp Tab -------------