Commit Graph

4222 Commits

Author SHA1 Message Date
Peter Keresztes Schmidt 71edb9d830 RtpCtrlThread: Convert to std::thread 2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt ff2bfb58da RtspThread: Fix an unguarded SQL query causing race conditions 2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt 8f941c75cd RtspThread: Convert to std::thread 2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt e67626b4e2 logger: Move log_mutex to std::recursive_mutex 2021-03-03 23:31:53 +01:00
Isaac Connor 20fe6153d5 Don't treat data packets as video 2021-03-03 15:52:39 -05:00
Isaac Connor d34d2e2398 Use a define to deal with the codec/codecpar version problem 2021-03-03 15:43:59 -05:00
Isaac Connor 253ed928ec Fix using wrong stream to set codec_type 2021-03-03 15:24:11 -05:00
Isaac Connor 8a33fb6665 Include codec_type in stream and packet dumps 2021-03-03 15:23:58 -05:00
Isaac Connor eaaf04420a Keep track of stream last_pts. So we can at least try to sync streams 2021-03-03 12:45:05 -05:00
Isaac Connor 3149ba276f audio_in_stream_id is dprecated 2021-03-03 12:44:45 -05: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 a90ec5b15d Deprecate video_in_stream_index and audio_in_stream_index as they are not useful 2021-03-03 12:03:36 -05:00
Isaac Connor a01a24ec36 Add loading SecondPath in monitor 2021-03-03 09:56:33 -05:00
Isaac Connor 9310825d93 Add get_video_stream and get_audio_stream. 2021-03-03 09:56:31 -05:00
Isaac Connor e31c87193d Make Open() return 1 instead of 0 2021-03-03 09:55:57 -05:00
Isaac Connor 4cc1da8b89 Add SecondFormatContext and open it using an FFmpeg_Input 2021-03-03 09:55:57 -05:00
Isaac Connor 86541779d9 Add SecondFormatContext 2021-03-03 09:55:57 -05:00
Isaac Connor 95fe689d58 WIP, rabbit hole too deep 2021-03-03 09:55:57 -05:00
Isaac Connor 0550e69224 Fix compile on old avcodec 2021-03-03 09:55:57 -05:00
Isaac Connor dcd1804b4d add get_format_context() 2021-03-03 09:52:44 -05:00
Isaac Connor 46ec4e75d4 Check codec type instead of stream_index to determine video/audio 2021-03-03 09:52:27 -05:00
Isaac Connor cf27482ebe Change api of packetqueue. stream_index will not be incoming stream_index it will be a packetqueue specific stream_index. 2021-03-03 09:52:13 -05:00
Isaac Connor 9f5f215ef4 Check codec type instead of stream_index to determine video/audio 2021-03-03 09:51:43 -05:00
Isaac Connor 53425257cb Handle old avcodec 2021-03-02 16:20:57 -05:00
Admin 4ff016c991
Make capturing/analysing log lines follow same pattern 2021-03-02 20:51:16 +01:00
Isaac Connor be1b439dcc Add State_Strings and code cleanup. Fix not going into alarm state when already recording. Fixes #3184 2021-03-02 14:42:54 -05:00
Isaac Connor 1c40145e89 not finding space for pts is debug now and show the contents of header 2021-03-02 12:41:26 -05:00
Isaac Connor f35a1c70c0 fix build with old avcodec for xenial 2021-03-02 12:07:51 -05:00
Isaac Connor c03d9b2987 Set state before we write packets to event so that the event knows that it is alarmed 2021-03-02 11:47:55 -05:00
Isaac Connor f8b7ec8cb9 Save frames when in ALARM state so that pre-event frames get stored 2021-03-02 11:47:38 -05:00
Isaac Connor 71d65685b9 Can't clear image data early. Might be needed for snapshot and pre alarm farmes 2021-03-02 11:12:57 -05:00
Isaac Connor 3dc4bf265e Use braces 2021-03-02 10:15:21 -05:00
Isaac Connor 205ed4c510 EAGAIN happens when no one is listening. Make it a debug 2021-03-02 10:14:25 -05:00
Isaac Connor 46743ebaab Silence compile warning 2021-03-02 10:00:48 -05:00
Isaac Connor 832eabbd79 Don't both updating analysis fps unless we are doing motion detection 2021-03-02 09:59:32 -05:00
Isaac Connor d92da5f633
Merge pull request #3185 from Carbenium/jwt-cpp
dep/jwt-cpp: Update to version 0.5
2021-03-01 18:42:25 -05:00
Peter Keresztes Schmidt 37817f6ba4 dep/jwt-cpp: Update to version 0.5
Fixes some compile warnings. Unit tests pass with this version as well.
2021-03-01 23:14:56 +01:00
Isaac Connor 1bc5abb9e9 Only include video packets in analysis_image_count 2021-03-01 17:07:09 -05:00
Isaac Connor 7c71c1c543 fix rebase error 2021-03-01 17:06:53 -05:00
Isaac Connor 51c19912f8 Use analysis_image_count in opening new event log line 2021-03-01 16:56:47 -05:00
Isaac Connor 82dcd87a22 Add generic fifo_audio_source 2021-03-01 16:49:27 -05:00
Isaac Connor 8f001413f2 Handle hevc as the codec name as well as h265 2021-03-01 16:49:27 -05:00
Isaac Connor 53059aebf3 rename numChannels to getChannels and samplingFrequency to getFrequency 2021-03-01 16:49:27 -05:00
Isaac Connor b86e7eefbf fix needed line break before dimensions. Update h265 auxline processing to match h264 2021-03-01 16:49:27 -05:00
Isaac Connor d33540c962 Fix logic on clearing frame queue 2021-03-01 16:49:27 -05:00
Isaac Connor 495e2a4827 Add setting up the config string and population of mAuxLine 2021-03-01 16:49:27 -05:00
Isaac Connor b2ff9af238 Add setting of frequency and channels for audio stream 2021-03-01 16:49:27 -05:00
Isaac Connor b09fe1d17c Create fifo if it doesn't exist already 2021-03-01 16:49:27 -05:00
Isaac Connor 9302c9506e Add audio_frequency and audio_channels to shared mem and set them in PrimeCapture 2021-03-01 16:49:27 -05:00
Isaac Connor 8500c7ee94 Add audio_frequency and audio_channels to shared mem 2021-03-01 16:49:27 -05:00
Isaac Connor c5ee837b9b Add getFrequency and getChannels 2021-03-01 16:49:27 -05:00
Isaac Connor cc80ae37fb Add a generic fif_audio_source class 2021-03-01 16:49:27 -05:00
Isaac Connor b4fc782778 fifo.h got split into zm_fifo and zm_stream so update the code in zms 2021-03-01 16:49:27 -05:00
Isaac Connor 8c2e6589ac fifo.h got split into zm_fifo and zm_fifo_debug so update the code in zm_zone 2021-03-01 16:49:27 -05:00
Isaac Connor 8af7e40ea1 Use fifo version of code 2021-03-01 16:49:27 -05:00
Isaac Connor bfc12384f6 Increase debug level of auxline reporting 2021-03-01 16:49:27 -05:00
Isaac Connor 6d938817b1 Rework to use a fifo source instead of Device. We no longer pass the monitor in and only open 1 port. Add addFifo function and addSession function 2021-03-01 16:49:27 -05:00
Isaac Connor db13b4c3b6 Document possible parameters, don't add a newline to auxline 2021-03-01 16:49:27 -05:00
Isaac Connor 19d9812a3f Add a debug function to print out the start of the nal 2021-03-01 16:49:27 -05:00
Isaac Connor 53851b67c7 use a Buffer to implement the simple ZM header protocol for passing packet data from ZM to RTSP Server 2021-03-01 16:49:27 -05:00
Isaac Connor c716e8c149 Add logging of audio auxLine. Default to 8000Hz 2021-03-01 16:49:27 -05:00
Isaac Connor 7ba6e45505 Rough in rtsp_server concept. Wait for fifo's to exist before connecting. Check for monitor disconnection. WIP 2021-03-01 16:49:27 -05:00
Isaac Connor 449b547f2b Use buffer.head() instead of casting 2021-03-01 16:49:27 -05:00
Isaac Connor 05e7d76ccd Add pts which will be scaled to AV_TIME_BASE_Q 2021-03-01 16:49:27 -05:00
Isaac Connor 6e73c08a21 add fifo's for video and audio. Write the packet data to them. Update FifoStream->Fifo 2021-03-01 16:49:26 -05:00
Isaac Connor a81e3d6e19 Set zm_packet.pts scaled to AV_TIME_BASE_Q. 2021-03-01 16:47:18 -05:00
Isaac Connor c554a22374 use .head() instead of casting the buffer 2021-03-01 16:47:18 -05:00
Isaac Connor 1d73087e5b Split zm_fifo up into zm_fifo, zm_fifo_debug and zm_fifo_stream. Implement a Fifo class to keep the filehandle open. 2021-03-01 16:47:18 -05:00
Isaac Connor 3ad76f18ec code style updates 2021-03-01 16:47:18 -05:00
Isaac Connor 2d0a8549af Fix cmake to only build zm_rtsp_server if it is turned on 2021-03-01 16:47:17 -05:00
Isaac Connor cafdd02307 Remote rtsp server code. It got moved to zm_rtsp_server.cpp 2021-03-01 16:46:48 -05:00
Isaac Connor 6c6d6c51b0 Add RTSPSTreamName loading and write packet data to the video and audio fifos 2021-03-01 16:46:48 -05:00
Isaac Connor 3e9a2f2651 It is actually importatnt that smInstance get cleared. The subsequent new Logger will check for it. 2021-03-01 16:46:48 -05:00
Isaac Connor 57585e4986 Not sure why raw_fd should be static... 2021-03-01 16:46:48 -05:00
Isaac Connor 78062a03ef Add writePacket and write static function to write h264 packet stream and audio stream to a fifo for the zm_rtsp_server to read from 2021-03-01 16:46:48 -05:00
Isaac Connor d2e1c23140 Add zm_rtsp_server build target and source files 2021-03-01 16:46:48 -05:00
Isaac Connor fdf1fbd497 Add a fifo version of the rtsp server 2021-03-01 16:46:48 -05:00
Isaac Connor 430f839954 add video_fifo filename strings to shmem. 2021-03-01 16:46:48 -05:00
Isaac Connor 33dbcc449a
Merge pull request #3181 from Carbenium/rgb-const
rgb: Convert some constant defines to constexpr
2021-03-01 09:40:39 -05:00
Isaac Connor 71d864d77b
Merge pull request #3182 from Carbenium/monitor-includes
monitor: Move system includes back to their original location
2021-03-01 09:40:08 -05:00
Peter Keresztes Schmidt 3b3ecb89b2 monitor: Move system includes back to their original location
41dc0212e0 moved the system includes to work around some compilation problems.
The underlying cause has been fixed in cf9406a1e8.
Thus we can move the includes back so the follow the project-wide order.
2021-03-01 00:45:57 +01: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
Admin 741e67e8cd
ALERT also mean warming up with alarm_frame_count value before returning to ALARM.... 2021-02-28 22:42:29 +01:00
Peter Keresztes Schmidt c33b5a4393 Move in-tree dependencies to their own folder
src/ should only contain our code. Move the in-tree dependencies to dep/
This allows us (if necessary) to e.g. exclude that part of the tree from being analyzed by
various tools or mark it as external code in IDEs.
2021-02-28 02:12:07 +01:00
Peter Keresztes Schmidt 866bcc9518 build: Cleanup CMakeLists.txt of libbcrypt
Remove unnecessary cruft and make sure it uses our compile options as dictated by zm-dependency-interface.
An additional step towards a warning-free compile.

Define __SKIP_GNU on BSD since they have their own bcrypt implementation.
2021-02-28 02:12:07 +01:00
Peter Keresztes Schmidt 6b7b23970b build: Add a CMakeLists.txt for jwt-cpp
This allows us to use a cmake link target to import the library.
2021-02-27 18:18:35 +01:00
Peter Keresztes Schmidt 6a47780f60 Fix a warning reported by -Wextra
/home/peterke/DEV/zoneminder/src/zm_monitor.h: In member function ‘Monitor::TriggerState Monitor::GetTriggerState() const’:
/home/peterke/DEV/zoneminder/src/zm_monitor.h:499:76: warning: enumerated and non-enumerated type in conditional expression [-Wextra]
  499 |   TriggerState GetTriggerState() const { return (TriggerState)(trigger_data?trigger_data->trigger_state:TRIGGER_CANCEL); }
      |                                                                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-02-27 01:27:58 +01:00
Peter Keresztes Schmidt 814953b331 Fix warnings reported by -Wimplicit-fallthrough
Note: Once C++17 is supported switch to the standard conform [[fallthrough]] attribute.
For the time being [[gnu::fallthrough]] can be used since it is supported by GCC and Clang [1].

[1] https://clang.llvm.org/docs/AttributeReference.html#fallthrough
2021-02-27 00:29:35 +01:00
Peter Keresztes Schmidt 403061a39c Fix warnings reported by -Wmissing-field-initializers 2021-02-26 22:46:09 +01:00
Peter Keresztes Schmidt dffb2d2c87 Fix warnings reported by -Wignored-qualifiers 2021-02-26 19:31:32 +01:00
Isaac Connor b8fcd7c85f
Merge pull request #3172 from Carbenium/db-queue-move
db: Make sure to bind only rvalues when pushing to zmDbQueue
2021-02-25 17:19:11 -05:00
Peter Keresztes Schmidt 3dd52a92eb db: Make sure to bind only rvalues when pushing to zmDbQueue
With this we can ensure that no copy-construction of the SQL string takes place.
Regarding calling semantics: The pushed SQL string will be moved and cannot be reused.
2021-02-25 23:08:43 +01:00
Isaac Connor 3ce4b3e657 Keep capture_delay in useconds instead of msecs. Fix fps by adding back in the previous sleep_time. Fix crash due to capture_image not being asigned for local cameras 2021-02-25 16:58:54 -05:00
Isaac Connor 224fcd2cd3 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-02-25 14:58:45 -05:00
Isaac Connor 8aeb4ab758 Switch db_mutex to a std::mutex. Use modern locking with it. Use zmDbDo or dbQueue.push where appropriate. code cleanup. 2021-02-25 12:26:26 -05:00
Isaac Connor fdf515ca10 rough in a db queue thread. Use it in zm_logger so that we don't have to aquire the db lock 2021-02-24 19:59:55 -05:00
Isaac Connor 6f89eba154 add missing () 2021-02-24 13:48:59 -05:00
Isaac Connor 778a4f1d84 We cannot wait for the db lock. Do not wait. 2021-02-24 13:48:36 -05:00
Isaac Connor 9959464ef7 Fix ]\n being included in the db Logs entry. Also removes a strlen so performance should improve 2021-02-24 12:37:09 -05:00
Isaac Connor 58e3d96f8c Instead of using basename and doing a strdup etc, just use strrchr because the filepath is going to one of the sources files in zm. 2021-02-24 12:23:02 -05:00