Commit Graph

981 Commits

Author SHA1 Message Date
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
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 b2f96728d5 Spacing and improve debugging 2021-04-20 23:06:04 -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 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 f3fb5885a0 Improve debugging 2021-04-19 13:18:35 -04:00
Isaac Connor a9afdbddf1 Remove AddZones function and remove other commented out code 2021-04-19 10:26:08 -04:00
Isaac Connor 5b9745b652 fix memleak due to not delete audio_fifo and video_fifo 2021-04-17 12:50:26 -04:00
Isaac Connor 5ace2ca082 Fix loading Importance in sql. Change zones to a std::list<Zone> 2021-04-17 12:50:26 -04:00
Isaac Connor ab356a3695 Add a warning when connecting without disconnecting which can cause memleaks 2021-04-12 15:59:31 -04:00
Isaac Connor 939a0f40e6 Include image_count in debug line 2021-04-11 13:22:37 -04:00
Isaac Connor ed29021179 Rough in an importance setting in monitor that we can use to decrease the log level of certain events like PrimeCapture for cameras that we don't care about 2021-04-11 12:59:18 -04:00
Isaac Connor 1ccc416224 Merge branch 'release-1.34' 2021-04-09 20:00:47 -04:00
Isaac Connor d9dc61265d Fix DisableAlarms. Use signal when capture fails instead of erroneously using TRIGGER_OFF. Add status to DumpSettings so that we can query it with zmu. 2021-04-09 17:46:11 -04:00