[MERGED] Making rounding on Event Length optional

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
SirLouen
Posts: 25
Joined: Fri Mar 05, 2021 6:44 pm

[MERGED] Making rounding on Event Length optional

Post by SirLouen »

According to my research based on this thread:
viewtopic.php?f=40&t=30598

I've noticed that according to the code, Events on continuous recording are saved on a rounding basis for function RECORD exclusively (this can be bypassed in the Motion Record alternative).

Not sure why this behaviour has been implemented on the zm_monitor.cpp, but I think that this should be optionally selected in the MISC section

1511-1514 zm_monitor.cpp

Code: Select all

if ( section_length
                  && ( ( timestamp->tv_sec - video_store_data->recording.tv_sec ) >= section_length )
                  && ( (function == MOCORD && (event_close_mode != CLOSE_TIME)) || ! ( timestamp->tv_sec % section_length ) ) 
                 ) {
There should be a boolean variable that optionally permits also bypassing this on the RECORD function something like

Code: Select all

if ( section_length
                  && ( ( timestamp->tv_sec - video_store_data->recording.tv_sec ) >= section_length )
                  && ( (function == MOCORD && (event_close_mode != CLOSE_TIME)) || ! force_time_rounding || ! ( timestamp->tv_sec % section_length ) ) 
                 ) {
If this idea seems legit (at least for me is crucial since I need to be saving 1 hour of continuous recording blocks not 1 hour and 55 minutes).

Maybe I could do the patch, although, I'm not 100% confident with the whole architecture (specially the likings of frontend->SQL->variable), but I'm certain this shall be pretty straightforward for anyone who manages the code with confidence. Nevertheless, if approved, I could give this a go.
Last edited by SirLouen on Mon Mar 22, 2021 9:42 am, edited 1 time in total.
SirLouen
Posts: 25
Joined: Fri Mar 05, 2021 6:44 pm

Re: Making rounding on Event Length optional

Post by SirLouen »

I'm not a coding grand master, but as expected, this was the code hindering my issue...
That "rounding" thing was making things not match what I expected from a "Length" variable.

I've recompiled from sources just removing this (i've optinally set the MOCORD since I'm not using it, I could have remove it though)

Code: Select all

if ( section_length
                  && ( ( timestamp->tv_sec - video_store_data->recording.tv_sec ) >= section_length )
                  || ( (function == MOCORD && (event_close_mode != CLOSE_TIME)) ) 
                 ) {
                 

The only problem I find is that for some reason, when I compile in a new server it sets some paths like /etc/zm/zm.conf and /tmp to /etc/ and / respectively.

For example zmc, it's trying to search /etc/zm.conf instead on /etc/zm/zm.conf Not sure why, and in the docs there is no specific matter for this issue:
https://sgzoneminder.readthedocs.io/en/ ... rom-source

Any tips on how to solve this?
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Making rounding on Event Length optional

Post by Magic919 »

cmake option

Code: Select all

-DZM_CONFIG_DIR="/etc/zm"
-
SirLouen
Posts: 25
Joined: Fri Mar 05, 2021 6:44 pm

Re: Making rounding on Event Length optional

Post by SirLouen »

Magic919 wrote: Sat Mar 20, 2021 1:46 pm cmake option

Code: Select all

-DZM_CONFIG_DIR="/etc/zm"
What about the other routes?
I see that the ubuntu1504_cmake rules do this by default, but I'm not sure how can I force load them on cmake? (have not use cmake in the past)
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Making rounding on Event Length optional

Post by Magic919 »

I don’t know the term routes, but suggest looking at cmake -LA
-
SirLouen
Posts: 25
Joined: Fri Mar 05, 2021 6:44 pm

Re: Making rounding on Event Length optional

Post by SirLouen »

Magic919 wrote: Sat Mar 20, 2021 2:21 pm I don’t know the term routes, but suggest looking at cmake -LA
I mean, the only path modified is not /etc/zm
There are plenty of other paths switched like tmp dirs and others.
Basically I have an installation based on the latest Ubuntu PPA and I just want to recompile maintaining the same paths.
Not sure how this was achieved

BTW did a cmake -DZM_CONFIG_DIR="/etc/zm" and make/make install everything and after running zmc it fails again (Can't open /etc/zm.conf) because it still trying to use the /etc route.
SirLouen
Posts: 25
Joined: Fri Mar 05, 2021 6:44 pm

Re: Making rounding on Event Length optional

Post by SirLouen »

I think I've found the issue

I'm using Ubuntu 20.04 focal but 1.34 releases doesn't have focal distro files; therefore it fails when picking them and copying them for compilation process
This is legit since the logical understanding here is to use 1.35.X for future development approaches.

But since I was running my server in production I have 1.34, and I still want to keep this version so I simply picked the ubuntu2004 distro files from master branch and copied them into my release-1.34 branch
https://github.com/SirLouen/zoneminder/ ... lease-1.34

A little tricky but I've manage to make it work: no more rounding for me.

Still, I'm not sure if I will be able to create all the things to avoid rounding on future versions. I could put the effort to improve it, but I would like to hear some feedback from devs before implementing a feature that maybe is going to be ditched because it doesn't comply some ZoneMinder philosophy.
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Making rounding on Event Length optional

Post by Magic919 »

Follow the suggestion from the dev on Slack.
-
Post Reply