Commit Graph

901 Commits

Author SHA1 Message Date
Isaac Connor 68b0f7e1b5 initialize packetqueue, analysis_it, storage and videostore in Monitor constructor initializer. Only delete packetqeuue if it has been created. 2021-01-15 14:42:26 -05:00
Isaac Connor 10e56df53c analysis_limit > cpature fps: only log a warning if we have actually been capturing for a while. If doing passthrough, need to start continuous event from last keyframe 2021-01-15 11:54:36 -05:00
Isaac Connor 164a0f5a44 Need to use get_packet so that packets getting written to event are locked. Because queuePacket might delete them. 2021-01-12 14:11:47 -05:00
Isaac Connor e8d06f702c Handle signal loss, improve debugging 2021-01-11 13:46:50 -05:00
Isaac Connor 46a8bb22fb get camera if we havn't already. Don't delete the timestamp in shared zmpackets because it is just a pointer to shmem. Set it to null instead so that ~ZMpacket doesn't try to free it 2021-01-11 13:46:50 -05:00
Isaac Connor 65fc5bf478 move code from Load for purpose==ANALYSIS because it will never run. Analysis is a thread now and must assume that PrimeCapture has already succeeded. 2021-01-11 13:46:50 -05:00
Isaac Connor da7a50c92d Rename H264PASSTHROUGH to just PASSTHROUGH. Start with last_signal set to true so that we don't have a signal change event on startup. Use new generic packetqueue functions 2021-01-11 13:46:50 -05:00
Isaac Connor e1f6f5984d Handle signal loss, improve debugging 2021-01-11 13:35:48 -05:00
Isaac Connor a6aefcf477 get camera if we havn't already. Don't delete the timestamp in shared zmpackets because it is just a pointer to shmem. Set it to null instead so that ~ZMpacket doesn't try to free it 2021-01-08 15:49:09 -05:00
Isaac Connor ff3bc981de move code from Load for purpose==ANALYSIS because it will never run. Analysis is a thread now and must assume that PrimeCapture has already succeeded. 2021-01-07 09:40:24 -05:00
Isaac Connor e93a895f28 Rename H264PASSTHROUGH to just PASSTHROUGH. Start with last_signal set to true so that we don't have a signal change event on startup. Use new generic packetqueue functions 2021-01-06 11:31:31 -05:00
Isaac Connor f61210c91f remove old code using image_buffer in zm_packets 2020-12-30 21:23:29 -05:00
Isaac Connor 284b9f963f Merge branch 'master' into zma_to_thread 2020-12-29 12:18:26 -05:00
Isaac Connor 197f9bdd9e indenting fix. Don't update reference image if not doing motion detection. Decouple the image buffer from the packetqueue. So always allocate a new image. Then copy decoded image to image buffer if required. 2020-12-27 12:00:18 -05:00
Isaac Connor ddf66bc9b5
Merge pull request #3100 from vertigeaux/share_frame_scores
save frame scores to SharedData for use with linked monitors
2020-12-24 11:08:25 -05:00
Isaac Connor 1ffc233593 Move some initialisation into MOnitor() initialisation. Update UpdateAnalysisFPS to use more doubles instead of integers to get better numbers. Move capture FPS updating to UpdateCaptureFPS and use doubles there too. remove some dead code and add some debugging 2020-12-23 18:50:07 -05:00
Isaac Connor fb2793d337 use nullptr instead of 0 when init'ing event 2020-12-23 09:11:33 -05:00
Isaac Connor a1917d83d0 Merge branch 'master' into zma_to_thread 2020-12-22 19:52:09 -05:00
Vertigeaux 1416cbb03c save frame scores to SharedData for use with linked monitors 2020-12-22 17:44:53 -06:00
Isaac Connor d6486d1a7e use nullptr instead of 0 when init'ing event 2020-12-22 15:44:07 -05:00
Isaac Connor 4bea286cfe Use new get_event_start_packet_it function to start the new event with the right packet. 2020-12-22 10:22:28 -05:00
Isaac Connor bc03afa166 Merge branch 'rtsp_server' into zma_to_thread 2020-12-17 10:21:51 -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 08d82fb86a use nullptr instead of 0 when init'ing event 2020-12-15 18:25:17 -05:00
Isaac Connor da18305729 Remove some dead code and debugging 2020-12-15 15:59:46 -05:00
Isaac Connor 0702b64cc4 Merge branch 'master' into zma_to_thread 2020-12-15 10:51:40 -05:00
Isaac Connor 99e7ae3505 Merge branch 'master' into rtsp_server 2020-12-15 10:14:19 -05:00
Isaac Connor 97b0ea2b73 Add missing columns to sql to load monitors. Add code to do DecodeEnabled. Handle audio packets 2020-12-12 18:52:57 -05:00
Isaac Connor f77292e6cc Move the decoding_enabled logic to constructor to save a few cycles 2020-12-10 16:23:08 -05:00
Isaac Connor 7f72d5399f add decoding_enabled and DecodingEnabled function 2020-12-10 14:05:46 -05:00
Isaac Connor 6bf5d1b5a1 Fixes to analysis_fps vs analysis_fps_limit. Fixes to logic in analysis. Make capture_fps and analysis_fps be part of shared mem. 2020-12-09 15:00:11 -05:00
Isaac Connor b261fbb397 Merge branch 'master' into zma_to_thread 2020-12-07 16:26:26 -05:00
Isaac Connor 36b5702c50 Increase LinkedMonitor debugging. Fix LinkedMonitors. Fixes #3091 2020-12-05 19:36:44 -05:00
Isaac Connor 4d33667a85 Merge branch 'release-1.34' 2020-12-05 16:51:42 -05:00
Bluemax d8993931da Improve group permissions (mode 660)
Make /dev/shm files 660.
2020-12-02 21:27:00 +01:00
Isaac Connor 03f033cf36 cleanup MOnitor destructor. Most of the freeing is done in disconnect now. Fixes zms crash 2020-11-19 16:39:14 -05:00
Isaac Connor 634a3dbe81 fix crashes/memleaks when waiting for a zmc process to start. Fix other memleaks 2020-11-19 10:43:02 -05:00
Isaac Connor 6542072334 fix logic causing segfault instead of waiting for zmc. Remove trailing whitespaces 2020-11-18 09:56:13 -05:00
Isaac Connor d2a203014f rename diagpipe-r so that we don't have to create directories in SOCKS_DIR 2020-11-13 17:05:03 -05:00
Isaac Connor 08a8155b47 Implement a Monitor::disconnect function. Fix Fatals during connect and cleanup Analysis Monitor code to wait around for zmc. Handle zmc going away gracefully. Fixes a slow zma startup due to zmc not being setup yet. 2020-11-13 12:27:51 -05:00
Isaac Connor df783f4835 Merge branch 'master' into zma_to_thread 2020-11-12 12:53:55 -05:00
Isaac Connor de74a15ab1 Move diag_fifo pipes in SOCKS_DIR instead of assigned Storage area. Storage areas could be a fs that cannot handle sockets or fifos like NFS. 2020-11-12 11:53:51 -05:00
Isaac Connor f91dcc9b60 declar rc as int 2020-11-11 20:05:47 -05:00
Isaac Connor 9636a76ccf drop db lock before reporting mysql_errors 2020-11-11 17:42:29 -05:00
Isaac Connor 27f336975c Merge branch 'master' of github.com:ZoneMinder/zoneminder 2020-11-05 18:12:43 -05:00
Isaac Connor 33f58add11 Rename StartTime, EndTime in Events to StartDateTime and EndDateTime 2020-11-04 13:49:47 -05:00
Isaac Connor 296f6af7fb Remove dirty hack that sets EndTime from monitor. It can get set in event destructor 2020-11-01 17:15:42 -05:00
Isaac Connor 2eda49333f Merge branch 'master' into zma_to_thread 2020-10-20 16:20:29 -04:00
Isaac Connor 56bbd91a02 Merge branch 'zma_to_thread' of github.com:Connortechnology/zoneminder into zma_to_thread 2020-10-20 16:05:35 -04:00
Isaac Connor 617a1faa99 Add pre-alarm frames when alarm_frame_count > 1 and prealarmcount=0 2020-10-19 13:25:26 -04:00
Isaac Connor eefbed04c1 Add debugging for min_section_length keeping us in ALERT 2020-10-19 13:24:30 -04:00
Isaac Connor df2f5f814b fix case in mocord where cause would not contain motion 2020-10-19 13:24:08 -04:00
Isaac Connor cc24df9593 init shared_data in the purpose=QUERY case to prevent crash. Also don't load zones if we don't need them 2020-10-19 13:23:40 -04:00
Isaac Connor ae506d94fa Improve log line telling why we are going into alarm 2020-10-11 10:01:11 -04:00
Isaac Connor 2f2562a876 init shared_data in the purpose=QUERY case to prevent crash. Also don't load zones if we don't need them 2020-10-08 16:46:30 -04:00
Isaac Connor 71686fc1f2 fix case in mocord where cause would not contain motion 2020-10-08 15:50:12 -04:00
Isaac Connor 419a03db25 Add debugging for min_section_length keeping us in ALERT 2020-10-05 12:11:39 -04:00
Isaac Connor 283f224a95 Add pre-alarm frames when alarm_frame_count > 1 and prealarmcount=0 2020-10-05 09:19:48 -04:00
Isaac Connor a39a656373 Merge branch 'master' into zma_to_thread 2020-09-29 11:02:40 -04:00
Isaac Connor f18cd57221 spacing more debug 2020-09-25 16:19:52 -04:00
Peter Keresztes Schmidt 8f980a1168 Convert NULL/0 to nullptr
The 0 -> nullptr changes should definitely improve readability.
2020-08-26 22:03:40 +02:00
Isaac Connor d42424d6d8 Merge branch 'release-1.34' 2020-08-11 11:41:11 -04:00
Isaac Connor afae319c94 Fix MOCORD not going into ALARM state. 2020-08-11 11:02:26 -04:00
Isaac Connor 5fb56c9f57 Merge branch 'master' into zma_to_thread 2020-08-07 17:52:43 -04:00
Isaac Connor a19990f4d7 Merge branch 'release-1.34' 2020-08-06 11:57:35 -04:00
Isaac Connor 302189a65e Don't use camera->LineSize when allocating shared images. It doesn't work because other processes don't know about it. 2020-08-06 10:11:00 -04:00
Isaac Connor d8cd4386cf rename GetOptEncoderParams to GetOptEncoderParams to GetOptEncoderParamsVec so that we can get at the std::string if we want to.
Use EncoderParams when setting movflags in VideoStore.

Move the content of this option to a help popup so that we can remove the comments from it. av_dict_parse doesn't handle the hash tag as a comment.
2020-07-30 15:06:05 -04:00
Isaac Connor 1f889bd086 def don't use linesize when allocating share images 2020-07-24 15:26:48 -04:00
Isaac Connor 0e9da28a97 Don't pass linesize to shared images. Shared images have to have a contiguous chunk of memory. 2020-07-24 12:48:38 -04:00
Isaac Connor e9681fcdcf fix use of int or unsigned long instead of int for monitor id 2020-07-23 19:31:12 -04:00
Isaac Connor e3a2099ca8 fix crash because we weren't setting alarm status 2020-07-23 16:08:35 -04:00
Isaac Connor cf07e0a089 fix crashes, current status is: local camera works and can be viewed. Amazing 2020-07-22 13:41:27 -04:00
Isaac Connor 3641797500 Merge branch 'master' into zma_to_thread 2020-07-22 13:14:40 -04:00
Isaac Connor 869860bb26 Merge branch 'master' into zma_to_thread 2020-07-21 17:49:39 -04:00
Isaac Connor 7575afc8d5 Merge branch 'master' into zma_to_thread 2020-07-21 17:38:32 -04:00
Isaac Connor f217ab54a3 When event_close_mode == CLOSE_ALARM and so we want to close the recording and start a new one, don't do it when alarm_frame_count > 1 until alarm_frames > alarm_frame_count. I believe this fixes a mem leak 2020-07-21 16:17:46 -04:00
Isaac Connor 785087022d Clear PerAlarmFrames on shutdown 2020-07-20 21:09:07 -04:00
Isaac Connor d716d1d686 Merge branch 'release-1.34' 2020-07-20 16:25:41 -04:00
Isaac Connor 5c844f9cae remove extra space 2020-07-20 10:22:40 -04:00
Isaac Connor d849ee54a4 Update state to ALARM AFTER we have opened the event, so that we get the correct event Id. Fixes #2978 Fixes #2894 2020-07-16 15:47:01 -04:00
Isaac Connor 3658c3b589 Update state to ALARM AFTER we have opened the event, so that we get the correct event Id. Fixes #2978 Fixes #2894 2020-07-16 15:36:26 -04:00
Isaac Connor e675c8373e Merge branch 'release-1.34' 2020-07-07 16:15:56 -04:00
Isaac Connor 916d1ed59e Merge branch 'release-1.34' of github.com:ZoneMinder/zoneminder into release-1.34 2020-07-07 16:15:23 -04:00
Isaac Connor af74ecac4c Pass along the image linesize to Image constructors so that Image knows about the requirement for it to be 32byte aligned. 2020-07-07 16:14:38 -04:00
Isaac Connor 209cbe1000 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2020-07-07 09:23:46 -04:00
Isaac Connor acf8a30434 Merge branch 'release-1.34' 2020-07-07 09:22:56 -04:00
Isaac Connor 533876f313 rewrite code to use fewer lines. No logic change. 2020-07-07 09:16:42 -04:00
Andrew Bauer dcab218a2e remove global config item CREATE_ANALYSIS_IMAGES 2020-07-06 12:22:41 -05:00
Isaac Connor 2db65d3821 Merge branch 'release-1.34' 2020-07-04 09:09:24 -04:00
Isaac Connor e137e1dacf Don't consult EVENT_CLOSE_MODE if mode is RECORD 2020-06-26 19:30:35 -04:00
Isaac Connor 728f41fe9c Log @debug when a linked monitor is disconnected. Use ZM_MAX_RESTART_DELAY instead of hard coded 60 seconds before next reconnect attempt 2020-06-23 16:56:35 -04:00
Isaac Connor 4d020bab56 spacing 2020-06-22 10:39:29 -04:00
Isaac Connor d92772343a Merge branch 'release-1.34' 2020-05-14 12:02:50 -04:00
Isaac Connor 16e7ca5a51 failure opening a monitor should not be fatal. 2020-05-14 12:01:24 -04:00
Isaac Connor 4ff341a0f5 Merge branch 'master' into zma_to_thread 2020-05-02 18:03:42 -04:00
Joe540 c9f04c9136 Support event_close_mode for record mode
Support event_close_mode for record mode (with linked monitor)
2020-05-01 19:10:23 -04:00
Isaac Connor e21ffbea7d Merge branch 'fix_zms' 2020-04-26 18:43:39 -04:00
Isaac Connor ae9a5766f5 Merge branch 'release-1.34' into fix_zms 2020-04-26 18:19:30 -04:00
Isaac Connor 924841ae71 Merge pull request #2913 from connortechnology/fix_monitor_loading
Fix monitor loading
2020-04-18 17:49:34 -04:00
Isaac Connor d0c36c9888
Merge pull request #2913 from connortechnology/fix_monitor_loading
Fix monitor loading
2020-04-17 10:26:03 -04:00
Isaac Connor b504110825 Correct loading monitor values from db 2020-04-16 17:54:20 -04:00
Joe540 657a353c34
Support event_close_mode for record mode
Support event_close_mode for record mode (with linked monitor)
2020-04-12 20:42:43 -04:00
hax0kartik 156728c9b6 Use preprocessors to ensure libvnc monitor is only built when libvnc is found 2020-03-26 00:08:00 -07:00
hax0kartik 1d3ad05bb5 Start implementing VNC 2020-03-25 23:21:34 -07:00
Isaac Connor d2f852b9db Merge branch 'zma_to_thread' of github.com:connortechnology/ZoneMinder into zma_to_thread 2020-02-22 18:01:00 -05:00
Isaac Connor bca4108396 Merge branch 'storageareas' into zma_to_thread 2020-02-22 17:58:30 -05:00
Isaac Connor 09fcbad666 Merge branch 'master' into zma_to_thread 2019-11-30 14:59:39 -05:00
Isaac Connor 50986ce3b4 Merge branch 'zma_to_thread' of github.com:ConnorTechnology/ZoneMinder into zma_to_thread 2019-11-30 13:53:05 -05:00
Selva Nair 2e7fad68d1 Properly compute video buffer length when analysis fps is set
Currently the number of video frames kept in the buffer is set as the
pre_event_count. This falls short when the capture fps is larger
than the analysis fps. Fix by computing the retained video duration
as pre_event_count/analysis_fps

No change if analysis fps is not set.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-11-15 21:55:40 -05:00
Isaac Connor 396be10d6f Merge branch 'master' into zma_to_thread 2019-08-22 12:57:00 -04:00
Isaac Connor 369dd03909 remove errant i 2019-08-18 21:32:19 -04:00
Isaac Connor 503cf6cd24 More backticking of SQL 2019-08-17 14:37:19 -04:00
Isaac Connor c7b6db9be7 Put backticks around all columns and tables in sql to deal with mysql 8 2019-08-14 16:18:21 -04:00
Isaac Connor c1984ad7cb Fix problem calculating mem_size using an int from ImageSize. With camera resolutions going up, width*height*colour could exceed 32bits. So use a guarnteed 53bit type, which fixes the memsize calculations. Fixes #2682 2019-08-11 20:21:37 -04:00
Isaac Connor 14ed777eeb fix segfault when debbing is turned on for zma 2019-07-31 17:17:54 -04:00
Isaac Connor 48ad8d47fc Add capture_max_fps to monitor object instead of just calculating the delay. 2019-07-31 11:23:02 -04:00
Isaac Connor d972ab6006 add min_section_length test to alarmed events that go unalarmed 2019-06-27 21:50:12 -04:00
Isaac Connor 3bd4486b65 Start event when alarm frames >= alarm_frame_count-1 because it is 1based. Add some debug. 2019-06-27 15:48:10 -04:00
Isaac Connor 434bbce954 Add loading decoder_hwaccel in Monitor 2019-06-25 15:34:17 -04:00
Isaac Connor c3135accbb Make events close on a section length time boundary only if event_close_mode == CLOSE_TIME. When an alarm happens in event_close_mode==ALARM, close the continuous event regardless of the # of pre-event frames in the event. Add some debugging 2019-06-24 21:11:52 -04:00
Isaac Connor 2d80283844 simplify some logic in Analyze and prevent segfault when we close continuous event to start alarm event 2019-06-24 13:13:46 -04:00
Isaac Connor 6ed0074077
End continuous events on alarm (#2644)
* Reference /run/zm instead of /var/run/zm because systemd-tmpfiles complains about it

* Spacing, google code style and tabs to spaces

* add update script to add MinSectionLength

* Add min_section_length to enforce a minimum event length when closing continuous events on alarm
2019-06-24 11:29:00 -04:00
Isaac Connor 0a8b7c24db don't check for alarmed zones to record stats for unless we are alarmed 2019-05-24 10:52:31 -04:00
Isaac Connor 3888d140a8 Merge branch 'master' into storageareas 2019-05-17 10:16:29 -04:00
Mitch Capper eb005e8b9c FIFO support for zoneminder zone debugging (#2594)
Adds fifo options for diagnostic images for much lower impact diagnostics mode.  Diagnostic images are only written when there is a client listening for them (otherwise they are skipped).  Also added a json stream for the detection data so you can see in real time the pixels or blobs detected for the motion.  This allows for easy real time stream of both delta and reference images (as video streams) along with the detection numbers.
2019-05-16 15:37:03 -04:00
Isaac Connor c257fb46f6 Merge branch 'storageareas' of github.com:connortechnology/zoneminder into storageareas 2019-05-13 10:34:45 -04:00
Isaac Connor aada171440 clean up some logic in Analyse 2019-05-12 09:35:48 -04:00
Isaac Connor 3a7b49560a spacing 2019-05-06 12:16:06 -04:00
Isaac Connor 9469ce8c71 Merge branch 'section_length_when_modect' into storageareas 2019-05-06 10:50:41 -04:00
Isaac Connor 9ef912f2ba add missing new event status info 2019-05-06 10:50:12 -04:00
Isaac Connor aaf4665909 Merge branch 'section_length_when_modect' into storageareas 2019-05-03 09:41:41 -04:00
Isaac Connor f6b6daafab close and reopen event when we hit section_length 2019-05-03 09:41:29 -04:00
Isaac Connor 626342f00e Merge branch 'master' into storageareas 2019-04-26 10:44:00 -04:00
Isaac Connor 8bbcf0f631 merge storageareas 2019-04-25 14:49:16 -04:00
Isaac Connor 077ad75516 Merge branch 'storageareas' into origin/zma_to_thread 2019-04-25 12:41:48 -04:00
Pliable Pixels ea7c38ceff Alarm cause fix (#2582)
* move alarm cause code to when the alarm flag is set

* formatting

* added temp info log

* char* not string in log

* merged alarm clause into info message about alarm

* add a comma only if there are more active zones

* JB tweak to slightly optimize leading comma processing
2019-04-24 13:55:57 -04:00
Isaac Connor eb76cd87bb
Revert "Alarm cause fix (#2580)" (#2581)
This reverts commit 6923382485.
2019-04-17 13:53:11 -04:00
Pliable Pixels 6923382485 Alarm cause fix (#2580)
* move alarm cause code to when the alarm flag is set

* formatting

* added temp info log

* char* not string in log
2019-04-17 13:33:38 -04:00
Isaac Connor 22adb243ec Fix crash when reporting an event longer than section length when event was just closed so event is null. 2019-04-16 11:50:41 -04:00
Isaac Connor 2ff1e7ed6d Fix crash when reporting an event longer than section length when event was just closed so event is null. 2019-04-16 11:30:18 -04:00
Isaac Connor 98a9c68b8b spacing and code documentation 2019-04-15 17:54:30 -04:00
Isaac Connor f28af7b729 store diag_path in the object and initialize them in constructor instead of constantly checking to see if they have been initialized in DetectMotion. Also use a string instead of a static char[MAX_PATH]. Also split it into diag_path_r and diag_path_d to fix the bug that only diag_path_r would ever get created and would be overwritten by the delta image. 2019-04-15 13:26:55 -04:00
Isaac Connor 93f0a03d8b spacing and code comments 2019-04-15 12:55:28 -04:00
Isaac Connor 96b7d30d7d Merge branch 'master' into zma_to_thread 2019-04-15 10:47:26 -04:00
Isaac Connor 69f812f5cc force section end when seconds % section_length == 0 which is the old behaviour. 2019-04-09 19:42:24 -04:00
Isaac Connor acb9070b04 Add a warning when an event exceeds section length 2019-03-25 12:33:30 -04:00
Isaac Connor 6c8eac1ac8 Merge branch 'storageareas' into h265 2019-03-06 11:10:01 -05:00
Isaac Connor 62d95e4d6e wip deprecate a lot of the index code. We are basically just using imag_buffer[0] for current image 2019-02-26 09:45:20 -05:00
Isaac Connor 448294f593 wip 2019-02-25 10:21:43 -05:00
Isaac Connor f2e7ec7e36 Sleep less when waiting for zmc to capture an image. Return camera in getCamera 2019-02-19 09:47:04 -05:00