Commit Graph

303 Commits

Author SHA1 Message Date
Isaac Connor 885efc27ee adjust pts/dts on flushed video packets. Improve code comments and debugging 2021-02-04 21:38:37 -05:00
Isaac Connor 2cdf017767 Fixi endlessly writing null frames to video on close when encoding audio to aac 2021-02-04 20:40:11 -05:00
Peter Keresztes Schmidt dd527f0888 Consolidate __STDC_FORMAT_MACROS and __STDC_CONSTANT_MACROS definition
Move the definitions to zm_define.h and include the header at the appropriate locations.
These macros have not been adopted by the C++11 standard.
However glibc 2.17 (CentOS 7) still depends on them to provide the macros which are guarded by these defines.
2021-02-04 19:58:29 +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
Peter Keresztes Schmidt e09fa1bebf Remove includes of <cinttypes>
Instead of including <cinttypes> directly, zm_define.h should be used
to get the typedef'ed types as well.
2021-02-02 21:37:26 +01:00
Isaac Connor 08a498ef6a Convert packetqueue from a pointer to a packetqueue to a member packetqueue that is always available. 2021-01-31 21:31:33 -05:00
Isaac Connor b812e0d484 It is necessary to prefer the image in the packet to in_frame as it has been timestamped etc 2021-01-29 15:37:51 -05:00
Isaac Connor fea2ea37e5 Cleanup unused first/start/last pts/dts 2021-01-29 14:04:50 -05:00
Isaac Connor 8199116c15 Make error message more clear 2021-01-28 10:46:08 -05:00
Isaac Connor acf909d4f3 Move setting codec parameters below the copy in case they get overwritten 2021-01-28 10:17:23 -05:00
Isaac Connor ce53552dda require audio_in_ctx as well as audio_in_stream 2021-01-27 16:14:07 -05:00
Isaac Connor 7e11d28031 Remove duplicated debug 2021-01-26 12:25:11 -05:00
Isaac Connor a209d493ef Handle null video_in_ctx. Better debug. Always flush codecs 2021-01-26 12:24:43 -05:00
Isaac Connor 835cc8076e Cleanup constructor, using initializers. Pass in CodecContexts as well. We need them for timebases. Fixes passthrough timestamps. 2021-01-25 18:50:35 -05:00
Isaac Connor 66c78e5a9b Merge branch 'zma_to_thread' into rtsp_server 2021-01-19 13:43:25 -05:00
Isaac Connor fec3dc763f Cleanups. Apply crf to encoding to fix encoding video 2021-01-15 17:02:26 -05:00
Isaac Connor 27e10c2ed9 cleanup encoding code. Update logging 2021-01-15 11:55:46 -05:00
Isaac Connor e530a51af7 WHen ret=0 is not failure, not success. Don't log error. Return the return code instead of -1 2021-01-14 10:31:55 -05:00
Isaac Connor 1ec2198d2b remove unused var temp 2021-01-11 13:46:50 -05:00
Isaac Connor 1316c6ea86 Update codec opening to properly handle passthrough 2021-01-11 13:46:50 -05:00
Isaac Connor 60fa3f9ec1 cleanup. Add h264_vaapi codec support 2021-01-11 13:46:50 -05:00
Isaac Connor 4b90eb992d remove unused var temp 2021-01-08 16:45:16 -05:00
Isaac Connor c6d15f193a Update codec opening to properly handle passthrough 2021-01-07 09:46:35 -05:00
Isaac Connor b6c11538c2 cleanup. Add h264_vaapi codec support 2020-12-31 09:15:49 -05:00
Isaac Connor 6d036629d3 clean up cruft. NULL=>nullptr. Fix some codec_context allocation. Try to solve h264_encoder_close crash. 2020-12-30 21:25:12 -05:00
Isaac Connor 284b9f963f Merge branch 'master' into zma_to_thread 2020-12-29 12:18:26 -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 fbbfb20c41 Move orientation setting down. output_stream hasn't been allocated yet so that would crash. 2020-12-15 16:54:35 -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 5fb56c9f57 Merge branch 'master' into zma_to_thread 2020-08-07 17:52:43 -04:00
Isaac Connor 05107bb2f7 Add debug of unused options 2020-07-30 15:16:31 -04:00
Isaac Connor d8cd4386cf rename GetOptEncoderParams to GetOptEncoderParams to GetOptEncoderParamsVec so that we can get at the std::string if we want to.
Use EncoderParams when setting movflags in VideoStore.

Move the content of this option to a help popup so that we can remove the comments from it. av_dict_parse doesn't handle the hash tag as a comment.
2020-07-30 15:06:05 -04: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
Pliable Pixels df4fab5fbf re-enable fragmented mp4 recordings 2020-04-23 18:11:10 -04:00
Pliable Pixels ff7defa84e re-enable fragmented mp4 recordings 2020-03-13 14:46:20 -04:00
Isaac Connor 09fcbad666 Merge branch 'master' into zma_to_thread 2019-11-30 14:59:39 -05:00
Isaac Connor 50986ce3b4 Merge branch 'zma_to_thread' of github.com:ConnorTechnology/ZoneMinder into zma_to_thread 2019-11-30 13:53:05 -05:00
Isaac Connor fdf5150a16 fix build on jessie 2019-11-13 13:51:22 -05:00
Isaac Connor 35ae81d985 dynamically allocate next_dts and use it in write_packet to store the next dts value. write_interleaved_packet destroys the passed in packet so we need to store next_dts before writing out the packet. 2019-10-23 09:25:16 -04:00
Isaac Connor 76fd32b427 more debug, and ensure that pts != AV_NOPTS_VALUE 2019-10-22 10:01:24 -04:00
Isaac Connor dfe2f55ebe More debugging to figure out #2720 2019-10-20 13:50:24 -04:00
Isaac Connor d9d91c4a8d Fix #2728 by resetting the frame size before reading from the fifo 2019-10-20 13:32:16 -04:00
Isaac Connor 21dd9b527d when ipkt->pts is AV_NOPTS_VALUE should still set opkt.pts to AV_NOPTS_VALUE 2019-10-19 17:12:19 -04:00
Isaac Connor 17a7d02275 fix reversal of in_frame/out_frame in VideoStore destructor 2019-10-18 10:16:18 -04:00
Isaac Connor f938fd83ac keep track of video_next_dts. Use it when packet dts is AV_NOPTS_VALUE. Also handle EAGAIN in send_packet_get_frame etc 2019-10-16 09:01:59 -04:00
Isaac Connor 90d6e11fb9 If we try to write a packet with dts == AV_NOPTS_VALUE, set it to stream->cur_dts. This might at least give us a playable file. 2019-10-11 14:04:51 -04:00
Isaac Connor e8e29d62b2 Use dts instead of pts for first values 2019-09-17 12:53:29 -04:00