Commit Graph

4995 Commits

Author SHA1 Message Date
Isaac Connor 8b99b15b41 Use a scope to shorten the lock on event_lock 2022-01-14 14:17:07 -05:00
Isaac Connor 9240a93ef5 Revert my idea of having ONVIF and TRIGGER code start/end events. Move code to tst for Ready() up above ONVIF and TRIGGER code. When waiting for decode, junk the idea of locking in the packetqueue. Since waiting releases the lock, we should be ok waiting and notifying in the packet. (I know there was a time when I felt this was necessary and I think it had to do with the deinterlacing case, but I've simplified that code too). 2022-01-14 14:09:18 -05:00
Isaac Connor 0e91825d5a Fix merge 2022-01-13 22:14:54 -05:00
Jonathan Bennett 212d51f933
Merge branch 'ZoneMinder:master' into janus 2022-01-13 12:16:16 -06:00
Isaac Connor 3504b13e2a Merge branch 'master' into multistream 2022-01-13 12:29:34 -05:00
Isaac Connor 44b11389ce Merge pseudo:sandbox/ZoneMinder.connortechnology into event_thread 2022-01-13 12:00:17 -05:00
Isaac Connor 13e2f5e03b remove Enabled from sql 2022-01-13 11:05:14 -05:00
Isaac Connor 3cc1b74b4e Merge branch 'master' into multistream 2022-01-13 10:21:58 -05:00
Jonathan Bennett 2beffeb1b4 Add Janus to Cycle view. Remove debug Alert() messages 2022-01-12 22:47:35 -06:00
Isaac Connor f764cfbc32 Fix deadlock on deleting event. Cannot race for the lock, joining will do the job 2022-01-12 23:11:19 -05:00
Isaac Connor 3d04228485 rework ::Analyse. The state engine will only go into alarm on actual motion, not on a skipped frame. TRIGGERS and ONVIF events will immediately create events. 2022-01-12 23:10:17 -05:00
Isaac Connor a9f7b257ea Rough in a queue and a thread into the event to process packets. We do this so that the event creator can get back to analysis as fast as possible so as to avoid the packetqueue filling up. 2022-01-12 17:16:49 -05:00
Jonathan Bennett aeefc512ab
Merge branch 'master' into janus 2022-01-12 13:04:13 -06:00
Isaac Connor c9db5f44a4 cherry pick Add check to prevent tight busy loop if ONVIF setup fails 2022-01-12 12:05:33 -05:00
Jonathan Bennett 84a73bb007 Add check to prevent tight busy loop if ONVIF setup fails 2022-01-12 09:37:48 -06:00
Jonathan Bennett 7a5a05fe94 Clean up warnings 2022-01-12 01:29:32 -06:00
Jonathan Bennett cb46b94ea1 Add error handling to libcurl calls to Janus 2022-01-12 00:19:54 -06:00
Isaac Connor c27b0aff97 Move analysis image assignment up to where motion detection is done do remove duplication and simplify logic. Free analysis images as well as captured images after analysis. remove extra copy of image to analysis_image. Replae a packetqueue.unlock with just deleting the locked packet. No one waits for analysis. Re-introduce sleeping in the analysis thread on error to prevent spinning 2022-01-11 22:11:28 -05:00
Isaac Connor ff91ac62fb add comment documenting why we sleep 2022-01-11 17:02:05 -05:00
Isaac Connor cd6c44db47 Revert "Remove sleeping from Analysis thread. It is uneccessary and results in us starting off way behind the capture thread. It also limits us to 30fps."
This reverts commit 6c4156a483.
2022-01-11 17:01:04 -05:00
Isaac Connor 04bdf0ac6b change Enable/Disable to act on capture. suspend/resume is for motion 2022-01-11 13:44:11 -05:00
Isaac Connor b42190ee3c Remove referencest to enabled. replace shared_data->active with shared_data->capturing shared_data->analysing and shared_data->recording. actionEnable/Disable act on capture. actionSuspend/Resume act on analysing. 2022-01-11 13:42:54 -05:00
Jonathan Bennett 2729e1de22
Merge branch 'ZoneMinder:master' into janus 2022-01-11 10:37:29 -06:00
Isaac Connor 1f9d3c46aa Merge branch 'master' into multistream 2022-01-11 10:48:27 -05:00
Isaac Connor 52aed5b0bf Use analysinng instead of function 2022-01-11 10:44:23 -05:00
Isaac Connor aaaf87abdb Don't try again if the error was ENOSPACE. it crashes and there is just no point. 2022-01-11 09:08:01 -05:00
Isaac Connor 90cbf5a018 Fix == instead of = 2022-01-11 09:06:43 -05:00
Jonathan Bennett 3a9c16aeea First working Janus build 2022-01-10 23:22:37 -06:00
Isaac Connor b88e699d7e Merge branch 'master' of github.com:ZoneMinder/zoneminder 2022-01-10 19:56:04 -05:00
Isaac Connor 81fc392bc2 If error is ENOSPACE just give up. ffmpeg crashes if we try again. 2022-01-10 19:56:00 -05:00
Isaac Connor cb30f7639f revert broken commit. Isaac doesn't know what he's doing. 2022-01-10 18:47:26 -05:00
Isaac Connor a0c34f0d96 Fix. cppcheck was wrong about divider being able to go into deeper scope. 2022-01-10 18:33:01 -05:00
Isaac Connor fd3a70172d Merge branch 'master' into multistream 2022-01-10 17:51:50 -05:00
Isaac Connor 3f7b9dfff7 fix cppcheck error about lo_x. Inner scope overwriting it. 2022-01-10 17:36:50 -05:00
Isaac Connor 376d7fd7e5 log error if avcodec_parameters_to_context fails. Mostly to quiet cppcheck. Remove duplicated assignment to sample_fmt. 2022-01-10 17:36:50 -05:00
Isaac Connor 78a10b6095 cppcheck fixes 2022-01-10 17:36:49 -05:00
Isaac Connor 9f86fd3b16 add default_width and height to constructor 2022-01-10 17:36:49 -05:00
Isaac Connor 4697e36f11 add explicit 2022-01-10 17:36:49 -05:00
Isaac Connor 037771539d spacing, return a success value from setupCodec instead of using Fatal 2022-01-10 17:36:49 -05:00
Isaac Connor b406bf8fd1 remove last_send_image_width/height. Not really useful or relevant 2022-01-10 17:36:49 -05:00
Isaac Connor ed7bc7c4b4 whitespace 2022-01-10 15:25:15 -05:00
Isaac Connor ec95c8da57 Rename the monitor type define from CURL to LIBCURL to fix namespace conflict 2022-01-10 15:25:15 -05:00
Isaac Connor 947132284d When transitioning from ALERT to IDLE, close the event if CLOSE_MODE is IDLE as well as ALARM. 2022-01-10 14:44:52 -05:00
Isaac Connor e9db12ca94 Fix importance got cutnpasted to where it shouldn't be 2022-01-09 14:46:48 -05:00
Isaac Connor 21762585d9 rework getting second packet for de-interlace. Pass notesetmap by reference 2022-01-09 14:43:23 -05:00
Isaac Connor 1f6874dd53 add explicit 2022-01-09 14:43:23 -05:00
Isaac Connor f0c6413dc8 solve ccpcheck complaints 2022-01-09 14:43:23 -05:00
Isaac Connor c832fabafd solve ccpcheck complaints 2022-01-09 14:43:23 -05:00
Jonathan Bennett 52b377ca86 Adds the 'closes_event" ONVIF option, to handle motionDetection message quirks. 2022-01-08 14:05:57 -06:00
Jonathan Bennett a3c298ca93 Add nullptr checks to prevent a crash when in NODECT mode 2022-01-08 13:17:04 -06:00
Isaac Connor a153798b47 fix init when no GSOAP 2022-01-08 12:37:23 -05:00
Isaac Connor dc975daa7a init soap to null in constructor. Stop analysis thread before destroying soap. 2022-01-08 12:21:29 -05:00
Isaac Connor a2a04edcf7 Only init gsoap if we are capturing 2022-01-07 16:31:45 -05:00
Isaac Connor 76fe20c69f Only send analysis_frame if doing motion detection. Add debuging. Remove other debugging 2022-01-07 15:57:28 -05:00
Isaac Connor f4c813a26f Assign image to analysis_image before doing motion detection so there is always an image to see. Fix crash. 2022-01-07 15:57:01 -05:00
Isaac Connor df0a0c7853 Add CMD_ANALYZE_ON and OFF 2022-01-07 13:50:40 -05:00
Isaac Connor 24bb43bbeb finish merge. Assign the alarm image to the shmem 2022-01-07 13:16:51 -05:00
Isaac Connor 58858d2d25 Include alarm_image in shared_mem 2022-01-07 13:12:44 -05:00
Isaac Connor 7ae9bebea4 Add analysis boolean query param 2022-01-07 12:40:21 -05:00
Isaac Connor 8863fc0e0f Add FrameType to StreamBase so we can sends analysis frames 2022-01-07 12:32:31 -05:00
Isaac Connor 16964cf327 fix zms running past end of event 2022-01-07 12:30:56 -05:00
Isaac Connor 657fc5cad5 convert function to relevant capturing/analysing 2022-01-07 11:52:19 -05:00
Isaac Connor 2ba0757fca Remove references to function, add Capturing_Strings, Analysing_Strings, Recording_Strings. 2022-01-07 11:51:43 -05:00
Isaac Connor 5840602b6e
Merge pull request #3404 from jp-bennett/master
Adds ONVIF motion Detection
2022-01-07 10:35:32 -05:00
Isaac Connor 6d3c6330df Fix freebsd build by fixing incorrect use of SystemTimePoint when we want TimePoint 2022-01-07 10:34:44 -05:00
Jonathan Bennett 1333d8c751 Adds ONVIF Motion Detection Support 2022-01-06 16:45:15 -06:00
Isaac Connor c5ae080746 further replace function with recording/analysing. One result of this is we can be in ALERT/ALARM status without recording. 2022-01-05 21:26:46 -05:00
Isaac Connor dadf53f99d Merge branch 'master' into multistream 2022-01-05 20:20:45 -05:00
Isaac Connor 738c252948 load onvif settings and provide accessors 2022-01-05 20:15:39 -05:00
Isaac Connor f7c90f5c41 Replace some function with recording == and analysis== 2022-01-05 19:53:30 -05:00
Isaac Connor 99900e8c1d Merge branch 'master' into multistream 2022-01-05 18:04:10 -05:00
Isaac Connor aefed4e174 Merge branch 'master' into multistream 2022-01-05 18:03:44 -05:00
Isaac Connor 198ee73d0e Add alarm_cause to zm_packet. Clean up code dealing with decoding not being ready 2022-01-04 17:38:25 -05:00
Isaac Connor a59e33d8b0 remove unused last_section_mod 2022-01-03 19:14:27 -05:00
Isaac Connor b1353823cf clean up signal change code a bit, using new event notesetmap update function. So now when we lose signal, the event will close but it will have signal change :Lost added to it's notes. A new event will only be created if in RECORD/MOCORD. 2022-01-03 19:04:21 -05:00
Isaac Connor 7215756fed Introduce a method update the noteSetMap after event creation (addNote). 2022-01-03 19:03:04 -05:00
Isaac Connor e2a81cc2c5 make max_score an int to get rid of the casts. Move assignment of it above the event UPDATE sql so that it is immediately accurate. 2022-01-02 19:25:52 -05:00
Isaac Connor a76128e9c4 include monitor->Importance when logging failed camera connects 2022-01-01 18:56:13 -05:00
Isaac Connor 698fe14453 set zm_terminate instead of exit() so that all the cleanup code happens 2022-01-01 17:55:18 -05:00
Isaac Connor a250567e74 add sleeping when no viewers and in ondemand mode 2022-01-01 17:54:47 -05:00
Isaac Connor 8c8a9ca32a Rework the logic around waiting for capture to be in both single jpeg mode and streaming. 2022-01-01 17:54:20 -05:00
Isaac Connor fd489c2c8d Fix. Need to use system_clock 2022-01-01 17:53:45 -05:00
Isaac Connor a66adb6dcd fix SteadyClock vs Systemclock issues 2021-12-31 18:36:23 -05:00
Isaac Connor 6bd04de5f6 Merge branch 'master' into multistream 2021-12-31 17:53:36 -05:00
Isaac Connor 5933aa8a6f Use > 0.0 instead of boolean when testing maxfps 2021-12-28 15:34:31 -05:00
Isaac Connor e81384bba4 Fix fail to build 2021-12-28 12:45:02 -05:00
Isaac Connor 0e148d809a cleanup logic and fix the zone names coming before the Motion: label 2021-12-28 12:33:23 -05:00
Isaac Connor 82a5f3a059 set zm_terminate instead of exit() so that all the cleanup code happens 2021-12-26 15:19:13 -05:00
Isaac Connor 81048b6191 Reduce code 2021-12-17 13:29:30 -05:00
Isaac Connor 77793da70e If no max_fps set we don't care how long it takes to send frame 2021-12-17 13:29:30 -05:00
Isaac Connor 1bc0e1820e fix build on older c++ 2021-12-16 17:02:20 -05:00
Isaac Connor 7101a70774 Switch to steady_clock 2021-12-16 16:35:42 -05:00
Isaac Connor 60d2186ff4 Move from SystemTimePoint to SteadyTimePoint where possible. Implement MAXFPS command. Change the logic of calculating sleep time to make more sense. Get rid of frame_mod use in favour of calculating when then next frame should get sent and just waiting till then. 2021-12-16 16:35:20 -05:00
Isaac Connor 7b7ac8fc7e Add utility functions TimePointToString and SystemTimePointToString 2021-12-16 16:30:26 -05:00
Isaac Connor d10d5201ac log max fps 2021-12-15 16:57:27 -05:00
Isaac Connor 4edd5c1bf5 Don't alter maxfps. Just report that we are too slow. Don't use ZM_RATE_BASE in sleep time calculations it amplifies the sleep seconds by 100 times. Removing allows us to view a full framerate. 2021-12-15 16:57:17 -05:00
Isaac Connor 854d11ce9d List the connkey that isn't open, differentiate logs a bit to help debug. 2021-12-15 09:11:55 -05:00
Isaac Connor 61fe35a32a Don't log errors when querying a monitor in NONE Function. Just report a 0 status.Fixes #3397 2021-12-15 09:11:55 -05:00
Isaac Connor cca7953856 include user and function error message about insufficient permissions. Will make it easier to figure out who tried what. 2021-12-14 12:26:26 -05:00
Isaac Connor b4511a8fc3 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-12-10 16:20:54 -05:00
Isaac Connor c42b75a252 must clear the monitors array before terminating log. 2021-12-10 16:20:44 -05:00
Isaac Connor 4cbc55d160 spacing 2021-12-10 16:19:41 -05:00
Isaac Connor 5a57122891 fix typpo 2021-12-10 16:17:54 -05:00
Isaac Connor 090c803b98 Wait for closeEvent thread to finish. Fixes unfinished event when zmc told to restart 2021-12-09 12:33:59 -05:00
Isaac Connor 27e87fc21f Move all the opening of events code into one function called openEvent. 2021-12-03 13:25:50 -05:00
Isaac Connor eef172379c Move all the opening of events code into one function called openEvent. 2021-12-03 13:25:50 -05:00
Isaac Connor 1cddac4efd remove remaining signal blocking cruft, add ignoring sigchld so that anything we spawn doesn't become a zombie. 2021-11-29 18:34:19 -05:00
Isaac Connor c927ef4b52 Aim to do db updates every 5 seconds instead of 1 second 2021-11-29 18:34:19 -05:00
Isaac Connor 7b9c86111c Move Cleanup and framebuffer freeing into Close() so that we don't crash on Reload 2021-11-29 16:21:34 -05:00
pkubaj 74a2276671
Fix build on FreeBSD/armv7
1. FreeBSD uses elf_aux_info instead of getauxval.
2. FreeBSD uses HWCAP_NEON macro for Neon.
2021-11-29 00:03:45 +00:00
Isaac Connor b626de50dc Add code to fork and exec EventStartCommand and EventEndCommand 2021-11-26 19:21:51 -05:00
Isaac Connor e8bb095730 include monitor dimensions when logging about zone mismatch 2021-11-24 14:28:31 -05:00
Isaac Connor e061f3b34a typo 2021-11-24 14:28:15 -05:00
Isaac Connor 77d3109152 Increase to 20 before warning about db queue size. Put lock in it's own scope so that we unlock before notifying 2021-11-24 13:44:45 -05:00
Isaac Connor 4be9c6cdd2 Code comments and make warning when the first packet in queue is locked. 2021-11-24 12:42:31 -05:00
Isaac Connor 2529765df3 timestamp image before scaling. Fixes lack of scaling when TIMESTAMP_ON_CAPTURE
is off
2021-11-19 11:59:19 -05:00
Isaac Connor 96b4af6255 Enable multi-threading on decode 2021-11-17 14:43:13 -05:00
Isaac Connor a2ae63cefe
Merge branch 'master' into fmt 2021-11-16 15:10:45 -05:00
Isaac Connor 036d47a832 proper fix to memleak 2021-11-11 14:42:08 -05:00
Isaac Connor 6d30f5431b Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-11-11 13:58:56 -05:00
Isaac Connor 883772295d spacing and log the new log level string as well as number 2021-11-11 13:51:17 -05:00
Isaac Connor 6cd1f6b5f3 Fix memleak on event creation due to not freeing storage object 2021-11-11 13:50:18 -05:00
Isaac Connor 8d85d0f640 Make state enum start at 0 as we are indexing into an array for StateStrings 2021-11-10 16:53:29 -05:00
Isaac Connor 5ac9f88d00 Use event->StartTime instead of GetVideoWriterStartTime. Add some parenthesis to make logic clearer and add more info to debug statements 2021-11-10 16:53:07 -05:00
Isaac Connor 44d88edbbb Fix some build warnings on arm 2021-11-09 17:01:13 -05:00
Isaac Connor 508be72e08 Don't exit(0) on QUIT. Instead set zm_terminate=true so that all the cleanup routines run. 2021-11-09 15:49:44 -05:00
Isaac Connor 5d23362ae0 use != Monitor instead of all the other cases 2021-11-09 13:59:14 -05:00
Isaac Connor 38105c6796 Spacing 2021-11-09 13:59:14 -05:00
Isaac Connor 7aefd657c7 Cleanup and spacing. Rework last_motion_score to be a bit more efficient and use fewer lines. Fix case where MOCORD was not ending/starting event on alarm. 2021-11-09 13:59:14 -05:00
Isaac Connor 8c2dec03b6 Default to now instead of ... epoch? when endtime is null. Fixes video playing when event is incomplete 2021-11-09 13:59:14 -05:00
Isaac Connor 364ae03195 Set zm_terminate on crash so that other threads exit instead of continuing 2021-11-03 17:04:13 -04:00
Isaac Connor 0119ff46aa Remove redundant debug 2021-11-03 17:03:54 -04:00
Isaac Connor 93055f44e8 Merge UpdateCaptureFPS and UpdateAnalysisFPS into UpdateFPS and call it from zmc after capture. 2021-11-03 17:03:29 -04:00
Isaac Connor 814eca2b4f Include the codec in the resulting mp4 filename. Remove event update setting the mp4 filename after insert, do it on event completing instead. Saves 1 db update. 2021-11-03 17:02:02 -04:00
Isaac Connor a799eb3ad9 add function get_codec to return the codec used in the output mp4 2021-11-03 17:01:11 -04:00
Isaac Connor 8619971864 Better debug messages 2021-11-02 17:24:05 -04:00
Isaac Connor 61f7989bec Actually report the # of dbQueue entries 2021-11-02 17:24:05 -04:00
Isaac Connor dd949bb129 av_write_trailer can return a positive value which is not an error 2021-11-02 17:10:02 -04:00
Isaac Connor e063f0715f reset starttime when changing events. Fixes super fast playback after switch to next event. Also, skip some unneeded calculations and logging. 2021-10-28 13:00:41 -04:00
Isaac Connor c2bd2dc129 Add a warning if db queue is larger than 10 2021-10-28 10:46:50 -04:00
Isaac Connor 3770306817 Add logic to skip capturing if Capturing()==Ondemand 2021-10-25 16:53:18 -04:00
Isaac Connor cc51642eff Add Capturing() Analysing() Recording() and fix hasViewers logic 2021-10-25 16:52:49 -04:00
Isaac Connor 1e38cf8bb7 Fix monitor type labels by adding an Unknown for entry 0. Implement Function_Strings. Fix decoding_enabled not being recalculated correctly because we havn't loaded savejpegs or videowriter yet. 2021-10-25 16:40:21 -04:00
Isaac Connor df1b42ab53 add setLastViewed for monitors that have clients 2021-10-24 17:45:22 -04:00
Isaac Connor 3d2615d66f Spacing 2021-10-24 17:43:34 -04:00
Isaac Connor 824322dff6 spacing and setLastViewed in monitor when streaming 2021-10-24 17:43:02 -04:00
Isaac Connor 6992644fc3 Add last_viewed_time and accessor functions 2021-10-24 17:42:39 -04:00
Isaac Connor 52f0240334 free and re-init opts as needed 2021-10-19 13:05:11 -04:00
Isaac Connor 6d7f752eb0 Only record when in modect or nodect. Linked monitors would cause a monitor in monitor mode to record 2021-10-19 13:04:49 -04:00
Pascal Muetschard 14e6d660e7 Respect the encoder options for the header write.
Fixes an issue where the encoder options were ignored in the
passthrough case, because the options were free'ed and not
re-initialized.
2021-10-18 20:15:02 -07:00