Commit Graph

183 Commits

Author SHA1 Message Date
Isaac Connor bb0741dc6f Add missing initializers 2021-04-20 12:59:19 -04:00
Peter Keresztes Schmidt 4894c319cc Image: Fix Wtype-limits warnings in zm_convert_yuyv_rgb
The intermediate values can be negative. Change the variables to be signed so the clamping later on works correctly.
2021-04-12 08:58:57 +02:00
Peter Keresztes Schmidt 11cfa86de3 Image: Fix Wtype-limits warnings in Annotate
line[c] is a char. There is no possibility for it to be larger than 0xff. Remove these checks.
2021-04-12 08:58:56 +02:00
Peter Keresztes Schmidt b5f3682d4e utils: some more reshuffling/grouping and formatting 2021-04-04 01:18:34 +02:00
Isaac Connor bcd0e84a31 do sws_scale from decoded image to Image using a member context and avframe to save a few cycles 2021-04-01 13:22:57 -04:00
Isaac Connor 1c9bc5c27f code doc and spacing 2021-04-01 11:51:18 -04: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 d9568a98c0 Drop zm_thread which has been replaced by STL implementations 2021-03-04 10:55:46 +01:00
Isaac Connor 57585e4986 Not sure why raw_fd should be static... 2021-03-01 16:46:48 -05:00
Peter Keresztes Schmidt 76e6c468e8 rgb: Convert some constant defines to constexpr
Using defines interferes with fmt.
Also rename them according to the Google styleguide.
2021-03-01 00:38:21 +01:00
Isaac Connor 224fcd2cd3 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-02-25 14:58:45 -05:00
Isaac Connor d8e37945a3 TRY OUT SWS_POINT|SWS_BITEXACT scaling 2021-02-19 13:44:37 -05:00
Isaac Connor d85e4121ef set pts of dest_frame to make debug less confusing 2021-02-19 12:44:24 -05:00
Isaac Connor 0b0df96271 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-02-18 16:05:10 -05:00
Isaac Connor 99264e4072 Fix swscale failing on resolution change. Fixes #3161 2021-02-12 11:55:25 -05:00
Isaac Connor fab7efa003 Fix PrimeCapture on local cams. We need to be able to call it for each monitor 2021-02-09 20:29:37 -05:00
Peter Keresztes Schmidt 9dc3f15eac Image: Replace qsort with std::sort
std::sort has stricter complexity requirements than qsort and can be better optimized
by the compiler due to templating.
2021-02-06 15:41:56 +01: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
Peter Keresztes Schmidt 5a57efdfe2 Replace deprecated C header includes with the C++ ones. 2021-02-04 05:39:03 +01:00
Isaac Connor f868d92269 Fix colour shift in Crop function due to not multiplying x position by colours 2021-02-02 23:19:53 -05:00
Isaac Connor 7e469a28fa remove redundant code, code style and remove some unnecessary multiplies 2021-02-02 23:19:53 -05:00
Isaac Connor b47d2428da Minor code, debugging improvements 2021-01-30 20:34:39 -05:00
Isaac Connor 7cc21b0d0b Always load AvFrame to RGBA 2021-01-26 12:22:07 -05:00
Isaac Connor 0f7c46e2cc Merge branch 'master' into zma_to_thread 2021-01-15 14:56:00 -05:00
hax0kartik 6845c2cab4 Fix padding issue in timestamp code 2021-01-15 11:46:30 +05:30
Isaac Connor f3c4bb0027 Add AVBufferRef setup when Populating AVFrame from Image. This allows hwtranfer to work because it relies on AVBuffer AVFrame. Please note that we don't want AVBuffer to free the buffer so we pass an empty function to it. 2021-01-11 13:46:50 -05:00
Isaac Connor 9fb8e51ff2 Set imagePixFormat everywhere. Add PopulateFrame which creates and AVFrame pointing to the image's buffer. Will do this with proper refcounting eventually 2021-01-11 13:46:50 -05:00
Isaac Connor ee8f940acf Add some debug 2020-12-23 18:18:16 -05:00
Isaac Connor 39212d8ca0 Remove or increase debug level 2020-12-15 15:59:22 -05:00
Isaac Connor b261fbb397 Merge branch 'master' into zma_to_thread 2020-12-07 16:26:26 -05:00
hax0kartik 8012438573 Fix font rendering issue 2020-12-04 05:22:54 +05:30
Isaac Connor b2e5df1854 Need to -1 to size parameter when calling SetFontSize 2020-12-03 18:31:41 -05:00
Isaac Connor 1bbcf4ea31 spacing and make assignments a little more readable/efficient maybe 2020-12-03 16:43:27 -05:00
Isaac Connor cfd4c17953 Include invalid font path in the error message 2020-12-03 13:35:12 -05:00
Isaac Connor 836cd2d58d Merge branch 'Font' of https://github.com/hax0kartik/zoneminder into font 2020-11-30 09:45:39 -05:00
hax0kartik d290ffc1b3 Set individual rgb components instead of memset which is wrong 2020-11-30 17:57:59 +05:30
hax0kartik 32e2563643 Free font data when destructor is called 2020-11-29 10:53:20 +05:30
hax0kartik 890a52605f Satisfy cpplint 2020-11-29 10:25:06 +05:30
hax0kartik bbeb599fce Remove bigfont 2020-11-28 20:28:34 +05:30
hax0kartik b212b0e450 Allow modifying font file location 2020-11-28 20:18:17 +05:30
hax0kartik 0a7b7b9661 Bound check values 2020-11-28 19:44:45 +05:30
hax0kartik 528699f942 Use ctzll + new font format for improving drawing speed 2020-11-28 18:46:20 +05:30
Isaac Connor 58ccea6aa8 use better c++ class initialisation. Use ZM_BUFTYPE_DONTFREE instead of 0 for init buffertype. 2020-11-19 16:37:28 -05:00
Isaac Connor 2eda49333f Merge branch 'master' into zma_to_thread 2020-10-20 16:20:29 -04:00
Isaac Connor 059d7d388f Make centerCoord take a font size parameter to fix centering when using large font. 2020-10-05 13:15:39 -04:00
Isaac Connor a39a656373 Merge branch 'master' into zma_to_thread 2020-09-29 11:02:40 -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 5fb56c9f57 Merge branch 'master' into zma_to_thread 2020-08-07 17:52:43 -04:00
Isaac Connor 2f57ccc9b9 Merge branch 'release-1.34' 2020-07-29 16:27:01 -04:00
Isaac Connor 7511b1fd7e Fix for saving jpegs 2020-07-25 14:25:45 -04:00