Commit Graph

19058 Commits

Author SHA1 Message Date
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 c8f2a813e3 Build: Enable VLA warnings
VLAs (variable-length arrays) are a C99 feature and were never standardised for C++.
There are better alternatives in C++ (mainly std::vector). Enable the warnings
so no new ones can be introduced.
2021-05-17 22:12:04 +02: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 e18f9676cd Bump version to new 1.37 dev version 2021-05-16 13:55:01 -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
Isaac Connor 23312a36b4
Merge pull request #3234 from Carbenium/poly
Rework API of geometry classes
2021-05-16 13:53:20 -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 c2a7f7b593 tests/Box: Add unit tests 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 707700e24e Vector2: Add unit tests 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 2afbbb17d2 Must upload source package. Get rid of -sd 2021-05-14 10:41:36 -04:00
Isaac Connor b17edf3153 Bump version to 1.36.0 2021-05-13 19:28:32 -04: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 e246083be5 Add StartDateTime Attr in sort dropdown 2021-05-12 10:32:03 -04:00
Isaac Connor 363b017977 If error was unauthorized, do a reload. 2021-05-12 10:32:03 -04:00
Isaac Connor bdae5dd9f8 Sort field should be StartDateTime not StartTime 2021-05-12 10:32:03 -04:00
Isaac Connor c080dd8a12 Fixes #2992. If no definition for a monitor is found, don't modify it. 2021-05-11 15:29:10 -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 726f1f616d Merge branch 'update_docs_1_34' 2021-05-10 14:53:14 -04:00