Isaac Connor
9cce9744d2
Merge pull request #3276 from Carbenium/cmake-ffmpeg
...
Build: Add CMake package module for FFmpeg
2021-06-04 17:35:45 -04:00
Isaac Connor
9f685d6c2b
Fixup style and warnings in zm_dump_codecpar
2021-06-04 17:32:45 -04:00
Peter Keresztes Schmidt
32f139ef7f
Build: Use FFmpeg package CMake module
2021-06-04 23:18:30 +02:00
Isaac Connor
a78feb739e
enable an encoder option to actually open the codec when doing passthrough. This fixes saving the h265.
2021-06-04 16:51:21 -04:00
Isaac Connor
b16eb510d0
More debugging around clearQueue. return early if deleting
2021-06-04 15:03:08 -04:00
Isaac Connor
205c488741
spacing
2021-06-04 15:01:57 -04:00
Isaac Connor
d713770dea
Include more fields in zm_dump_codecpar and zm_dump_codec
2021-06-04 15:01:48 -04:00
Isaac Connor
72d07d1428
Add a bunch of debugging about snapshot writing
2021-06-04 15:00:16 -04:00
Isaac Connor
ad0e7a5c1a
Use new get_packet_and_increment_it in decoder. Adjust some debugging levels
2021-06-03 18:22:18 -04:00
Isaac Connor
fc6202d349
Introduce get_packet_and_increase_it just so we can lose an extra grab lock and function calls, etc. In queuePacket, if the queue is full, WAIT instead of failing to queue.
2021-06-03 18:22:18 -04:00
Peter Keresztes Schmidt
0ea14317a4
Build: Remove unused cmakedefines
2021-06-01 23:54:49 +02:00
Peter Keresztes Schmidt
81a1546a2b
LocalCamera: Remove unnecessary ZM_HAS_V4L2 conditionals
...
V4L2 is the only V4L version we support. No need to conditionally compile those parts.
2021-06-01 00:05:05 +02:00
Peter Keresztes Schmidt
f2bee0704a
LocalCamera: Remove support for V4L1
...
Kernel support for Video4Linux 1 was removed in 2.6.38 (March 2011). It's time to drop support on our side.
2021-05-31 23:29:29 +02:00
Peter Keresztes Schmidt
ed7759897b
misc: Move ZM_HAS_* defines to zoneminder-config.cmake
2021-05-31 23:29:29 +02:00
Isaac Connor
f8b779dc25
fix crash when in alert state with no event
2021-05-31 16:02:42 -04:00
Isaac Connor
cc3bce48b7
hevc requires an open codec to set stream parameters right. Fixes garbage video when h265 passthrough
2021-05-31 16:00:17 -04:00
Isaac Connor
c686fa5949
SHould reset state as well as shared_data->state
2021-05-31 16:00:17 -04:00
Isaac Connor
d2941d6b87
Always print SAR and tel about unknown codec type
2021-05-31 16:00:17 -04:00
Isaac Connor
50fe7100fa
Remove the code to do adaptive skipping. We should never sleep when doing Analysis unless an error occurred.
2021-05-31 12:52:24 -04:00
Isaac Connor
0bcb30b8a9
Don't print out buffer since it isn't zero terminated
2021-05-31 10:19:58 -04:00
Peter Keresztes Schmidt
5d93555d9f
Crypto: Use new hashing API
2021-05-30 22:56:21 +02:00
Peter Keresztes Schmidt
9a983bb321
Crypto: Implement SHA1 hashing
2021-05-30 22:56:21 +02:00
Peter Keresztes Schmidt
8b87830e3e
Use the new ByteArrayToHexString helper
2021-05-30 22:53:05 +02:00
Peter Keresztes Schmidt
d2932b5d68
Utils: Add a ByteArrayToHexString helper
2021-05-30 22:53:05 +02:00
Peter Keresztes Schmidt
62f60b76d6
rtsp_auth/Authenticator: Convert to new hashing API
2021-05-30 22:53:05 +02:00
Peter Keresztes Schmidt
837b32ccff
User: Convert to new hashing API
2021-05-30 22:53:05 +02:00
Peter Keresztes Schmidt
2bda413698
Crypto: Implement a generic hashing API
...
Currently MD5 is implemented
2021-05-30 22:53:05 +02:00
Peter Keresztes Schmidt
a8b9d15d1b
Utils: Add our own ASSERT macro
...
Using `assert` from `<cassert>` leads to unused variable warnings in release builds.
Define the `ASSERT` macro which compiles to a no-op in release builds but still avoids
the warnings.
2021-05-30 21:41:58 +02:00
Peter Keresztes Schmidt
e34b6500d9
Utils: Add implementations for std::data and std::size
...
These can be removed once C++17 is supported.
2021-05-29 21:37:38 +02:00
Peter Keresztes Schmidt
45654cb514
Build: Make the JWT backend selectable
...
Introduce the -DZM_JWT_BACKEND CMake option through which the JWT backend can be selected.
Supported values: jwt_cpp (default; in-tree) and libjwt
When libjwt is chosen ZM_CRYPTO_BACKEND is taken into account to select the corresponding flavour of libjwt.
2021-05-29 21:37:30 +02:00
Peter Keresztes Schmidt
b81689aa3f
Remove libgcrypt as dependency
...
GnuTLS used gcrypt as backend but switched in ~2011 to nettle.
Thus we don't need to/shouldn't depend on it.
2021-05-29 21:37:30 +02:00
Peter Keresztes Schmidt
339cfd49bc
Image: Remove std::vector out-of-bounds access when filling polygons
...
While iterating through `active_edges` we call `std::next`. If the current
iterator is `.end()` we are accessing out-of-bound memory.
Make sure we always have a valid iterator past `it` in the loop.
Follow-up on 6642ca4515
2021-05-29 19:58:19 +02:00
Isaac Connor
09b0353592
Actually close the camera in localcamera::Close
2021-05-28 13:54:20 -04:00
Isaac Connor
195f9fc403
simplify test for being decoded. timestamping needs to be done as well
2021-05-28 11:38:48 -04:00
Peter Keresztes Schmidt
d413f3c78f
FfmpegCamera/Videostore: Disable hwaccel for ffmpeg found in Debian Stretch
...
The av_hwdevice_* API is not complete in 3.2. Enable hwaccel from 3.4 onwards.
2021-05-24 23:20:30 +02:00
Peter Keresztes Schmidt
e5cac38521
Comms: Make sure sun_path is NUL-terminated
...
When using strncpy the NUL-termination can go missing if the string to be copied is longer than the buffer.
Make sure the last character in the buffer is NUL.
If this really happens, the error (non-existing path due to truncation) will be caught during bind-ing.
Fixes the following warning:
/home/peterke/DEV/zoneminder/src/zm_comms.cpp: In member function ‘bool ZM::SockAddrUnix::resolve(const char*, const char*)’:
/home/peterke/DEV/zoneminder/src/zm_comms.cpp:207:10: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 108 equals destination size [-Wstringop-truncation]
207 | strncpy(mAddrUn.sun_path, path, sizeof(mAddrUn.sun_path));
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-05-24 00:44:15 +02:00
Peter Keresztes Schmidt
e881e97c06
Logger: Fix DB log messages not being populated
...
We need to `resize` the buffer string since `reserve` does not guarantee that the buffer is
actually available.
Follow-up on 298415fff3
2021-05-22 10:52:57 +02:00
Isaac Connor
a0df6aacaf
Spacing
2021-05-21 10:38:55 -04:00
Isaac Connor
4fcdeb7287
Fix alignment in get_out_frame. Fixes #3233 . If width % 32 then we can't use the more efficient 32 aligned scaling.
2021-05-21 10:37:51 -04:00
Isaac Connor
797a4adf70
Merge branch 'master' into fix_out_of_files_in_encoding
2021-05-20 18:56:16 -04:00
Isaac Connor
2f78916ab8
change mem_file to std::string to resolve initialization problems
2021-05-20 16:28:22 -04:00
Isaac Connor
16d9819796
include memory to fix build on centos 7
2021-05-20 15:56:31 -04:00
Isaac Connor
7ad92e51c3
Fix initializers to compile on centos7
2021-05-20 15:56:15 -04:00
Isaac Connor
db944cbca8
add debug of frame and align to 32bytes
2021-05-19 16:11:25 -04:00
Isaac Connor
bfd3131e63
try additional unrefs of hw_device_ctx and unref'ing after freeing codec
2021-05-19 10:04:54 -04:00
Isaac Connor
574adf0d1d
Merge branch 'master' into fix_out_of_files_in_encoding
2021-05-18 17:16:35 -04:00
Peter Keresztes Schmidt
deb12f5613
Restore GnuTLS support after VLA removal
...
298415fff3
made variables constexpr which led to build failures with GnuTLS.
2021-05-18 00:18:26 +02:00
Isaac Connor
ccc4d4af54
Merge branch 'master' into fix_out_of_files_in_encoding
2021-05-17 16:32:58 -04:00
Isaac Connor
24b3f4c1b7
When de-interlacing, need to wait for decoder. Fixes race
2021-05-17 16:32:33 -04:00
Isaac Connor
68fb87c861
Remove debug
2021-05-17 16:32:33 -04:00
Isaac Connor
26a9797909
code style and remove orientation setting when encoding. frames are already rotated
2021-05-17 16:32:33 -04:00
Isaac Connor
e01fcf1e94
Only set rotation if doing passthrough. undef hw_device_ctx in Close.
2021-05-17 16:30:33 -04:00
Isaac Connor
56a1e8d13b
cleanup CheckSignal, set usedsubpixorder
2021-05-17 16:29:57 -04:00
Isaac Connor
91b23a8760
Merge pull request #3235 from Carbenium/vla
...
Remove variable-length arrays from the codebase
2021-05-17 16:22:32 -04:00
Isaac Connor
f52d4c261c
Merge pull request #3236 from Carbenium/wformat
...
LocalCamera: Fix some format warnings reported by clang
2021-05-17 16:12:15 -04:00
Peter Keresztes Schmidt
298415fff3
Remove remaining usages of VLAs
2021-05-17 22:12:04 +02:00
Peter Keresztes Schmidt
77068163a3
LocalCamera: Fix some format warnings reported by clang
...
`capturePixFormat` and `imagePixFormat` are no enum entries. Do no try to log them as FourCC.
2021-05-17 20:37:37 +02:00
Peter Keresztes Schmidt
c0017a5263
Image: Move Edge class to its own namespace
...
The Edge class is an implementation detail of the scan-line polygon filling algorithm.
Tuck it away in the newly created PolygonFill namespace.
2021-05-17 20:20:33 +02:00
Peter Keresztes Schmidt
6642ca4515
Image: Eliminate VLAs from polygon fill algorithm implementation
2021-05-17 20:16:55 +02:00
Peter Keresztes Schmidt
a335e740f3
Utils: Fix possible name clash between std::clamp and ZM::clamp
...
The naming was ambiguous when compinling in C++17 mode.
2021-05-17 10:46:50 +02:00
Isaac Connor
4ee234293a
Merge branch 'master' into fix_out_of_files_in_encoding
2021-05-16 17:05:51 -04:00
Isaac Connor
2d9161551d
code style and remove orientation setting when encoding. frames are already rotated
2021-05-16 17:05:40 -04:00
Isaac Connor
bd7a4fd552
Add closing the codec to hopefully free the file handles in use in hwaccel
2021-05-16 13:53:56 -04:00
Peter Keresztes Schmidt
b1de220958
Polygon: Perform clip operation on existing object instead of returning a new clipped one
2021-05-16 19:42:41 +02:00
Peter Keresztes Schmidt
63cea992a0
Image: Fix a dynamic-stack-buffer-overflow when filling polygons
...
Make sure we don't read past the end of global_edges when i = 0.
We are moving the elements backwards so at most n_global_edges - 1 elements can be moved.
==6818==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0x7ffff888ae00 at pc 0x7fe4fd7be8ae bp 0x7ffff888ac90 sp 0x7ffff888a440
READ of size 96 at 0x7ffff888ae00 thread T0
#0 0x7fe4fd7be8ad in __interceptor_memmove (/lib/x86_64-linux-gnu/libasan.so.5+0x378ad)
#1 0x56524b2dba31 in Image::Fill(unsigned int, int, Polygon const&) /root/zoneminder/src/zm_image.cpp:2514
#2 0x56524af55530 in Monitor::DumpZoneImage(char const*) /root/zoneminder/src/zm_monitor.cpp:1510
#3 0x56524aeb38cb in main /root/zoneminder/src/zmu.cpp:574
#4 0x7fe4fb2b009a in __libc_start_main ../csu/libc-start.c:308
#5 0x56524aeb87a9 in _start (/root/zoneminder/cmake-build-relwithdebinfo-remote/src/zmu+0xf87a9)
2021-05-16 19:41:45 +02:00
Peter Keresztes Schmidt
09665b139f
Monitor: Clip zone polygon to image size when dumping
...
The polygon vertex coordinated of extra_zone are directly parsed from user input.
Clip the resulting polygon to the image size so we don't try to draw outside of the image.
This is already done for zone polygons stored and loaded from the DB.
2021-05-16 19:41:45 +02:00
Peter Keresztes Schmidt
29488900a1
Box: Make range calculations mathematically correct
2021-05-16 19:41:45 +02:00
Peter Keresztes Schmidt
dc79ec52c2
Polygon: Remove API to set manually extent
...
The extent has to be calculated from the vertices and shouldn't be modified manually.
2021-05-16 19:41:45 +02:00
Peter Keresztes Schmidt
ef7a083891
Zone: Actually clip the zone if it larger than the image
...
Until now only the boundary box was manually adjusted without actually clipping the polygon.
2021-05-16 19:41:45 +02:00
Peter Keresztes Schmidt
3c85d63655
Polygon: Implement clipping to a boundary box
...
Using the Sutherland-Hodgman algorithms convex and concave subject polygons can be clipped
by convex clip polygons.
For now we only need clipping to rectangles (Box), so limit our implementation to that. If needed this can be
trivially extended to convex clip polygons (a check whether the clip polygon is actually convex has to be added).
If convex clip polygons are needed we have to switch to e.g the Vatti algorithm.
2021-05-16 19:41:45 +02:00
Peter Keresztes Schmidt
5af6d6af3d
Polygon: Use std::vector to store the vertices
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
eaf91fcf1f
zm_define: Include cstddef so we have size_t
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
26bdf4ab1b
Deduplicate Edge struct
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
783dc09b4e
Box: Rename variables according to the styleguide
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
8f685b3d66
Box+Poly: Remove direct accessors to {Hi,Lo}{X,Y}
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
f85e3765db
Box: Remove unnecessary constructors
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
e6c159fb70
Vector2: Make coordinate components public
...
The components were already unconditionally/without side-effects writable. Let's make them public so we don't need the setters.
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
c8885fe2aa
Vector2: Use default copy/assignment ops
2021-05-14 20:14:50 +02:00
Peter Keresztes Schmidt
290b88e5ac
Vector2: Delete non-idiomatic comparison operators
...
The "greater than" and "lesser than" operator families don't make sense for coordinates.
If lexicographic comparison for ordering purposes is needed, it should be implemented separately.
2021-05-14 20:14:50 +02:00
Peter Keresztes Schmidt
60db1c2eaf
Coord: Rename to Vector2
...
The class is not only used to represent coordinates but also lengths in XY.
Vector2 is a more fitting/general name for this purpose.
2021-05-14 20:14:50 +02:00
Peter Keresztes Schmidt
3fc3a81286
Box+Coord: Remove empty cpp files
2021-05-14 20:14:50 +02:00
Isaac Connor
a56b4053fa
Use resize in stead of reserve so that image_buffer.size actually has a value
2021-05-13 14:24:03 -04:00
Isaac Connor
d52b53e690
Add further bounds checks when accessing image_buffer
2021-05-13 09:31:59 -04:00
Isaac Connor
70946921bc
fix code to release lock before notifying
2021-05-13 08:54:55 -04:00
Isaac Connor
5a8fa9efc9
Remove dead code and useless debug
2021-05-12 18:54:07 -04:00
Isaac Connor
6f977da94d
Fix potential outofbounds access to image_buffer in getSnapshot()
2021-05-12 14:21:54 -04:00
Isaac Connor
76171fcc43
If not doing passthrough, don't need to find the nearest keyframe
2021-05-11 10:22:40 -04:00
Isaac Connor
510b3e606b
Continue if frame file not found. Output useful text jpeg
2021-05-11 09:33:33 -04:00
Isaac Connor
b8e3cc33f0
make it so that the queue will more likely be empty on termination. Do not queue more sql if terminate flag is set.
2021-05-10 12:54:35 -04:00
Isaac Connor
3cd9bdccd5
style and performance improvements reported by cppcheck
2021-05-09 16:39:38 -04:00
Isaac Connor
01834d4ddc
finish converting Capture to std::shared_ptr
2021-05-09 07:35:47 -04:00
Isaac Connor
e970c46f7b
fix memleak. Fixes #3217
2021-05-09 07:18:36 -04:00
Isaac Connor
2cf6ad8089
Switch ZMPacket * to a shared_ptr<ZMPacket>. This is so that in LockedPacket we can unlock and then notify and be confident that packet_ won't have been deleted. Change ZMPacket->timestamp to be a timeval instead of timeval *. This might not have been necessary but I like it. No longer cuse the ZMPacket object to wrap the shared image buffers and timestamps. Use a vector for image_buffers.
2021-05-08 21:14:20 -04:00
Isaac Connor
9ee24170a9
use packetqueue.unlock instead of deleting the lock so that we wake up people waiting
2021-05-08 15:57:00 -04:00
Isaac Connor
d3e91da514
sigh. Move the snap unlock further down protecting another use of snap. Use a video test instead of image count to determine videoness of the snap
2021-05-08 12:35:28 -04:00
Isaac Connor
bd6566a819
Have to clearpacket while holding the lock on snap. Otherwise it can get deleted the moment we unlock it.
2021-05-08 12:26:13 -04:00
Isaac Connor
7efbf78260
Merge branch 'master' of github.com:ZoneMinder/zoneminder
2021-05-07 14:23:39 -04:00
Isaac Connor
a91197b47c
reset score_ to zero when we return for failing to meet pixel filters
2021-05-07 14:23:36 -04:00
Isaac Connor
4685c63fab
Add early return if pktQueue is empty so we can assume that it isn't below. Add notifications if we wake up and find that we have terminated so as to wake up any other waiters. Fixes failure to terminate when deinterlacing because both decoder and analysis are waiting
2021-05-07 14:04:51 -04:00
Isaac Connor
9c6d3989d3
Fix cases of failing to get second packet in de-interlacing
2021-05-07 14:03:36 -04:00
Isaac Connor
5ca5ce32e9
More debugging code, use nullptr instead of null
2021-05-07 09:11:00 -04:00
Isaac Connor
43f2f195f1
Fix a case in get_event_start_packet_it where if no pre_event_count we log an error and maybe don't start on a keyframe
2021-05-07 09:10:26 -04:00
Isaac Connor
4ea48708ed
move the code that waits for decoder to outside the motion detection area. In record mode decoding can happen behind analysis which seems like a good idea, except that then analysis won't free up the raw image.
2021-05-07 09:09:40 -04:00
Isaac Connor
442f126193
Fix compile on xenial which doesn't have hwaccel
2021-05-06 11:04:38 -04:00
Isaac Connor
b0b6de948d
Add h265 encoding with libx265, hevc_vaapi and hevc_nvenc
2021-05-05 16:47:39 -04:00
Isaac Connor
31a95fa27c
add nvenc support
2021-05-05 13:58:31 -04:00
Isaac Connor
3645ccea1b
Make vaapi accelerated encoding work
2021-05-04 20:20:33 -04:00
Isaac Connor
8f27db5d6f
Do not stop dbQueue in logTerm. dbQueue is not just for logging.
2021-05-04 14:22:02 -04:00
Isaac Connor
4f4a1a4565
if sendTextFrame fails, just exit.
2021-05-03 16:27:37 -04:00
Isaac Connor
934c726beb
Handle camera not being defined in SubpixelOrder and Colours. Remove subpixelorder as it exists in camera only
2021-05-03 15:19:45 -04:00
Isaac Connor
80d2f9f098
Revert "Don't consult a Camera object to return colours and subpixelorder, we have those as members. Fixes crash in zms"
...
This reverts commit 48f79da892
.
2021-05-03 14:19:34 -04:00
Isaac Connor
bc6ba0a772
Merge branch 'master' of github.com:ZoneMinder/zoneminder
2021-05-03 13:18:51 -04:00
Isaac Connor
8bd876d8c8
improve warning message to include the values that don't match
2021-05-03 13:18:39 -04:00
Isaac Connor
90dff85e40
Only default to BGRA when colours are > 1.
2021-05-03 13:17:58 -04:00
Isaac Connor
bf72bb2a22
Increase sleep after prime failure up to a minute.
2021-05-03 10:38:01 -04:00
Peter Keresztes Schmidt
e5ceed31cc
Image: Fix a typo introduced in 3f5dbb7780
2021-05-02 23:22:49 +02:00
Peter Keresztes Schmidt
e5613d0d27
Make sure all logging macro calls are terminated with a semicolon
2021-05-02 23:08:48 +02:00
Isaac Connor
260fcaadde
remove debug
2021-05-02 14:07:29 -04:00
Isaac Connor
3f5dbb7780
Default to rgba when subpixelorder is not specified
2021-05-02 14:07:29 -04:00
Isaac Connor
88147f3f7a
add another logInit so that early messages go to zms.log after loading config. Add Image::Initialise so that initialised flag will get set, and add a Deinitialise call so that ram allocated in zm_image gets freed.
2021-05-01 14:49:33 -04:00
Isaac Connor
59b1927ad6
do dbQUeue.stop in logTerm so we don't have to have an extra line in every executable
2021-05-01 14:49:33 -04:00
Isaac Connor
48f79da892
Don't consult a Camera object to return colours and subpixelorder, we have those as members. Fixes crash in zms
2021-05-01 14:49:33 -04:00
Isaac Connor
ad388e9fc5
Free up encodejpg_ccinfo in Deinitialize
2021-05-01 14:49:33 -04:00
Peter Keresztes Schmidt
14cb2bc3dd
zm_rtsp_server: Remove an unused variable
2021-05-01 00:24:54 +02:00
Peter Keresztes Schmidt
68bedfe48f
Fix logging format string mismatches
...
* Remove SZFMTD format macro and use %zu instead for size_t. %zu is understood by every compiler nowadays.
2021-04-30 00:26:24 +02:00
Peter Keresztes Schmidt
c3dd8d8a47
Logger: Annotate logPrint with format attribute
...
This allows the compiler to check for mismatches in the format string and the passed parameters.
2021-04-29 17:12:44 +02:00
Isaac Connor
0da4127114
cleanup ready_count update unneeded. Fix crash on reload due to being disconnected.
2021-04-29 07:07:12 -04:00
Isaac Connor
3d11366c0f
restart stream when RTSP stream name changes
2021-04-29 06:38:42 -04:00
Isaac Connor
1abadfafa1
Increase debug log level of allocating image
2021-04-28 16:13:57 -04:00
Isaac Connor
e53628e0bd
Remove old deinterlace code, make new code in ::decode. For 4 field, use the next image in the queue isntead of doing another capture
2021-04-28 16:13:41 -04:00
Isaac Connor
ba652af347
Define deinterlace values in an enum
2021-04-28 16:13:10 -04:00
Isaac Connor
a9ca6f8c13
Check for packets in the queue before we start traversing it to prevent crash
2021-04-28 12:12:24 -04:00
Isaac Connor
f61618b244
rework rtsp_server to look for new and free up old monitors
2021-04-27 16:35:13 -04:00
Peter Keresztes Schmidt
36205258c0
Image: Fix crash in Annotate in GRAY8 and RGB24 mode
...
Actually advance the image buffer pointer by one image line when looping through the codepoint lines.
2021-04-27 21:11:50 +02:00
Isaac Connor
2e35d94c94
Add missing source_
2021-04-27 10:34:22 -04:00
Isaac Connor
d9aac9bea9
it is ok to have empty monitors, should detect when new ones arrive
2021-04-27 10:28:46 -04:00
Isaac Connor
75973a2df1
Check for thread status before waiting. Fixes hang
2021-04-27 10:28:46 -04:00
Isaac Connor
9f49ac217e
add Stopped function to test whether the analysis thread is stopped from outside the class
2021-04-27 10:28:46 -04:00
Isaac Connor
df5b14dbd4
Merge pull request #3221 from Carbenium/zone-stats
...
Some optimizations/cleanups concerning Zones and ZoneStats
2021-04-27 09:26:07 -04:00
Isaac Connor
7bbcb7e36a
Merge pull request #3223 from Carbenium/font
...
Modernize the ZmFont API and add tests
2021-04-25 19:57:32 -04:00
Peter Keresztes Schmidt
3020acf994
ZmFont: Store character padding in font file
...
The size/variant specific character padding should be stored with the font data.
Modify the FontBitmapHeader accordingly and introduce a version field in the FontFileHeader
so we are able to check we have a font file with the right structure associated with that version.
The version field is set to 1 in this changeset.
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt
a918e8aeba
Image: Modernize Annotate method
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt
07e49e47af
utils: Add a clamping function mimicking std::clamp
...
This can be replaced with std::clamp in C++17.
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt
0c939f45dd
ZmFont: Rework/modernize API
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt
6d06eac55e
Monitor: Fix a crash when destroying a monitor (shutdown)
...
We have to make sure close_event_thread is joined before we destroy the thread object,
otherwise std::terminate will be called.
2021-04-25 23:09:32 +02:00
Peter Keresztes Schmidt
4180bc99ac
Zone: Sprinkle some const-ness
...
Keep references in for-loops const if no modifications are preformed on the object.
2021-04-25 22:34:33 +02:00
Peter Keresztes Schmidt
d4458d1216
Monitor: Store zones as vector instead of list
...
std::vector suits the usage pattern better with no random inserts/deletions
2021-04-25 22:29:18 +02:00
Peter Keresztes Schmidt
bb35d0a8bb
Frame: Auto-format
2021-04-25 22:29:18 +02:00
Peter Keresztes Schmidt
eb51408ef9
ZMPacket+Frame: Use vector to store ZoneStats
...
We don't any of the usage patterns that would warrant a std::list (random insert/deletion). Switch to vector which has much lower overhead for this kind of usage.
2021-04-25 22:29:18 +02:00
Peter Keresztes Schmidt
ad32a94931
ZoneStats: Rename members according to Google style guide
2021-04-25 17:18:07 +02:00
Peter Keresztes Schmidt
9e4674b53a
ZoneStats: Let the compiler define the copy constr. and assignment op.
...
There is no need for the user-defined versions since no manual resource management is done in the class.
Also a user-defined copy constructor or assignment operator prevents the implicit definition of a move constructor.
2021-04-25 17:18:07 +02:00
Isaac Connor
95a715a96a
When resume is given, clear the ref image, so that analysis can re-assign it. Don't do ref image in decode, leave it for analysis only. Handle zm_terminate after waiting for decode.
2021-04-23 14:52:29 -04:00
Isaac Connor
affac43964
Move DumpImgBuffer into public section so that we can clear an image instead of deleting it
2021-04-23 14:52:29 -04:00
Isaac Connor
76080cb857
add a stop function to dbQueue to clear out the queue before we kill log.
2021-04-23 09:25:07 -04:00
Isaac Connor
3e88f60f6d
Fix end code block comment on DetectMotion
2021-04-23 09:19:13 -04:00
Isaac Connor
b9fb08745c
Cleanup, fix length test for stats insert
2021-04-23 09:18:56 -04:00
Isaac Connor
9e890a7539
Add libcurl.so.4 as an option to load before libcurl-gnutls
2021-04-23 09:10:54 -04:00
Isaac Connor
27d200d376
Switch to using std::string for inserting frames and stats. We just can't know how long the sql will be and we aren't going to waste 2MB of ram on it. Remove unused functions.
2021-04-22 22:30:45 -04:00
Isaac Connor
8671e65517
More work on flushing out ZoneStats. Use references to avoid copying
2021-04-21 21:40:39 -04:00
Isaac Connor
be9c5d3f95
Introduce a ZoneStats structure/class and implement a list of them in packet, frame. Store the stats in a list in the packet until it is time to write them to the db in the event. Hence implement batched queuing of stats.
2021-04-21 17:51:43 -04:00
Isaac Connor
8ca93d2f0b
store event stats regardless of savejpegs or image availability
2021-04-21 14:59:57 -04:00
Isaac Connor
408e0963a0
Improve code and logging
2021-04-20 23:06:17 -04:00
Isaac Connor
b2f96728d5
Spacing and improve debugging
2021-04-20 23:06:04 -04:00
Isaac Connor
c48b42c2df
alarm frames without an image are still alarm frames. Count them in alarm count
2021-04-20 23:05:52 -04:00
Isaac Connor
fd72fbd2ac
Remove unused state var and unneeded if have_output
2021-04-20 17:22:35 -04:00
Isaac Connor
c7f06dda0b
Improve copy constructor to use initializers
2021-04-20 17:18:57 -04:00
Isaac Connor
a3379c986b
Only have fifo if HAVE_LIBSWRESAMPLE
2021-04-20 17:18:45 -04:00
Isaac Connor
1657d30be6
add override
2021-04-20 17:18:23 -04:00
Isaac Connor
9ea10584b7
pass fifo by const ref
2021-04-20 17:18:09 -04:00
Isaac Connor
9a54956163
pass fifo by const ref
2021-04-20 17:18:00 -04:00
Isaac Connor
c83b9190cb
pass peer_ip by const ref
2021-04-20 17:16:09 -04:00
Isaac Connor
05e7b6dfc5
add explicit
2021-04-20 17:15:53 -04:00
Isaac Connor
1f48dbbf6c
Use %u instead of %d for monitor id
2021-04-20 17:15:39 -04:00
Isaac Connor
6dc05ec942
add overrides
2021-04-20 17:09:51 -04:00
Isaac Connor
f23baf22de
Remove unused edges and slices
2021-04-20 17:09:42 -04:00
Isaac Connor
b6af846664
add missing initializers
2021-04-20 17:09:14 -04:00
Isaac Connor
beb2c4ddf7
fix redundant if
2021-04-20 17:09:00 -04:00
Isaac Connor
b37aa35085
improve scope of a,b
2021-04-20 17:07:07 -04:00
Isaac Connor
ccf1599b3a
use better variable names and avoid reusing user
2021-04-20 17:06:29 -04:00
Isaac Connor
de661752ce
pass jwt_token_str by reference
2021-04-20 17:04:45 -04:00
Isaac Connor
1f7da2835f
Fix overlaping use of i variable. Remove unused payloadDesc
2021-04-20 17:01:54 -04:00
Isaac Connor
21b6ac5a43
Make params const
2021-04-20 16:41:08 -04:00
Isaac Connor
da3a302ddd
improve scope of buffer_len
2021-04-20 16:38:42 -04:00
Isaac Connor
d86fc9fdd6
fix = operator to not require self-check
2021-04-20 16:35:47 -04:00
Isaac Connor
77055ee1cc
Remove unused code
2021-04-20 16:18:50 -04:00
Isaac Connor
7a674be285
Quiet cppcheck
2021-04-20 14:25:17 -04:00
Isaac Connor
32ae30a7b2
Fix alarm cause
2021-04-20 14:19:29 -04:00
Isaac Connor
433c3388fe
Pass where string by ref
2021-04-20 14:13:09 -04:00
Isaac Connor
6b1b873e9f
Reduce scope of vars, fix return value test of shmat
2021-04-20 14:10:58 -04:00
Isaac Connor
aad3b243c7
initialize padding
2021-04-20 14:10:33 -04:00
Isaac Connor
b0b95b57f8
packet can be const
2021-04-20 13:59:54 -04:00
Isaac Connor
320dfff5b2
Remove unused non blocking case
2021-04-20 13:59:07 -04:00
Isaac Connor
b62e8f7a81
mFormatContextPtr doesn't need to be a class member
2021-04-20 13:58:23 -04:00
Isaac Connor
45247c4d59
Add override to Close
2021-04-20 13:55:58 -04:00
Isaac Connor
ad830e43c6
clean up CheckSignal, getting rid of static vars
2021-04-20 13:26:47 -04:00
Isaac Connor
7561e88d9c
Change %d to %u for monitor id
2021-04-20 13:12:00 -04:00
Isaac Connor
c0c5c07ecf
Quiet cppcheck issues
2021-04-20 12:59:59 -04:00
Isaac Connor
813730f8b5
remove dead code
2021-04-20 12:59:41 -04:00
Isaac Connor
9249c736d5
Add overrides
2021-04-20 12:59:27 -04:00
Isaac Connor
bb0741dc6f
Add missing initializers
2021-04-20 12:59:19 -04:00