Commit Graph

3933 Commits

Author SHA1 Message Date
Isaac Connor c28e1b09e5 Fix compile when using sysv shm 2021-02-06 20:11:38 -05:00
Isaac Connor ab2e468322 Fix resource leak on failure to load font 2021-02-06 20:11:38 -05:00
Isaac Connor 87c3a862e2 remove our copies of min() and max(). Use std::min() and std::max() 2021-02-06 16:02:09 -05:00
Isaac Connor 0b138ee687
Merge pull request #3134 from Carbenium/sort
Image: Replace qsort with std::sort
2021-02-06 13:14:58 -05:00
Peter Keresztes Schmidt 9dc3f15eac Image: Replace qsort with std::sort
std::sort has stricter complexity requirements than qsort and can be better optimized
by the compiler due to templating.
2021-02-06 15:41:56 +01:00
Isaac Connor 7f99635763 Fix xenial builds. Fixes #3130 2021-02-05 12:30:51 -05:00
Isaac Connor 885efc27ee adjust pts/dts on flushed video packets. Improve code comments and debugging 2021-02-04 21:38:37 -05:00
Isaac Connor 2cdf017767 Fixi endlessly writing null frames to video on close when encoding audio to aac 2021-02-04 20:40:11 -05:00
Isaac Connor 9df4487eb7 Remove code to update the frames to match videostore. they are always in sync now 2021-02-04 20:39:48 -05:00
Isaac Connor 8f9637f21a
Merge pull request #3129 from Carbenium/cmake-reformat
Build: Reindent the CMakeLists
2021-02-04 17:20:34 -05:00
Isaac Connor 5ce9203d2c add include <cstring> 2021-02-04 17:07:25 -05:00
Peter Keresztes Schmidt 6c9983155c Build: Reindent the CMakeLists
Indent with 2 spaces
Also remove expressions form closing tags. They have been made optional a while ago since they make reading rather more difficult.
2021-02-04 22:00:56 +01:00
Isaac Connor 2ee097c5f2
Merge pull request #3128 from Carbenium/int-type-macros
Consolidate __STDC_FORMAT_MACROS and __STDC_CONSTANT_MACROS definition
2021-02-04 14:44:51 -05:00
Isaac Connor da4b1fe3bc Use global FFMPEGInit(). Removed compiler warning 2021-02-04 14:07:37 -05:00
Peter Keresztes Schmidt dd527f0888 Consolidate __STDC_FORMAT_MACROS and __STDC_CONSTANT_MACROS definition
Move the definitions to zm_define.h and include the header at the appropriate locations.
These macros have not been adopted by the C++11 standard.
However glibc 2.17 (CentOS 7) still depends on them to provide the macros which are guarded by these defines.
2021-02-04 19:58:29 +01:00
Isaac Connor c57c50fd4a
Merge pull request #3123 from Carbenium/catch2
[RFC] Add Catch2 as C++ test framework and some exemplary tests
2021-02-04 12:57:04 -05:00
Peter Keresztes Schmidt bef4e4032f Add Catch2 as C++ test framework
Use -DCMAKE_BUILD_TEST_SUITE=1 during CMake invocation to activate building the tests.
The 'tests' target builds the unit tests which can then be executed using the 'test' target.

We depend on the Catch2 version of the system.
Since development normally takes place on current OSs, this shouldn't pose a problem.
2021-02-04 18:53:54 +01:00
Isaac Connor 513739aeb5
Merge pull request #3127 from Carbenium/header-cleanup
Cleanup and reorganize includes
2021-02-04 12:52:04 -05:00
Isaac Connor bf8b3fee2a
Merge pull request #3126 from Carbenium/cmake-man-pages
Build: Make building man pages optional (enabled by default)
2021-02-04 12:05:22 -05:00
Peter Keresztes Schmidt eef0da8f19 Remove references to <csignal> from AnalysisThread
The removed block_set member was unused.
2021-02-04 18:02:08 +01:00
Peter Keresztes Schmidt 22372b5117 Replace #pragama once with include guards to be consistent 2021-02-04 18:02:08 +01:00
Peter Keresztes Schmidt 8869bfd903 Gut out zm.h since it is used only to store the self variable 2021-02-04 18:02:08 +01:00
Peter Keresztes Schmidt 0dbc39ee25 Cleanup and reorganize includes
With this commit a unified structure for includes is introduced.
The general rules:
 * Only include what you need
 * Include wherever possible in the cpp and forward-declare in the header

 The includes are sorted in a local to global fashion. This means for the include order:
  0. If cpp file: The corresponding h file and an empty line
  1. Includes from the project sorted alphabetically
  2. System/library includes sorted alphabetically
  3. Conditional includes
2021-02-04 18:02:01 +01:00
Isaac Connor 046e352304 improvements to fps reporting. In analysis, we report based on image packets processed, but the fps value is calculated based on the count of images we did motion detection on. We no longer count audio packets in capture fps reporting. 2021-02-04 11:50:01 -05:00
Isaac Connor ad9fd05955 When allocating mVideoStream, set mVideoStreamId as well 2021-02-04 10:28:17 -05:00
Isaac Connor ac42aa2488 Setup mVideoStream and mVideoStreamId and set it in packet. 2021-02-04 10:27:56 -05:00
Peter Keresztes Schmidt 5a57efdfe2 Replace deprecated C header includes with the C++ ones. 2021-02-04 05:39:03 +01:00
Isaac Connor c61e6a8c56 If there is an open event in disconnect close it. The idea is that by the time we get to the destructor we should be all shut down 2021-02-03 17:04:40 -05:00
Isaac Connor 6ac5472606 Add disconnecting to zmc to free up resources. 2021-02-03 16:58:03 -05:00
Isaac Connor cb60b6c141 Fix bulk frame code and move it to event. Revert base score to 0. Fix cause of continuous events. Move GetState to .h 2021-02-03 16:57:44 -05:00
Isaac Connor 35470951ad Move the bulk frame logic from monitor to event. Fix up the logic of when to store a db frame. Fix altering max_score too early 2021-02-03 16:56:34 -05:00
Peter Keresztes Schmidt 4db0dea1f2 Build: Make building man pages optional (enabled by default)
Add a new CMake option (-DBUILD_MAN) which can be used
to deactivate the man page build steps.
This is especially useful in a development situation where "make all"
is needlessly slowed down by these build steps.
2021-02-03 21:22:28 +01:00
Isaac Connor be1db1ff20 Score should be a signed int 2021-02-03 09:08:06 -05:00
Isaac Connor f868d92269 Fix colour shift in Crop function due to not multiplying x position by colours 2021-02-02 23:19:53 -05:00
Isaac Connor 49e9bf86fa Code style 2021-02-02 23:19:53 -05:00
Isaac Connor 09d8dbb460 spacing 2021-02-02 23:19:53 -05:00
Isaac Connor 0958768ce5 Fix no bulk frames by setting score to -1 which means BULK. It will get changed to 0 or more by later code. Fixes #3121 2021-02-02 23:19:53 -05:00
Isaac Connor 7e469a28fa remove redundant code, code style and remove some unnecessary multiplies 2021-02-02 23:19:53 -05:00
Isaac Connor 38368a8b9d remove deprecated video_buffer_duration stuff. Fix loading monitor column order 2021-02-02 23:19:53 -05:00
Isaac Connor e09c80e385 Have to close camera AFTER threads have stopped 2021-02-02 23:19:52 -05:00
Isaac Connor 61c3c0d565 Should increment_it after releasing the packet to prevent deadlock 2021-02-02 23:19:52 -05:00
Isaac Connor 8de260472d improve the logic of clearing packets from queue. make get_event_start_it return a pointer to an it tracked by the packetqueue. 2021-02-02 23:19:52 -05:00
Isaac Connor cb0008fb8c Add rtsp_server and accessor 2021-02-02 23:19:52 -05:00
Isaac Connor afa5e27d56 load RTSPServer column as well. start_it needs to be tracked by packetqueue. We no longer close the camera in Monitor::Close because we need to clear the packetqueue, then wait for threads to finish, THEN close camera. So that logic needs to move to zmc 2021-02-02 23:19:52 -05:00
Peter Keresztes Schmidt 0c5c720e4b Remove includes of <stdint.h>
Instead of including the deprecated header <stdint.h>, zm_define.h should be used.
2021-02-02 21:37:26 +01:00
Peter Keresztes Schmidt e09fa1bebf Remove includes of <cinttypes>
Instead of including <cinttypes> directly, zm_define.h should be used
to get the typedef'ed types as well.
2021-02-02 21:37:26 +01:00
Peter Keresztes Schmidt 0f5df0c739 zm: Typedef C++11 int types to make them easier to use
In order to clearly state the intended length of an integer variable
all usages of other integer types (short int, int, long int, ...)
should be converted.
2021-02-02 21:37:26 +01:00
Isaac Connor b71aa4bd97 Fix never allowing the queue to fill when pre_event_count=0 2021-02-01 16:01:30 -05:00
Isaac Connor a5417cfe6c NULL=>nullptr. Update analysis_fps earlier on startup 2021-02-01 16:01:09 -05:00
Isaac Connor aa53260a32 Free packet counts and iterators in destructor. Fix mem leak in queuePacket. Introduce free_it method to release iterators 2021-02-01 10:25:48 -05:00