Commit Graph

341 Commits

Author SHA1 Message Date
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
Isaac Connor f855f207e2 Limit that # of db frames to buffer to 120 because the sql will exceed 8192. 2020-11-11 14:03:08 -05:00
Isaac Connor d663683f47 Add a bunch of debug statements to figure out crash 2020-11-11 12:43:41 -05:00
Isaac Connor 33f58add11 Rename StartTime, EndTime in Events to StartDateTime and EndDateTime 2020-11-04 13:49:47 -05:00
Isaac Connor 09fe354a22 If event db insert fails, try again until it succeeds. 2020-11-04 11:59:08 -05:00
Isaac Connor b8bd4b6961 Add fallback for now to endtime. Set endtime in AddFramesInternal as well just in case there was never another frame. 2020-11-02 16:34:00 -05:00
Isaac Connor 4e80c04d23 fix lack of const to match def 2020-11-01 18:48:13 -05:00
Isaac Connor f79602d638 cppcheck improvements. Use %u instead of %d where appropriate. Move sql def to block where it is used 2020-11-01 17:14:04 -05:00
Isaac Connor 1257a7ea37 improvements reported by cppcheck 2020-11-01 16:11:19 -05:00