Commit Graph

58 Commits

Author SHA1 Message Date
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
acbdf1854d Add guard to handle resetting AVPacket after use.
Also handle allocation failures.
2022-07-29 14:56:38 -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
9334001247 Convert frame->pts to stream pts. Add a seek if jumping a long way into the mp4 2022-07-13 18:47:27 -04:00
Isaac Connor
c832fabafd solve ccpcheck complaints 2022-01-09 14:43:23 -05:00
Peter Keresztes Schmidt
707975e567 Monitor: Convert API to std::chrono 2021-06-13 23:22:49 +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
Isaac Connor
e8b761d2bf cppcheck cleanups 2021-04-20 11:04:27 -04:00
Isaac Connor
dab89622af Not having a video stream isn't actually bad. Change log to debug 2021-04-11 13:29:24 -04:00
Isaac Connor
e31c87193d Make Open() return 1 instead of 0 2021-03-03 09:55:57 -05:00
Peter Keresztes Schmidt
938676b129 ffmpeg: exit dumpPacket early if debug logging is not enabled 2021-02-07 11:58:17 +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
d594fbcd49 Some fixes for unused code (will be used in future) 2021-01-26 18:29:34 -05:00
Isaac Connor
e226618300 better debug of video/audio frames 2021-01-26 12:21:51 -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
2eda49333f Merge branch 'master' into zma_to_thread 2020-10-20 16:20:29 -04:00
Isaac Connor
268e364cfd handle the paused case 2020-10-09 10:21:00 -04:00
Isaac Connor
1aadeb2206 free the context as well. 2020-10-08 16:46:03 -04:00
Isaac Connor
a39a656373 Merge branch 'master' into zma_to_thread 2020-09-29 11:02:40 -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
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
7575afc8d5 Merge branch 'master' into zma_to_thread 2020-07-21 17:38:32 -04:00
Isaac Connor
4ff341a0f5 Merge branch 'master' into zma_to_thread 2020-05-02 18:03:42 -04:00
Isaac Connor
434f34f027 use delete[] instead of delete. 2020-04-30 11:04:55 -04:00
Isaac Connor
ae9a5766f5 Merge branch 'release-1.34' into fix_zms 2020-04-26 18:19:30 -04:00
Isaac Connor
1c197db619 Merge branch 'master' into rate_dropdown 2020-01-07 14:49:58 -05:00
Isaac Connor
16a73d6d5a don't seek back when not neccesary 2019-12-13 18:12:33 -05:00
Isaac Connor
5fcd6361bc fix segfault reading frames for .mp4 in zms 2019-12-13 17:47:18 -05:00
Isaac Connor
3b9b49c44d wip work on fixing zms mp4 to mjpeg 2019-12-02 15:51:03 -05:00
Isaac Connor
09fcbad666 Merge branch 'master' into zma_to_thread 2019-11-30 14:59:39 -05:00
Isaac Connor
701aa8d924 add flushing the resample buffer to get the remaining samples encoded 2019-09-13 10:55:30 -04:00
Isaac Connor
396be10d6f Merge branch 'master' into zma_to_thread 2019-08-22 12:57:00 -04:00
Isaac Connor
05be9008c7 use FFMPEGInit to initialise ffmpeg instead of doing it ourselves 2019-07-11 17:57:11 -04:00
Isaac Connor
d0abd16494 add passing hwaccel name and device. use av_make_error_string(ret).c_str() to reduce code and increase consistency 2019-06-25 15:34:01 -04:00
Isaac Connor
2cbcaeebbc clean out old hwdecode stuff. refactor common code out 2019-06-25 14:11:59 -04:00
Isaac Connor
077ad75516 Merge branch 'storageareas' into origin/zma_to_thread 2019-04-25 12:41:48 -04:00
Isaac Connor
a30c4d9551 rework ffmpeg_input to not use pkt_duration which doesn't exist in avconv 2019-03-21 10:41:59 -04:00
Isaac Connor
9b713a489d fix sleep time by using a comparison between the frame display time and the distance between now and when we started playing.
handle infinite fps
2019-03-06 14:50:36 -05:00
Isaac Connor
b16cd7ec84 Merge branch 'h265' into zma_to_thread 2018-11-20 12:38:17 -05:00
Isaac Connor
b291c06035 Working zms h265 playing. 2018-11-19 16:45:56 -05:00
Isaac Connor
0ec391354c Merge branch 'fix_zms_from_mp4' into h265 2018-09-13 16:18:28 -04:00
Isaac Connor
0efc45fa93 implement a getFrame function that takes a timestamp and will seek to the appropriate time in the mp4 before getting a frame 2018-09-11 13:21:12 -04:00
Isaac Connor
c7deb91319 Merge branch 'zma_to_thread' of github.com:ConnorTechnology/ZoneMinder into zma_to_thread 2018-04-14 14:58:25 -04:00
Isaac Connor
cd3046abb3 Merge branch 'storageareas' into zma_to_thread 2018-04-14 11:03:08 -04:00
Isaac Connor
646f0dd65e fix merge 2018-03-03 13:31:55 -08:00
Isaac Connor
03d3f5e665 Merge branch 'storageareas' into zma_to_thread 2018-03-03 13:28:01 -08:00
Isaac Connor
d980def64f spacing, increase debug 2018-03-02 18:26:07 -08:00
Isaac Connor
43b71fc49b rework 2017-11-20 15:32:40 -05:00
Isaac Connor
74650ebc70 simplify Analysis 2017-11-20 11:48:56 -05:00
Isaac Connor
64816aa005 fixes from cppcheck. 2017-11-18 16:00:10 -05:00