Commit Graph

349 Commits

Author SHA1 Message Date
Isaac Connor c48b42c2df alarm frames without an image are still alarm frames. Count them in alarm count 2021-04-20 23:05:52 -04:00
Isaac Connor e5d4665a42 Quiet cpp-check complaints 2021-04-20 11:00:13 -04:00
Isaac Connor b6fcadf31b Put dbrow and fetch into a scope so that it goes away quick 2021-04-20 10:55:39 -04:00
Isaac Connor 0343642c42 duplicate test for neagtive timestamp 2021-04-20 10:54:24 -04:00
Isaac Connor 6f28c16915 Uwse the db queue for event updates 2021-04-09 19:45:55 -04:00
Isaac Connor 6c428c0156 Properly print out timeval 2021-03-29 09:58:09 -04:00
Peter Keresztes Schmidt 4e8c7d1f7c Eliminate non-thread-safe calls to localtime
localtime uses an internal static storage to which a pointer is given as return value.
Due to this it is not safe to call localtime from multiple threads since the same static storage is used.

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

Fixes:
https://github.com/ZoneMinder/zoneminder/security/code-scanning/24
https://github.com/ZoneMinder/zoneminder/security/code-scanning/25
https://github.com/ZoneMinder/zoneminder/security/code-scanning/26
https://github.com/ZoneMinder/zoneminder/security/code-scanning/27
https://github.com/ZoneMinder/zoneminder/security/code-scanning/28
https://github.com/ZoneMinder/zoneminder/security/code-scanning/30
https://github.com/ZoneMinder/zoneminder/security/code-scanning/31
https://github.com/ZoneMinder/zoneminder/security/code-scanning/33
https://github.com/ZoneMinder/zoneminder/security/code-scanning/58
https://github.com/ZoneMinder/zoneminder/security/code-scanning/59
https://github.com/ZoneMinder/zoneminder/security/code-scanning/63
https://github.com/ZoneMinder/zoneminder/security/code-scanning/64
https://github.com/ZoneMinder/zoneminder/security/code-scanning/65
2021-03-21 21:42:02 +01:00
Isaac Connor 28490816dc Use new zmDbDoUpdate to end the event 2021-03-11 13:48:42 -05:00
Isaac Connor 0a8b34843c
Merge pull request #3188 from Carbenium/drop-zm-thread
Drop our custom threading code
2021-03-04 13:02:51 -05:00
Isaac Connor 5259b78065 Fix event notes not getting populated. 2021-03-04 11:12:27 -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 f8b7ec8cb9 Save frames when in ALARM state so that pre-event frames get stored 2021-03-02 11:47:38 -05:00
Peter Keresztes Schmidt 403061a39c Fix warnings reported by -Wmissing-field-initializers 2021-02-26 22:46:09 +01: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 7c042c7837 If doing encoding, we don't care about keyframe 2021-02-21 20:24:36 -05:00
Isaac Connor d8afd58072 Remove 1 seconds sleeps from db timeout loops. 1 second is a long time. Remove UpdateFramesDelta code which is no longer needed 2021-02-19 12:07:59 -05:00
Isaac Connor 5ad9244a73 Use new db utility functions to simplify event creation code 2021-02-18 16:01:45 -05:00
Isaac Connor bc41cd944e Add missing db_lock.unlock() 2021-02-18 15:00:30 -05:00
Isaac Connor 0d59584250 Only set DefaultVideo if we are successful at opening videoStore. Set save_jpegs flag in db record if we turn it on after failing videoStore. 2021-02-18 13:30:05 -05:00
Isaac Connor 9c3bf0af1d Always default to mp4 for now 2021-02-14 09:49:30 -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
Isaac Connor 64cfac9255 Only loop on SQL insert for wait timeout error, not others 2021-02-10 13:54:20 -05:00
Isaac Connor 67cd038a4f Include pre-alarm frames in db 2021-02-09 15:33:09 -05:00
Isaac Connor a5519075f5 Also save ALERT frames to db 2021-02-09 14:22:02 -05:00
Isaac Connor e5f39e78c6
Merge pull request #3133 from Carbenium/dump-packet
ffmpeg: exit dumpPacket early if debug logging is not enabled
2021-02-07 10:40:58 -05:00
Peter Keresztes Schmidt 938676b129 ffmpeg: exit dumpPacket early if debug logging is not enabled 2021-02-07 11:58:17 +01:00
Isaac Connor 9df4487eb7 Remove code to update the frames to match videostore. they are always in sync now 2021-02-04 20:39:48 -05: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 35470951ad Move the bulk frame logic from monitor to event. Fix up the logic of when to store a db frame. Fix altering max_score too early 2021-02-03 16:56:34 -05: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 d741f4ba04 accept packets with image data 2021-01-27 12:49:27 -05:00
Isaac Connor e10d15fa91 Only write db entries for video frames but do write them even if no decoded image 2021-01-26 12:20:32 -05:00
Isaac Connor 835cc8076e Cleanup constructor, using initializers. Pass in CodecContexts as well. We need them for timebases. Fixes passthrough timestamps. 2021-01-25 18:50:35 -05:00
Isaac Connor 83c60b7317 Make the error message clearer by actually printing the time. 2021-01-15 11:53:25 -05:00
Isaac Connor b2c5860062 dumpPacket when addPacket 2021-01-11 13:46:50 -05:00
Isaac Connor 67f4359242 clean up code giving warning when no starttime is given 2021-01-11 13:46:50 -05:00
Isaac Connor 00aae0b68f Use proper c++ initializers 2020-12-30 21:21:59 -05:00
Isaac Connor e58c06e60f Don't need keyframes when saving jpegs. 2020-12-27 12:32:06 -05:00
Isaac Connor 0521d05295 Can only output jpegs if we are doing decoding. 2020-12-27 11:55:53 -05:00
Isaac Connor d89cbebbdf AddPacket should just take a packet. score and alarm_image are members of the packet 2020-12-22 10:18:15 -05:00
Isaac Connor aaea6c6ead Store endtime for each packet 2020-12-15 15:57:01 -05:00
Isaac Connor b261fbb397 Merge branch 'master' into zma_to_thread 2020-12-07 16:26:26 -05:00
Isaac Connor ff2981b9b3 code style. Remove unused members. Make WriteFrameImage const 2020-12-01 09:53:51 -05:00
Isaac Connor 159edbfce9 Fix video file having wrong id 2020-11-29 16:25:33 -05:00
Isaac Connor 95cbc053fc Try other storage areas if we fail to create event dir on the assigned area. 2020-11-27 13:28:38 -05:00
Isaac Connor 23f27d5a11 include frame_type in debug message 2020-11-13 12:43:31 -05:00
Isaac Connor ad4d0efba6 121 frames is too many, use >= instead 2020-11-12 17:00:32 -05:00
Isaac Connor df783f4835 Merge branch 'master' into zma_to_thread 2020-11-12 12:53:55 -05:00