Commit Graph

126 Commits

Author SHA1 Message Date
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
Mike Dussault
d38a6adec4 No behavior change. Added non-const versions of Image::Buffer and fixed a few places that were casting away the constness. 2021-10-12 21:54:49 +00:00
Isaac Connor
b0cf3a4732 Merge pull request #3314 from Carbenium/path-max
Fix Wformat for stringtf and convert path buffers depending on PATH_MAX to std::string
2021-07-07 11:34:03 -04:00
Peter Keresztes Schmidt
eaf2e51b0c utils: Make sure the compiler can emit format warnings for stringtf
Unfortunately the compilers can't emit Wformat warnings for variadic templates
and those can't be annotated with the format attribute.
Use a variadic function which can be annotated and thus warns on format string-args mismatches.

Ref 0796a2262e
2021-07-06 10:33:17 +02:00
Peter Keresztes Schmidt
80b08a2075 Convert path buffers depending on PATH_MAX to std::string 2021-07-06 10:33:17 +02:00
Peter Keresztes Schmidt
65656de6ce db: Adjust the query methods to accept std::strings 2021-07-06 10:20:46 +02:00
Peter Keresztes Schmidt
b2ee71c96e EventStream: Finalize conversion of internals to std::chrono 2021-06-13 11:30:22 +02:00
Peter Keresztes Schmidt
e1fe53338c BaseStream: Convert internals to std::chrono 2021-06-13 11:29:59 +02:00
Peter Keresztes Schmidt
a9ad5c5eee Build: Promote libavcodec to a required dependency
FFmpeg is an integral component of ZM. Promote the appropriate libraries to required dependencies.
This reduces the possible build configurations greatly and thus maintenance burden.
2021-06-05 14:25:54 +02: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