Commit Graph

159 Commits (620407e4089eb5cb0ee6d7594de747975c55d11f)

Author SHA1 Message Date
Isaac Connor bb046a387c Default to no limit to fps 2025-02-12 16:05:35 -05:00
Isaac Connor d968e243ff Implement mode=single for events, so that we can efficiently just grab a single frame 2024-08-19 18:26:35 -04:00
Isaac Connor 7665c63da0 Add datetime as a zms option 2024-07-09 08:14:15 -04:00
Isaac Connor 1fdfcf3cdd Limit scale to 16x mainly to put an upper bound on the amount of ram we might use. 2024-05-30 12:10:10 -04: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 01c6df434c Move code to shutdown the process properly into exit_zms and use it when auth fails. The stops a segfault. 2024-02-13 13:14:39 -05:00
Isaac Connor 8617c09f16 Implement new zms parameters frames= which is the # of frames to send when in streaming mode. The idea is to replicate single mode, but allowing for other intermediate images, like Waiting for Connection etc. type=single should only ever send 1 single image. 2024-01-04 11:37:49 -05:00
Isaac Connor a882b71a3b Close db before logterm because dbclose can do logging at debug level. 2023-11-09 14:54:38 -05:00
Isaac Connor 8d0c25c52a Change zmLoadAuthUser to use std::string in arguments. Include passing an optional username to allow the SQL to use an index to only compare to that user for efficiency. 2023-11-08 10:54:54 -05:00
Isaac Connor 2a3b16076c Fix missing %s in format string 2023-06-07 10:02:50 -04:00
Isaac Connor d264985a36 Be more specific about which permission failed, providing a better log message 2023-06-07 09:54:58 -04:00
Isaac Connor 12409e624e Support username and password as auth query params. These happen when using auth_relay=plain. 2023-02-25 13:12:40 -05:00
Isaac Connor d673266235 Stop the dbQueue before closing logs. Since dbQueue.stop() join's the dbQueue thread, it should not log after we return. 2022-05-18 19:00:30 -04:00
Isaac Connor dc055fb240 Remove code handling failure to setStreamStart. This is now ok and handled in runStream 2022-04-28 16:44:39 -04:00
Isaac Connor 45b6c97cc8 Don't exit if we fail to set stream start 2022-04-28 16:42:35 -04:00
Isaac Connor 133553e630 Revert "Merge pull request #3119 from Carbenium/fmt"
This reverts commit 90d930c7c3, reversing
changes made to 0bcb9d276f.
2022-02-27 14:05:14 -05:00
Isaac Connor c5b9ed9451 Revert "Fix zms build"
This reverts commit e6b36bb186.
2022-02-27 13:46:51 -05:00
Isaac Connor e6b36bb186 Fix zms build 2022-02-27 10:41:42 -05:00
Isaac Connor cad57df0bb
Merge branch 'master' into fmt 2022-02-26 13:56:20 -05:00
Isaac Connor 7ae9bebea4 Add analysis boolean query param 2022-01-07 12:40:21 -05:00
Isaac Connor a2ae63cefe
Merge branch 'master' into fmt 2021-11-16 15:10:45 -05: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
Peter Keresztes Schmidt d69afc9672 misc: Convert time(nullptr) calls to std::chrono 2021-06-13 23:22:51 +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
Isaac Connor 8f27db5d6f Do not stop dbQueue in logTerm. dbQueue is not just for logging. 2021-05-04 14:22:02 -04:00
Isaac Connor 88147f3f7a add another logInit so that early messages go to zms.log after loading config. Add Image::Initialise so that initialised flag will get set, and add a Deinitialise call so that ram allocated in zm_image gets freed. 2021-05-01 14:49:33 -04:00
Peter Keresztes Schmidt b5f3682d4e utils: some more reshuffling/grouping and formatting 2021-04-04 01:18:34 +02:00
Peter Keresztes Schmidt 67d7872e9a Eliminate non-thread-safe calls to gmtime
gmtime uses an internal static storage to which a pointer is given as return value.
Due to this it is not safe to call gmtime from multiple threads since the same static storage is used.

Use gmtime_r instead which allows to pass in a tm struct.

Fixes:
https://github.com/ZoneMinder/zoneminder/security/code-scanning/32
2021-03-21 21:42:02 +01:00
Peter Keresztes Schmidt d9568a98c0 Drop zm_thread which has been replaced by STL implementations 2021-03-04 10:55:46 +01:00
Peter Keresztes Schmidt e18750bb79 logger: Pass std::string as ID during logInit 2021-03-01 22:43:02 +01:00
Peter Keresztes Schmidt 589e5fec26 zms: Use fmt to construct the log ID 2021-03-01 22:43:02 +01:00
Peter Keresztes Schmidt aec4dbc6ff DB: Make connection initialization more predictable and avoid double-initialization
Remove calls to zmDBConnect from various places to avoid possible side-effects/double initialization.
The function should be called once from the main thread of the daemon.

Also split config loading into 2 steps: static and DB config loading. Load the static config before zmDBConnect is called so it has a chance to succeed.
2021-02-07 13:44:41 +01: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
Peter Keresztes Schmidt 5a57efdfe2 Replace deprecated C header includes with the C++ ones. 2021-02-04 05:39:03 +01:00
Peter Keresztes Schmidt e09fa1bebf Remove includes of <cinttypes>
Instead of including <cinttypes> directly, zm_define.h should be used
to get the typedef'ed types as well.
2021-02-02 21:37:26 +01:00
Isaac Connor b4fc782778 fifo.h got split into zm_fifo and zm_stream so update the code in zms 2021-03-01 16:49:27 -05:00
Isaac Connor 0f276887ad When can't connect to monitor send an image saying so 2021-01-15 14:43:44 -05:00
Isaac Connor 4d8f45d284 There is no need to copy query. We do not modify it. 2020-11-21 16:59:21 -05:00
Isaac Connor 7653a058a3 More correct code for setting source 2020-11-20 16:31:40 -05:00
Isaac Connor 033e749a57 improve code logic/spacing 2020-11-01 17:16:07 -05:00
Isaac Connor a4b83b0e99 Merge branch 'master' of github.com:zoneminder/ZoneMinder 2020-09-09 12:13:54 -04:00
Isaac Connor 6bfd7c5e14 log referer when unable to authenticate 2020-09-09 12:13:28 -04:00
Isaac Connor 3a9cec8e4d We no longer care about not being able to connect to the monitor. 2020-09-02 16:37:11 -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 ae9a5766f5 Merge branch 'release-1.34' into fix_zms 2020-04-26 18:19:30 -04:00
Isaac Connor 00dad82b46 Fix use of strncpy using the entire size of the buffer. You have to -1 for the null char 2020-04-23 18:12:54 -04:00
Isaac Connor 4aaa02dc24 fix cpplint complaints and remove casts that are unnecessary. Micro-optimisation by using fputs for date_string instead of fprintf 2020-04-23 18:12:44 -04:00
Isaac Connor e5c194e9ee Fix return 403 status code 2019-07-26 12:22:04 -04:00
Isaac Connor 0643108ba4 Use fputs instead of fprintf. Spacing and google code style changes 2019-07-26 10:53:48 -04:00
Isaac Connor 9a31f8792c return proper error codes when failed auth or fail permissions 2019-07-19 13:55:35 -04:00