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
Isaac Connor
97dff2fb28
Open/CLose RTSP with analysis thread when opening and closing monitor. We have to have successfully PrimeCapture before adding streams to RTSP Server and need to shut it down when closing the monitor because the packetqueue goes away
2021-01-11 13:46:50 -05:00
Isaac Connor
2fe325efe7
further disable rtsp_server
2021-01-11 13:38:22 -05:00
Isaac Connor
81d6f8c1ee
disable rtsp_server
2021-01-07 15:13:02 -05:00
Isaac Connor
595bb2f565
Open/CLose RTSP with analysis thread when opening and closing monitor. We have to have successfully PrimeCapture before adding streams to RTSP Server and need to shut it down when closing the monitor because the packetqueue goes away
2021-01-07 09:47:53 -05:00
Isaac Connor
c8d2eb9c0f
Must stop threads before Closing monitor
2020-12-27 12:04:35 -05:00
Isaac Connor
400e0de609
When updating Monitor_Status, reset FPS on Prime
2020-12-22 10:22:52 -05:00
Isaac Connor
8d52baeee2
Merge branch 'master' into rtsp_server
...
Cleanup Analysis a bit. We can't skip packets just because they are audio. Clean up the state machine transitions a bit to make them a little more readable.
Change logic of PrimeCapture, success MUST return 1. 0 means no error but also no success.
Debugging and braces improvements in local_camera.
2020-12-17 10:16:54 -05:00
Isaac Connor
89eacbc8a8
NODECT needs an analysis thread to check for triggers and linked monitors. Turn off RTSP for now
2020-12-15 16:55:12 -05:00
Isaac Connor
99e7ae3505
Merge branch 'master' into rtsp_server
2020-12-15 10:14:19 -05:00
Isaac Connor
9d43b64d4a
Add debug and rtsp_server
2020-12-09 15:03:00 -05:00
Isaac Connor
df783f4835
Merge branch 'master' into zma_to_thread
2020-11-12 12:53:55 -05:00
Isaac Connor
cda3824a25
Use INSERT.. ON DUPLICATE... instead of REPLACE INTO. REPLACE INTO deletes the existing row. Since we now have event counts in there, we lose them.
2020-11-10 12:33:10 -05:00