Commit Graph

136 Commits

Author SHA1 Message Date
Isaac Connor
cd2c977ed8 Merge branch 'master' into replace_function_concept 2022-02-16 14:25:38 -05:00
Isaac Connor
2336926d90 Rework to remove static temp_img_buffer. Is now a class member. Must be allocated as needed. Use new reworked zm_sendfile and handle if not all bytes are sent. Fixes #3437. 2022-02-16 14:16:01 -05:00
Isaac Connor
33f23cbd84 Sync up n_frames, frame_count, curr_frame_id on int instead of a mix of long int, int and unsigned long int 2022-02-15 18:52:46 -05:00
Isaac Connor
552974c5b7 Pass full packet to AddFrame so that we can also write other contents out 2022-02-12 22:14:21 -05:00
Isaac Connor
d2d9721c4e spacing, remove redundant debug 2022-01-18 23:02:26 -05:00
Isaac Connor
5f17cb6e9a Debug the size returned as compared to the file size 2022-01-15 17:19:35 -05:00
Isaac Connor
16964cf327 fix zms running past end of event 2022-01-07 12:30:56 -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
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
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
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