Isaac Connor
e140620900
notify anyone waiting in packetqueue before waiting on a packet in motion detection. Should fix decode lockup
2021-09-14 13:38:55 -04:00
Isaac Connor
58f933ba1e
Add missing update_function_pointers so that we use SSE blend functions. Significantly reduces cpu use in motion detection.
2021-09-13 15:03:42 -04:00
Peter Keresztes Schmidt
5fda85bf2e
Image: Codestyle changes
2021-09-12 11:38:44 +02:00
Peter Keresztes Schmidt
ecf6cc80aa
Image: Fix Wclobbered warnings
...
From C99 spec:
[...] objects of automatic storage duration that are local to the function containing the invocation of the corresponding setjmp macro that do not have volatile-qualified type and have been changed between the setjmp invocation and longjmp call are indeterminate
Remove the variables in question or pass them as const refs.
2021-09-12 11:36:51 +02:00
Isaac Connor
a9379e5813
Need to increase frame_count or else frame_count%frame_mod will never == 0
2021-09-10 10:58:06 -04:00
Isaac Connor
a44bbf8e34
use get_packet_and_increment_it instead of the two step to improve locking
2021-09-08 18:35:01 -04:00
Peter Keresztes Schmidt
6e96cbe14a
Misc: Merge ZM_HAS_V4L with ZM_HAS_V4L2
2021-09-08 00:19:08 +02:00
Peter Keresztes Schmidt
0ac060fb78
LocalCamera: Fix Wformat warnings on FreeBSD
2021-09-08 00:19:08 +02:00
Peter Keresztes Schmidt
443b84270a
LocalCamera: Add a missing include to fix FreeBSD build
...
Fixes #3330
2021-09-08 00:19:08 +02:00
Peter Keresztes Schmidt
c83882a4c7
Build: Move V4L2 detection into its own module
...
Improves detection across different platforms (esp. FreeBSD) since system paths are automatically taken into account (this is in contrast to check_include_file).
2021-09-08 00:18:24 +02:00
Isaac Connor
328bd15360
Fix frame_count fps when paused
2021-08-30 18:06:05 -04:00
Isaac Connor
381fa0d08d
Fix viewing fps display by keeping track of last update time, last frame count and actually calculate it based on frames sent over a period of time.
2021-08-30 17:55:32 -04:00
Isaac Connor
8199554217
Spacing and fix the bogus setting shared_data->valid to false on disconnect. Other processes call disconnect. Only the capturing thread should set it to false.
2021-08-30 13:33:26 -04:00
Isaac Connor
048b8b13a3
Merge branch 'master' of github.com:ZoneMinder/zoneminder
2021-08-29 09:17:36 -04:00
Isaac Connor
6de8c71d2a
Set shm->valid to false on disconnect.
2021-08-29 09:17:31 -04:00
Isaac Connor
4af979c842
spacing
2021-08-29 09:15:40 -04:00
Isaac Connor
a4c079d1b3
Add code to set colour ranges so that we can safely convert to YUV420p instead of YUVJ420P
2021-08-26 14:15:09 -04:00
Isaac Connor
7c1c8482c6
Make failure to resolve non fatal
2021-08-24 10:23:24 -04:00
Isaac Connor
848a537a0f
Fix zms giving 500 code instead of displaying error image due to not having sent the headers yet.
2021-08-23 18:10:31 -04:00
Isaac Connor
a3a592d5e1
Fix errors due to not stopping the dbQueue. Fix crash when querying v4l devices
2021-08-05 14:48:14 -04:00
Isaac Connor
85d5dd806e
Read 4k at a time instead of 32 bytes. OS will read whatever is available. This basically reduces logging and a little cpu overhead
2021-08-05 13:30:52 -04:00
Peter Keresztes Schmidt
4392198d14
Fix closing event in MOCORD mode
...
Bug introduced in 707975e567
2021-08-03 09:56:07 +02:00
Isaac Connor
1766bbdfcd
Handle the case when the monitor doesn't exist more gracefully and not crash. Fixes #3316
2021-07-08 10:07:01 -04:00
Isaac Connor
b0cf3a4732
Merge pull request #3314 from Carbenium/path-max
...
Fix Wformat for stringtf and convert path buffers depending on PATH_MAX to std::string
2021-07-07 11:34:03 -04:00
Peter Keresztes Schmidt
eaf2e51b0c
utils: Make sure the compiler can emit format warnings for stringtf
...
Unfortunately the compilers can't emit Wformat warnings for variadic templates
and those can't be annotated with the format attribute.
Use a variadic function which can be annotated and thus warns on format string-args mismatches.
Ref 0796a2262e
2021-07-06 10:33:17 +02:00
Peter Keresztes Schmidt
80b08a2075
Convert path buffers depending on PATH_MAX to std::string
2021-07-06 10:33:17 +02:00
Peter Keresztes Schmidt
65656de6ce
db: Adjust the query methods to accept std::strings
2021-07-06 10:20:46 +02:00
Peter Keresztes Schmidt
c60b577aec
Convert more char array buffers to std::string
...
Remove now unused ZM_SQL_*SIZE defines
2021-07-06 10:20:46 +02:00
Peter Keresztes Schmidt
fc15afefcf
Event: Remove unused and broken prepared statement code
2021-07-06 10:20:45 +02:00
Peter Keresztes Schmidt
cf9c47149f
db: Add helper for escaping strings and use it
2021-07-06 10:20:45 +02:00
Isaac Connor
e6b67dcdc2
We cannot delete from the queue when capturing. Just do the waiting. Reduce severity of logs. Make more use of auto. Realise that no other iterators can be pointing into the queue.
2021-06-15 13:42:55 -04:00
Peter Keresztes Schmidt
ea10939970
zmu: Fix missing include
2021-06-15 00:16:08 +02:00
Peter Keresztes Schmidt
531694bf8d
RtspThread: Add missing static_cast when fprinting duration .count()
2021-06-14 20:09:30 +02:00
Isaac Connor
fa11c20bf8
Merge pull request #3297 from Carbenium/time-misc
...
Convert the rest of the codebase to std::chrono
2021-06-13 17:47:40 -04:00
Peter Keresztes Schmidt
d69afc9672
misc: Convert time(nullptr) calls to std::chrono
2021-06-13 23:22:51 +02:00
Peter Keresztes Schmidt
6114d40593
misc: Replace usleep with std::this_thread::sleep_for
2021-06-13 23:22:51 +02:00
Peter Keresztes Schmidt
f675afc3f2
zmc: Convert internals to std::chrono
2021-06-13 23:22:51 +02:00
Peter Keresztes Schmidt
3e8b10d813
zm::Select: Convert API to std::chrono
2021-06-13 23:22:51 +02:00
Peter Keresztes Schmidt
c823b9c00e
Buffer: Convert API to std::chrono
2021-06-13 23:22:51 +02:00
Peter Keresztes Schmidt
707975e567
Monitor: Convert API to std::chrono
2021-06-13 23:22:49 +02:00
Peter Keresztes Schmidt
dff5452f11
Event: Convert API to std::chrono
2021-06-13 23:20:24 +02:00
Peter Keresztes Schmidt
335e950654
Frame: Convert API to std::chrono
2021-06-13 23:20:24 +02:00
Peter Keresztes Schmidt
7c6a6ac309
VideoStream: Convert internals to std::chrono
2021-06-13 23:20:24 +02:00
Peter Keresztes Schmidt
ce55ba5fb7
VideoStore: Convert internals to std::chrono
2021-06-13 23:20:22 +02:00
Isaac Connor
c2f4d65860
Turn down debugging
2021-06-13 14:08:51 -04:00
Isaac Connor
c56025beab
Use std::unordered_map instead of std::map for performance. Be slightly more efficicent by storing an interator and using it instead of continually indexing into the std::map. Fix crash when a monitor's mmap file size changes
2021-06-13 14:08:51 -04:00
Isaac Connor
9f8c8a2664
Return early if packetqueue is empty instead of getting the lock. Return early in clear() if we are not initialised
2021-06-13 14:08:51 -04:00
Peter Keresztes Schmidt
f374b319e0
RtpSource: Convert internals partially to std::chrono
...
This allows us to remove the tvNow() helper method.
2021-06-13 16:35:27 +02:00
Peter Keresztes Schmidt
ff8c9f67c1
Image: Convert API to std::chrono
...
Utils: Remove TimespecDiff. It is not used anymore
2021-06-13 14:50:16 +02:00
Peter Keresztes Schmidt
b2ee71c96e
EventStream: Finalize conversion of internals to std::chrono
2021-06-13 11:30:22 +02:00
Peter Keresztes Schmidt
e1fe53338c
BaseStream: Convert internals to std::chrono
2021-06-13 11:29:59 +02:00
Peter Keresztes Schmidt
95dd0c1491
Monitor: Convert internals to std::chrono
2021-06-13 09:58:33 +02:00
Peter Keresztes Schmidt
07dbb75c56
Merge pull request #3285 from Carbenium/time-event
...
Convert Event and Logger internals to std::chrono
2021-06-08 23:29:57 +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
b0b2f5fc16
Logger: Convert internals to std::chrono
2021-06-08 19:45:23 +02:00
Peter Keresztes Schmidt
44ace34593
Event: Convert internals to std::chrono
2021-06-08 19:41:11 +02:00
Peter Keresztes Schmidt
d8d27bcc92
Time: Replace remaining DeltaTimeval usage with std::chrono
2021-06-07 23:53:53 +02:00
Peter Keresztes Schmidt
6c68397249
Time: Convert some timeval operations to std::chrono
...
Also remove now defunct timeval helper methods.
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
7474294ac3
Time: Remove DELTA_TIMEVAL macro and replace usage with proper std::chrono::duration operations
2021-06-06 16:41:36 +02:00
Peter Keresztes Schmidt
154b17d5f3
Time: Implement duration_cast from DeltaTimeval to std::chrono::duration
...
This will allow us to migrate step-by-step from DeltaTimeval to std::chrono.
2021-06-06 15:15:36 +02:00
Peter Keresztes Schmidt
2a32f75a24
Time: Implement duration_cast between timeval and std::chrono::duration
...
This will allow us to migrate step-by-step from timeval and related types to std::chrono.
2021-06-06 15:15:05 +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
73351f4387
Drop Ubuntu Xenial support
2021-06-05 17:16:22 +02:00
Peter Keresztes Schmidt
0625f6ca1c
Misc: Cleanup some includes
2021-06-05 15:08:38 +02:00
Peter Keresztes Schmidt
5c96eedac8
Build: Remove dependency on libavdevice
...
We currently don't use the library so don't depend on it.
2021-06-05 15:08:38 +02:00
Peter Keresztes Schmidt
3d34e6f177
Build: Promote libswresample 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:27:42 +02:00
Peter Keresztes Schmidt
762476ec76
Build: Promote libswscale 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:27:31 +02:00
Peter Keresztes Schmidt
a9ad5c5eee
Build: Promote libavcodec 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:54 +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
Peter Keresztes Schmidt
1a6904a297
Build: Promote libavutil 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:21:41 +02:00
Peter Keresztes Schmidt
70c626a30e
Merge pull request #3277 from Carbenium/remove-libavresample
...
Remove libavresample support
2021-06-05 11:44:50 +02:00
Peter Keresztes Schmidt
0b7f9396b4
FFmpeg: Remove no longer valid includes
2021-06-05 00:24:14 +02:00
Peter Keresztes Schmidt
7d501a6585
Remove libavresample support
...
libavresample hasn't been maintained for a long time by FFmpeg since libswresample superseded it.
In 2018 it was officially deprecated [1].
Let's remove the support for it since there is no need to maintain this option further.
[1] https://patchwork.ffmpeg.org/project/ffmpeg/patch/20171225175335.18183-1-atomnuker@gmail.com/
2021-06-04 23:46:58 +02:00
Isaac Connor
cca30661d7
remove invalid debug
2021-06-04 17:42:00 -04:00
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