Page 1 of 1

[MERGED] Making rounding on Event Length optional

Posted: Sat Mar 20, 2021 10:28 am
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.

Re: Making rounding on Event Length optional

Posted: Sat Mar 20, 2021 12:57 pm
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?

Re: Making rounding on Event Length optional

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

Code: Select all

-DZM_CONFIG_DIR="/etc/zm"

Re: Making rounding on Event Length optional

Posted: Sat Mar 20, 2021 1:57 pm
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)

Re: Making rounding on Event Length optional

Posted: Sat Mar 20, 2021 2:21 pm
by Magic919
I don’t know the term routes, but suggest looking at cmake -LA

Re: Making rounding on Event Length optional

Posted: Sat Mar 20, 2021 2:27 pm
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.

Re: Making rounding on Event Length optional

Posted: Sat Mar 20, 2021 3:40 pm
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.

Re: Making rounding on Event Length optional

Posted: Sat Mar 20, 2021 4:02 pm
by Magic919
Follow the suggestion from the dev on Slack.

Re: [MERGED] Making rounding on Event Length optional

Posted: Mon Mar 22, 2021 10:29 am
by SirLouen