Commit Graph

999 Commits

Author SHA1 Message Date
Peter Keresztes Schmidt
95dd0c1491 Monitor: Convert internals to std::chrono 2021-06-13 09:58:33 +02:00
Isaac Connor
0301011f7e Adjust debug logging 2021-06-08 16:58:50 -04:00
Isaac Connor
afecd33879 Use new get_packet_and_increment_it in decoder. Adjust some debugging levels 2021-06-08 16:58:50 -04:00
Isaac Connor
84035ef4f7 Adjust debug logging 2021-06-08 16:54:41 -04:00
Peter Keresztes Schmidt
d8d27bcc92 Time: Replace remaining DeltaTimeval usage with std::chrono 2021-06-07 23:53:53 +02:00
Peter Keresztes Schmidt
46155942c1 Misc: Rename namespace ZM to zm
We had a mixture of both spellings. Unify it according to our code-style.
2021-06-06 19:11:11 +02:00
Peter Keresztes Schmidt
2d71743372 FFmpeg: Remove code paths required only by 2.8 and older
With Xenial support dropped we require FFmpeg 3.2 and newer.
2021-06-05 20:40:12 +02:00
Peter Keresztes Schmidt
7d15396833 Build: Promote libavformat to a required dependency
FFmpeg is an integral component of ZM. Promote the appropriate libraries to required dependencies.
This reduces the possible build configurations greatly and thus maintenance burden.
2021-06-05 14:25:27 +02: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
f8b779dc25 fix crash when in alert state with no event 2021-05-31 16:02:42 -04:00
Isaac Connor
c686fa5949 SHould reset state as well as shared_data->state 2021-05-31 16:00:17 -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
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
7ad92e51c3 Fix initializers to compile on centos7 2021-05-20 15:56:15 -04: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
56a1e8d13b cleanup CheckSignal, set usedsubpixorder 2021-05-17 16:29:57 -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
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
5af6d6af3d Polygon: Use std::vector to store the vertices 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
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
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
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
3cd9bdccd5 style and performance improvements reported by cppcheck 2021-05-09 16:39:38 -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
9c6d3989d3 Fix cases of failing to get second packet in de-interlacing 2021-05-07 14:03:36 -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
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
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
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
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
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
75973a2df1 Check for thread status before waiting. Fixes hang 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
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
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
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
3e88f60f6d Fix end code block comment on DetectMotion 2021-04-23 09:19:13 -04:00
Isaac Connor
8671e65517 More work on flushing out ZoneStats. Use references to avoid copying 2021-04-21 21:40:39 -04:00