Commit Graph

128 Commits

Author SHA1 Message Date
Isaac Connor
11a09d5ef9 fix: correct inet_ntop buffer size in RemoteCameraHttp
Buffer was sized for binary in6_addr (16 bytes) but inet_ntop needs
space for string representation (INET6_ADDRSTRLEN = 46 bytes).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 17:41:37 -05:00
Isaac Connor
4e0476603a fix: use errno instead of getsockopt return value for strerror
getsockopt() returns -1 on error, not an errno value. The actual error
code is stored in errno. Using strerror(retval) with retval=-1 gives
incorrect error messages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:56:04 -05:00
Yavor Doganov
9634d66307 Port to PCRE2 (Closes: #3384).
Bug-Debian: https://bugs.debian.org/999919
Bug: https://github.com/ZoneMinder/zoneminder/issues/3384
2025-02-26 21:04:32 +11:00
Aaron Kling
c4683d90a9 Format code using astyle google format
Commands used:
astyle --style=google --indent=spaces=2 --keep-one-line-blocks src/*.cpp
astyle --style=google --indent=spaces=2 --keep-one-line-blocks src/*.h
2024-03-26 13:43:58 -05:00
Isaac Connor
6f467dd0d4 Revert "regexp: port to pcre2"
This reverts commit fd09feb5f4.
2024-03-04 09:54:18 -05:00
David Aguilar
fd09feb5f4 regexp: port to pcre2
Update pcre usage to be compatible with pcre2.
2024-03-02 17:19:08 -08:00
Isaac Connor
983498cf18 Add support for application/octet-stream 2023-10-23 10:09:08 -04:00
Alejandro Criado-Pérez
543683aa4c Corrections on cpp and h files 2023-08-13 01:27:19 +02:00
Isaac Connor
30bb5d47d7 Implement split out username/password for remote_camera and remote_camera_http 2022-11-02 10:06:26 -04:00
Doug Nazar
110cc436a3 Switch from av_init_packet() to av_packet_alloc()
Remove all uses of deprecated av_init_packet() and switch any stack
based AVPackets to unique_ptrs allocated with av_packet_alloc().

Ensure that all code paths call av_packet_unref() after use to reset
before next usage.
2022-07-29 14:56:26 -04:00
Isaac Connor
90e27e9d3a Just pass the std::string not c_str() 2022-07-14 10:51:39 -04:00
Isaac Connor
5344babfd7 Don't close on a -1 2022-06-08 23:30:51 -04:00
Isaac Connor
11337eb2d3 Don't call Terminate if we aren't connected. Spacing 2022-06-08 16:46:16 -04:00
Isaac Connor
7c1c8482c6 Make failure to resolve non fatal 2021-08-24 10:23:24 -04:00
Peter Keresztes Schmidt
6114d40593 misc: Replace usleep with std::this_thread::sleep_for 2021-06-13 23:22:51 +02: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
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
da3a302ddd improve scope of buffer_len 2021-04-20 16:38:42 -04:00
Isaac Connor
c1035b7ffd spacing, remove dead code 2021-04-19 10:26:08 -04:00
Peter Keresztes Schmidt
7e1c580130 define: Add macro to annotate intended switch fallthroughs
Follow-up to 814953b331
It turns out [[gcc::fallthrough]] and -Wimplicit-fallthrough were only implemented in GCC 7 and throws a warning on older GCCs.
Add the FALLTHROUGH macro to handle GCC < 7 as found on Xenial.

Warning from GCC 5.5:
/home/runner/work/zoneminder/zoneminder/src/zm_remote_camera_http.cpp:624:13: warning: attributes at the beginning of statement are ignored [-Wattributes]
             [[gnu::fallthrough]];
2021-04-11 23:39:35 +02:00
Isaac Connor
1c7ae103ea receiving a signal is not a reason to fail a capture. It is a reason to retry 2021-03-29 18:01:10 -04:00
Isaac Connor
0a364f3b80 fix weird logic in ReadData 2021-03-29 11:54:55 -04:00
Peter Keresztes Schmidt
7a4c34ec7e RemoteCameraHttp: Fix a log message 2021-03-18 20:02:20 +01:00
Isaac Connor
079d3361a2 Rework to read content_length bytes at once. Micro-optimisation 2021-03-17 15:52:55 -04:00
Peter Keresztes Schmidt
0796a2262e Utils: Replace stringtf with a type-safe version that can't overflow 2021-03-06 00:12:18 +01:00
Peter Keresztes Schmidt
d9568a98c0 Drop zm_thread which has been replaced by STL implementations 2021-03-04 10:55:46 +01:00
Isaac Connor
b87d859f72 Set the packet's stream_index to the packetqueue stream. Rename get_ functions to get 2021-03-03 12:06:34 -05:00
Isaac Connor
449b547f2b Use buffer.head() instead of casting 2021-03-01 16:49:27 -05:00
Peter Keresztes Schmidt
814953b331 Fix warnings reported by -Wimplicit-fallthrough
Note: Once C++17 is supported switch to the standard conform [[fallthrough]] attribute.
For the time being [[gnu::fallthrough]] can be used since it is supported by GCC and Clang [1].

[1] https://clang.llvm.org/docs/AttributeReference.html#fallthrough
2021-02-27 00:29:35 +01:00
Isaac Connor
6c013f0e65 Put back includes needed on FreeBSD. Fixes #3165 2021-02-22 08:03:10 -05:00
Isaac Connor
3dab7d3ecc Don't need to Disconnect when Capture will return -1, as we will call Close() which calls Disconnect() 2021-02-19 12:08:48 -05:00
Peter Keresztes Schmidt
35514649c9 Monitor: Make audio and video streams directly accessible
Also remove Camera::getId() which returend the monitor ID. Since a camera is owned by an monitor, there is no need for this. Also it causes a circular include.
2021-02-11 19:22:22 +01:00
Peter Keresztes Schmidt
f43507dce0 Use the power of smart pointers to manage Monitor instances 2021-02-07 21:20:45 +01:00
Isaac Connor
513739aeb5 Merge pull request #3127 from Carbenium/header-cleanup
Cleanup and reorganize includes
2021-02-04 12:52:04 -05:00
Peter Keresztes Schmidt
0dbc39ee25 Cleanup and reorganize includes
With this commit a unified structure for includes is introduced.
The general rules:
 * Only include what you need
 * Include wherever possible in the cpp and forward-declare in the header

 The includes are sorted in a local to global fashion. This means for the include order:
  0. If cpp file: The corresponding h file and an empty line
  1. Includes from the project sorted alphabetically
  2. System/library includes sorted alphabetically
  3. Conditional includes
2021-02-04 18:02:01 +01:00
Isaac Connor
ac42aa2488 Setup mVideoStream and mVideoStreamId and set it in packet. 2021-02-04 10:27:56 -05:00
Peter Keresztes Schmidt
5a57efdfe2 Replace deprecated C header includes with the C++ ones. 2021-02-04 05:39:03 +01:00
Isaac Connor
ab65a65dfb use camel case on video_stream and audio_stream 2021-01-28 10:45:53 -05:00
Isaac Connor
6271971912 Use get_videoStream in zm_camera 2021-01-27 16:13:43 -05:00
Isaac Connor
518270a9ac Must set keyframe and codec_type of zm_packet 2021-01-27 12:50:17 -05:00
Isaac Connor
e28c724742 fix return values of Prime, Pre and PostCapture 2021-01-27 12:07:35 -05:00
Isaac Connor
a39a656373 Merge branch 'master' into zma_to_thread 2020-09-29 11:02:40 -04:00
Peter Keresztes Schmidt
8f980a1168 Convert NULL/0 to nullptr
The 0 -> nullptr changes should definitely improve readability.
2020-08-26 22:03:40 +02:00
Isaac Connor
bf2cb5fb1f Add PrimeCapture to zm_remote_camera_http. PrimeCapture is used to determine if we can connect and so by not implementing it, monitors like this say capturing even though they are not. 2020-08-08 10:21:06 -04:00
Isaac Connor
5fb56c9f57 Merge branch 'master' into zma_to_thread 2020-08-07 17:52:43 -04:00
Isaac Connor
a19990f4d7 Merge branch 'release-1.34' 2020-08-06 11:57:35 -04:00
Isaac Connor
d8cd4386cf rename GetOptEncoderParams to GetOptEncoderParams to GetOptEncoderParamsVec so that we can get at the std::string if we want to.
Use EncoderParams when setting movflags in VideoStore.

Move the content of this option to a help popup so that we can remove the comments from it. av_dict_parse doesn't handle the hash tag as a comment.
2020-07-30 15:06:05 -04:00
Isaac Connor
4ff341a0f5 Merge branch 'master' into zma_to_thread 2020-05-02 18:03:42 -04:00
Isaac Connor
c488756eb8 Merge branch 'master' into fix_remote_http 2020-02-19 14:42:24 -05:00
Isaac Connor
0afcbe626c remove redundant logging line. Connect() will do the logging 2020-01-13 12:51:30 -05:00