Commit Graph

221 Commits

Author SHA1 Message Date
Isaac Connor
643fe97b25 Deprecate zm_av_frame_alloc 2025-09-18 14:48:52 -04:00
Aaron Kling
c4683d90a9 Format code using astyle google format
Commands used:
astyle --style=google --indent=spaces=2 --keep-one-line-blocks src/*.cpp
astyle --style=google --indent=spaces=2 --keep-one-line-blocks src/*.h
2024-03-26 13:43:58 -05:00
Doug Nazar
f4dd897ef4 Convert AVFrame* to custom unique_ptr (av_frame_ptr).
Switch all owning AVFrame* variables to av_frame_ptr for
automatic cleanup.

Use AVBufferRef to store frame data in AVFrame where appropriate
so that it can be freed automatically with it's AVFrame.

Handle allocation errors.
2022-07-30 13:21:11 -04:00
Doug Nazar
110cc436a3 Switch from av_init_packet() to av_packet_alloc()
Remove all uses of deprecated av_init_packet() and switch any stack
based AVPackets to unique_ptrs allocated with av_packet_alloc().

Ensure that all code paths call av_packet_unref() after use to reset
before next usage.
2022-07-29 14:56:26 -04:00
Isaac Connor
29cea83a4a Log the device that the error is happening for 2022-04-18 18:05:13 -04:00
Isaac Connor
ba26235763 further deprecate v4l2 tests and spacing 2021-10-05 19:49:42 -04:00
Isaac Connor
75a014321e Spacing, remove tests for v4l2, move control setting/getting code to a single function. 2021-10-05 19:49:42 -04:00
Peter Keresztes Schmidt
6e96cbe14a Misc: Merge ZM_HAS_V4L with ZM_HAS_V4L2 2021-09-08 00:19:08 +02:00
Peter Keresztes Schmidt
0ac060fb78 LocalCamera: Fix Wformat warnings on FreeBSD 2021-09-08 00:19:08 +02:00
Peter Keresztes Schmidt
443b84270a LocalCamera: Add a missing include to fix FreeBSD build
Fixes #3330
2021-09-08 00:19:08 +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
2d71743372 FFmpeg: Remove code paths required only by 2.8 and older
With Xenial support dropped we require FFmpeg 3.2 and newer.
2021-06-05 20:40:12 +02:00
Peter Keresztes Schmidt
762476ec76 Build: Promote libswscale 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:27:31 +02:00
Peter Keresztes Schmidt
81a1546a2b LocalCamera: Remove unnecessary ZM_HAS_V4L2 conditionals
V4L2 is the only V4L version we support. No need to conditionally compile those parts.
2021-06-01 00:05:05 +02:00
Peter Keresztes Schmidt
f2bee0704a LocalCamera: Remove support for V4L1
Kernel support for Video4Linux 1 was removed in 2.6.38 (March 2011). It's time to drop support on our side.
2021-05-31 23:29:29 +02:00
Isaac Connor
09b0353592 Actually close the camera in localcamera::Close 2021-05-28 13:54:20 -04:00
Peter Keresztes Schmidt
730a057e18 LocalCamera: Fix some format warnings reported by clang
`capturePixFormat` and `imagePixFormat` are no enum entries. Do no try to log them as FourCC.

(cherry picked from commit 77068163a3)
2021-05-19 19:38:34 +02:00
Isaac Connor
2cf6ad8089 Switch ZMPacket * to a shared_ptr<ZMPacket>. This is so that in LockedPacket we can unlock and then notify and be confident that packet_ won't have been deleted. Change ZMPacket->timestamp to be a timeval instead of timeval *. This might not have been necessary but I like it. No longer cuse the ZMPacket object to wrap the shared image buffers and timestamps. Use a vector for image_buffers. 2021-05-08 21:14:20 -04:00
Peter Keresztes Schmidt
e5613d0d27 Make sure all logging macro calls are terminated with a semicolon 2021-05-02 23:08:48 +02: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
Isaac Connor
1abadfafa1 Increase debug log level of allocating image 2021-04-28 16:13:57 -04:00
Isaac Connor
813730f8b5 remove dead code 2021-04-20 12:59:41 -04:00
Peter Keresztes Schmidt
627f972fac LocalCamera: Fix Wformat warnings reported by Clang 2021-04-11 18:00:12 +02:00
Isaac Connor
6d5cbe2583 Make incorrect dimensions non-fatal if the monitor dimensions are larger than what is expected, so at least there is enough ram to store the image 2021-03-22 11:02:32 -04:00
Isaac Connor
b87d859f72 Set the packet's stream_index to the packetqueue stream. Rename get_ functions to get 2021-03-03 12:06:34 -05:00
Isaac Connor
224fcd2cd3 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-02-25 14:58:45 -05:00
Isaac Connor
099ca9251c Only init camera if capturing 2021-02-24 10:33:29 -05:00
Isaac Isaac
3225851224 Move call to Initialise into Constructor making sure that it only gets called once. Move channel switching out of PostCapture into just after capturing image in order to free up more time for image to stabilise while we do other things like timestamping etc which happen in Capture. 2021-02-23 13:11:34 -05:00
Isaac Connor
0b0df96271 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-02-18 16:05:10 -05:00
Isaac Connor
cf6d2caef7 Make setting fmt non fatal. 2021-02-17 16:34:19 -05:00
Isaac Connor
f061c25183 Make failure to set video standard non-fatal. 2021-02-17 11:02:56 -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
Isaac Isaac
032420beb2 Don't need to init mVideoStream etc as they are done in Camera(). Set stream_index in packet. 2021-02-09 13:16:19 -05:00
Peter Keresztes Schmidt
f43507dce0 Use the power of smart pointers to manage Monitor instances 2021-02-07 21:20:45 +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
Isaac Connor
ab65a65dfb use camel case on video_stream and audio_stream 2021-01-28 10:45:53 -05:00
Isaac Connor
4c933f82b8 All cameras will have an mFormatConext, CodecContext etc. Consolidate code in zm_camera. Fix remote rtsp decoding 2021-01-27 16:12:32 -05:00
Isaac Connor
6df865cd08 spacing 2021-01-27 12:49:37 -05:00
Isaac Connor
66c78e5a9b Merge branch 'zma_to_thread' into rtsp_server 2021-01-19 13:43:25 -05:00
Isaac Connor
824cbb7879 spacing and NULL=>nullptr 2021-01-11 13:46:50 -05:00
Isaac Connor
705959d1ec Set codec_type in zm_packet 2021-01-11 13:46:50 -05:00
Isaac Connor
7afaf00202 spacing and NULL=>nullptr 2021-01-07 09:36:54 -05:00
Isaac Connor
08a28e6960 Set codec_type in zm_packet 2021-01-06 11:30:03 -05:00
Isaac Connor
63687c8e44 code style 2020-12-27 11:57:50 -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
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
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