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
Isaac Connor
5a8fa9efc9
Remove dead code and useless debug
2021-05-12 18:54:07 -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
8f27db5d6f
Do not stop dbQueue in logTerm. dbQueue is not just for logging.
2021-05-04 14:22:02 -04:00
Isaac Connor
bf72bb2a22
Increase sleep after prime failure up to a minute.
2021-05-03 10:38:01 -04:00
Isaac Connor
59b1927ad6
do dbQUeue.stop in logTerm so we don't have to have an extra line in every executable
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
76080cb857
add a stop function to dbQueue to clear out the queue before we kill log.
2021-04-23 09:25:07 -04:00
Isaac Connor
1f48dbbf6c
Use %u instead of %d for monitor id
2021-04-20 17:15:39 -04:00
Isaac Connor
c479c6d68f
Must disconnect on error/reload to avoid memleak. Remove waiting 5 second on failure/reload.
2021-04-17 12:50:26 -04:00
Isaac Connor
4255f78602
Use monitor->Importance in passing severity of log message about failed to Prime Capture
2021-04-11 12:59:18 -04:00
Peter Keresztes Schmidt
b5f3682d4e
utils: some more reshuffling/grouping and formatting
2021-04-04 01:18:34 +02:00
Isaac Connor
2b34d09b84
Move analysis_thread into Monitor. Don't do extra gettimeofday if no delays are set. Fix status update on terminate
2021-03-17 12:49:50 -04:00
Isaac Connor
b5f45b0987
fix alignment of help
2021-03-11 13:16:44 -05:00
Isaac Connor
46bf765f80
Set heartbeat on startup. Fix logic in ShmValid
2021-03-08 18:31:01 -05: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
cafdd02307
Remote rtsp server code. It got moved to zm_rtsp_server.cpp
2021-03-01 16:46:48 -05:00
Isaac Connor
3ce4b3e657
Keep capture_delay in useconds instead of msecs. Fix fps by adding back in the previous sleep_time. Fix crash due to capture_image not being asigned for local cameras
2021-02-25 16:58:54 -05:00
Isaac Connor
224fcd2cd3
Merge branch 'master' of github.com:ZoneMinder/zoneminder
2021-02-25 14:58:45 -05:00
Isaac Connor
8aeb4ab758
Switch db_mutex to a std::mutex. Use modern locking with it. Use zmDbDo or dbQueue.push where appropriate. code cleanup.
2021-02-25 12:26:26 -05:00
Isaac Connor
381b7e1b25
Don't disconnect/reconnect while PrimeCapture is failing. Don't sleep if there is failure in capturing and zm_terminate is set.
2021-02-24 10:29:26 -05:00
Isaac Isaac
3eb67fa2fc
We have to Prime every monitor not just the first one.
2021-02-23 13:12:40 -05:00
Isaac Connor
0b0df96271
Merge branch 'master' of github.com:ZoneMinder/zoneminder
2021-02-18 16:05:10 -05:00
Isaac Connor
519e39b4f4
Reloading has to stop other threads while we are re-initing the logs. So move it down
2021-02-17 10:07:36 -05:00
Peter Keresztes Schmidt
c0151caa64
Monitor: Signal by making the camera a unique_ptr the ownership relation
...
In addition we get RAII and thus automatic destruction of the camera when the monitor is destructed.
Monitor API change: getCamera -> LoadCamera
If additional properties of the camera are needed externally they should be exposed directly via Monitor.
2021-02-11 19:22:22 +01: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
ede811df50
zmc: Simplify Monitor's shutdown procedure
...
disconnect() is already called in the destructor. Since `monitors` goes out of scope all instances will get automatically destructed. There is no need to manually call disconnect().
2021-02-11 19:22:22 +01:00
Peter Keresztes Schmidt
0a665c0710
Monitor: Close the associated camera when closing the monitor
...
The camera is owned by the monitor. There is no reason to keep the camera open, when the owner is closed.
2021-02-11 19:22:22 +01:00
Peter Keresztes Schmidt
42484e6434
zmc: Fix a deadlock on shutdown/reconnection
...
First stop the analysis threads, then close the monitors and thus drain the packet queues before trying to join the analysis threads since they might hang while waiting for the next packet to arrive.
2021-02-11 15:48:22 +01:00
Isaac Connor
fab7efa003
Fix PrimeCapture on local cams. We need to be able to call it for each monitor
2021-02-09 20:29:37 -05:00
Peter Keresztes Schmidt
0380bee130
AnalysisThread: Make the class un-movable
...
We depend on an unchanged value of "this" after the creation of the thread otherwise undefined values would be accessed within the std::thread.
2021-02-09 23:54:50 +01:00
Isaac Isaac
c233bf3463
spacing and a fix for duplicated for loop setting up rtsp server
2021-02-09 13:18:34 -05:00
Peter Keresztes Schmidt
b22dbd4788
AnalysisThread: Move it over to std::thread
2021-02-09 12:26:53 +01:00
Isaac Connor
57f599237c
Merge pull request #3136 from Carbenium/db-connect
...
DB: Make connection initialization more predictable and finalize mysql library correctly
2021-02-08 08:43:33 -05:00
Peter Keresztes Schmidt
f43507dce0
Use the power of smart pointers to manage Monitor instances
2021-02-07 21:20:45 +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
dd527f0888
Consolidate __STDC_FORMAT_MACROS and __STDC_CONSTANT_MACROS definition
...
Move the definitions to zm_define.h and include the header at the appropriate locations.
These macros have not been adopted by the C++11 standard.
However glibc 2.17 (CentOS 7) still depends on them to provide the macros which are guarded by these defines.
2021-02-04 19:58:29 +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
Peter Keresztes Schmidt
5a57efdfe2
Replace deprecated C header includes with the C++ ones.
2021-02-04 05:39:03 +01:00
Isaac Connor
6ac5472606
Add disconnecting to zmc to free up resources.
2021-02-03 16:58:03 -05:00
Isaac Connor
e09c80e385
Have to close camera AFTER threads have stopped
2021-02-02 23:19:52 -05:00
Isaac Connor
49cf55c22c
Put close back before joins
2021-01-31 12:39:06 -05:00
Isaac Connor
14c06cd2d4
Close monitor after terminating threads instead of before
2021-01-31 11:44:25 -05:00
Isaac Connor
bfaed28cff
use config.min_rtsp_port to determine if we start up the rtsp server. Move the sleep on failure to capture down below shutting everything down.
2021-01-26 14:20:03 -05:00
Isaac Connor
8a1686076a
break long line
2021-01-22 20:24:29 -05:00
Isaac Connor
a30a473981
fix passing in audiostream
2021-01-21 10:27:15 -05:00
Isaac Connor
66c78e5a9b
Merge branch 'zma_to_thread' into rtsp_server
2021-01-19 13:43:25 -05:00
Isaac Connor
649114ed39
further disable rtsp_server
2021-01-11 13:46:50 -05:00
Isaac Connor
497b91f7c6
disable rtsp_server
2021-01-11 13:46:50 -05:00