Commit Graph

118 Commits

Author SHA1 Message Date
Isaac Connor 0dc9017472 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:02:58 -04:00
Isaac Connor 510b3e606b Continue if frame file not found. Output useful text jpeg 2021-05-11 09:33:33 -04:00
Peter Keresztes Schmidt 68bedfe48f Fix logging format string mismatches
* Remove SZFMTD format macro and use %zu instead for size_t. %zu is understood by every compiler nowadays.
2021-04-30 00:26:24 +02: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
Peter Keresztes Schmidt 9e77324de4 Replace raw mysql_query calls with the zmDb* functions
With this we can make sure we have proper locking of our DB connection at all times.
2021-03-06 00:12:18 +01: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 6c013f0e65 Put back includes needed on FreeBSD. Fixes #3165 2021-02-22 08:03:10 -05:00
Isaac Connor 9b3d423f3d Separate duration==endtime-starttime from Frames Duration 2021-02-09 14:22:23 -05:00
Peter Keresztes Schmidt f43507dce0 Use the power of smart pointers to manage Monitor instances 2021-02-07 21:20:45 +01:00
Isaac Connor 87c3a862e2 remove our copies of min() and max(). Use std::min() and std::max() 2021-02-06 16:02:09 -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
Isaac Connor 905912a8dd Don't need to checkInitialized in event stream. We don't assign a monitor and don't need to connect to it 2021-01-27 10:07:57 -05:00
Isaac Connor 0ecbe29ac0 Handle no frame/duration information more gracefully 2021-01-26 12:20:55 -05:00
Isaac Connor f731a5dc8f Add StreamMode_Strings for printing out mode 2021-01-26 09:50:41 -05:00
Isaac Connor d6c217c1ec Rename H264PASSTHROUGH to just PASSTHROUGH 2021-01-06 11:30:42 -05:00
Isaac Connor 6da673dd69 remove unused includes 2020-11-21 09:25:36 -05:00
Isaac Connor 33f58add11 Rename StartTime, EndTime in Events to StartDateTime and EndDateTime 2020-11-04 13:49:47 -05:00
Isaac Connor 5d32e0faf0 cppcheck fixes. Make curr_frame_id signed as we may subtract from it and go < 0 2020-11-02 12:45:19 -05:00
Isaac Connor ed87ad36b3 missing break 2020-11-02 12:09:25 -05:00
Isaac Connor 871c556ac0 rename a variable to be more readable 2020-10-08 16:45:45 -04:00
Isaac Connor 4afae7b738 More accurate seeking, remove debug and duplicated code. Correct type of curr_frame_id to match frame_count. 2020-10-08 11:13:18 -04:00
Isaac Connor 9cc7f0d360 Merge branch 'release-1.34' 2020-10-08 09:28:25 -04:00
Isaac Connor 86e744777c Put back return on error 2020-10-08 09:12:37 -04:00
Isaac Connor c28ff1f2b4 Include loading EndTime when loading Events data so that we can determine if an event is in-progress
Keep track of last_id which is the last frame id that we have info for. Use it instead of Frame Count to prevent
accessing non-existent frame records
close ffmpeg_input on event change
include duration in status messages because it may change when playing an in-progress event.
when we hit the end of our frame data if it is an in-progress event, reload the event data instead of moving to the next event.
Include X-Timestamp in http headers to match live stream behaviour
Only send time to next event when mode=ALL
Fix scale behaviour on event view
2020-10-08 09:06:56 -04:00
Isaac Connor 9abde9ee06 Merge branch 'release-1.34' 2020-10-06 16:51:12 -04:00
Isaac Connor 044ce61ddb Always do event change detection whether we are paused or not. Because we might be single-stepping. Change progress to a double as that it what it should be. 2020-10-06 16:47:51 -04:00
Isaac Connor 061c889394 Implement SEEK to offset using two 32bit integers to represent the double value 2020-10-06 16:35:46 -04:00
Isaac Connor c1c407ea39 debug new offset as well when SEEKING 2020-10-05 15:55:42 -04:00
Isaac Connor c43011ba18 don't send keepalive when we have sent a textFrame 2020-10-05 13:33:57 -04:00
Isaac Connor 6c24cd0c70 When playing backwards, say time to previous event instead of next. Instead of defaulting to -2x when hitting the rewind button, start with -1x. 2020-10-05 13:14:44 -04:00
Isaac Connor c5459020c9 implement value check & correct on replay_rate for VARPLAY 2020-10-05 12:11:11 -04:00
Isaac Connor 7a7a3413d3 Always do event change detection whether we are paused or not. Because we might be single-stepping. Change progress to a double as that it what it should be. 2020-10-05 10:29:42 -04:00
Isaac Connor 07d0353373 Fix zms only sending 1 frame due to != instead of == 2020-10-03 11:57:22 -04:00
Isaac Connor 5d0c812dfb fix resource leak on error 2020-10-02 12:46:53 -04:00
Isaac Connor 4126f96b40 clean up sendFrame a bit introducing send_file and send_buffer utility functions 2020-09-07 11:19:47 -04:00
Isaac Connor f60d6ff1a3 Use BOUNDARY instead of ZoneMinderFrame 2020-09-02 16:34:56 -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
Andrew Bauer 62d687adfa dont warn or error for EPIPE errno's 2020-08-18 09:30:06 -05:00
Isaac Connor 2f57ccc9b9 Merge branch 'release-1.34' 2020-07-29 16:27:01 -04:00
Isaac Connor b1054a7db6 bail earlier if writing content-length fails. Dropped connections aren't really errors, make them Info. Fixes #2996 2020-07-29 13:39:00 -04:00
Isaac Connor 559fe15e3f fix use of int or unsigned long instead of int for monitor id 2020-07-23 19:32:25 -04:00
Isaac Connor 662b9894bd Don't delete send_image because it is static. Fixes #2923 2020-05-23 16:12:55 -04:00
Isaac Connor 24aaeee155 dynamically load monitor Object when loading event data. Also dynamically load Storage, but only when the Id is different. Free the various objects in the destructor. Sync up some spacing issues with master. 2020-05-01 18:44:35 -04:00
Isaac Connor 2071b2a71e Guess video file name for in progress events 2020-05-01 18:14:58 -04:00
Isaac Connor ffd7970b07 Merge branch 'release-1.34' 2020-05-01 13:17:10 -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 3b11258fbc Make checkEventLoaded return true if a new event was loaded, false otherwise. The idea is to give more information back to whoever calls it 2020-04-26 15:22:29 -04:00
Isaac Connor 5bf068791b Merge branch 'rate_dropdown' into release-1.34 2020-04-23 16:11:59 -04:00
Isaac Connor 79ad2ec87d better debug logging for SLOWFWD and SLOWREV listing new frame_id 2020-03-26 15:08:32 -04:00