From 5a57efdfe21946efa3113b837bb05a2276fd96f1 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Wed, 3 Feb 2021 23:56:42 +0100 Subject: [PATCH 1/6] Replace deprecated C header includes with the C++ ones. --- src/zm_analysis_thread.h | 3 +-- src/zm_box.h | 9 ++------- src/zm_buffer.h | 11 +++++------ src/zm_comms.cpp | 13 +++---------- src/zm_comms.h | 3 --- src/zm_config.cpp | 5 +---- src/zm_crypt.cpp | 1 - src/zm_crypt.h | 6 ++---- src/zm_db.cpp | 3 +-- src/zm_event.cpp | 2 -- src/zm_event.h | 9 ++++----- src/zm_fifo.cpp | 6 +++--- src/zm_file_camera.cpp | 9 ++------- src/zm_font.cpp | 4 ++-- src/zm_group.cpp | 4 ++-- src/zm_image.cpp | 2 +- src/zm_image.h | 2 +- src/zm_logger.cpp | 14 +++++++------- src/zm_mem_utils.h | 2 +- src/zm_mpeg.cpp | 4 ++-- src/zm_poly.cpp | 4 ---- src/zm_poly.h | 2 +- src/zm_regexp.cpp | 2 +- src/zm_remote_camera_http.cpp | 2 +- src/zm_remote_camera_nvsocket.cpp | 2 +- src/zm_rtp_ctrl.cpp | 2 +- src/zm_rtsp_auth.cpp | 5 ++--- src/zm_rtsp_server_frame.h | 4 ++-- src/zm_rtsp_server_thread.h | 2 +- src/zm_sdp.h | 2 +- src/zm_signal.cpp | 6 +++--- src/zm_signal.h | 2 +- src/zm_storage.cpp | 6 +++--- src/zm_thread.cpp | 8 ++++---- src/zm_user.cpp | 8 ++++---- src/zm_utils.cpp | 6 +++--- src/zm_utils.h | 2 +- src/zm_videostore.cpp | 3 --- src/zmc.cpp | 2 +- src/zms.cpp | 2 -- 40 files changed, 71 insertions(+), 113 deletions(-) diff --git a/src/zm_analysis_thread.h b/src/zm_analysis_thread.h index b3ad74862..cde0f70df 100644 --- a/src/zm_analysis_thread.h +++ b/src/zm_analysis_thread.h @@ -2,9 +2,8 @@ #define ZM_ANALYSIS_THREAD_H #include "zm_thread.h" -#include - #include "zm_monitor.h" +#include class AnalysisThread : public Thread { private: diff --git a/src/zm_box.h b/src/zm_box.h index ca3e6fd39..44869fb05 100644 --- a/src/zm_box.h +++ b/src/zm_box.h @@ -22,12 +22,7 @@ #include "zm.h" #include "zm_coord.h" - -#ifndef SOLARIS -#include -#else #include -#endif // // Class used for storing a box, which is defined as a region @@ -61,8 +56,8 @@ public: inline int Area() const { return size.X()*size.Y(); } inline const Coord Centre() const { - int mid_x = int(round(lo.X()+(size.X()/2.0))); - int mid_y = int(round(lo.Y()+(size.Y()/2.0))); + int mid_x = int(std::round(lo.X()+(size.X()/2.0))); + int mid_y = int(std::round(lo.Y()+(size.Y()/2.0))); return Coord( mid_x, mid_y ); } inline bool Inside( const Coord &coord ) const diff --git a/src/zm_buffer.h b/src/zm_buffer.h index 8930cefbc..04a78b1c0 100644 --- a/src/zm_buffer.h +++ b/src/zm_buffer.h @@ -21,8 +21,7 @@ #define ZM_BUFFER_H #include "zm.h" - -#include +#include class Buffer { @@ -42,12 +41,12 @@ public: } Buffer(const unsigned char *pStorage, unsigned int pSize) : mAllocation(pSize), mSize(pSize) { mHead = mStorage = new unsigned char[mSize]; - memcpy(mStorage, pStorage, mSize); + std::memcpy(mStorage, pStorage, mSize); mTail = mHead + mSize; } Buffer(const Buffer &buffer) : mAllocation(buffer.mSize), mSize(buffer.mSize) { mHead = mStorage = new unsigned char[mSize]; - memcpy(mStorage, buffer.mHead, mSize); + std::memcpy(mStorage, buffer.mHead, mSize); mTail = mHead + mSize; } ~Buffer() { @@ -116,7 +115,7 @@ public: // Add bytes to the end of the buffer unsigned int append(const unsigned char *pStorage, unsigned int pSize) { expand(pSize); - memcpy(mTail, pStorage, pSize); + std::memcpy(mTail, pStorage, pSize); mTail += pSize; mSize += pSize; return mSize; @@ -133,7 +132,7 @@ public: mHead = mTail = mStorage; else if ( level ) { if ( ((uintptr_t)mHead-(uintptr_t)mStorage) > mSize ) { - memcpy( mStorage, mHead, mSize ); + std::memcpy( mStorage, mHead, mSize ); mHead = mStorage; mTail = mHead + mSize; } diff --git a/src/zm_comms.cpp b/src/zm_comms.cpp index ccf84ba91..6a55f1559 100644 --- a/src/zm_comms.cpp +++ b/src/zm_comms.cpp @@ -20,22 +20,15 @@ #include "zm_comms.h" #include "zm_logger.h" -#include +#include #include -#include +#include #include - -#if defined(BSD) -#include -#else -#include -#endif - #include #include #include #include // for debug output -#include // for snprintf +#include // for snprintf #ifdef SOLARIS #include // define FIONREAD diff --git a/src/zm_comms.h b/src/zm_comms.h index a5af97dd5..b9bf617fd 100644 --- a/src/zm_comms.h +++ b/src/zm_comms.h @@ -23,12 +23,9 @@ #include "zm_logger.h" #include "zm_exception.h" -#include #include #include -#include #include - #include #include #include diff --git a/src/zm_config.cpp b/src/zm_config.cpp index 4f5b11c9b..dc6d0f9c8 100644 --- a/src/zm_config.cpp +++ b/src/zm_config.cpp @@ -20,10 +20,7 @@ #include "zm.h" #include "zm_db.h" -#include -#include -#include -#include +#include #include #include diff --git a/src/zm_crypt.cpp b/src/zm_crypt.cpp index 8e42b3b3c..7c5398490 100644 --- a/src/zm_crypt.cpp +++ b/src/zm_crypt.cpp @@ -13,7 +13,6 @@ #include #include #endif -#include // returns username if valid, "" if not #if HAVE_LIBJWT diff --git a/src/zm_crypt.h b/src/zm_crypt.h index 340abc36c..15dbc9332 100644 --- a/src/zm_crypt.h +++ b/src/zm_crypt.h @@ -20,10 +20,8 @@ #ifndef ZM_CRYPT_H #define ZM_CRYPT_H - -#include - - +#include +#include bool verifyPassword( const char *username, const char *input_password, const char *db_password_hash); diff --git a/src/zm_db.cpp b/src/zm_db.cpp index fce6d9123..a55d8b4a4 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -17,8 +17,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include -#include +#include #include "zm.h" #include "zm_db.h" diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 248cffdaa..0b02deaeb 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -22,8 +22,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/src/zm_event.h b/src/zm_event.h index ea88aadc8..b480ba164 100644 --- a/src/zm_event.h +++ b/src/zm_event.h @@ -20,12 +20,11 @@ #ifndef ZM_EVENT_H #define ZM_EVENT_H -#include -#include +#include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/src/zm_fifo.cpp b/src/zm_fifo.cpp index d743611b8..711ffe703 100644 --- a/src/zm_fifo.cpp +++ b/src/zm_fifo.cpp @@ -19,9 +19,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "zm.h" #include "zm_time.h" diff --git a/src/zm_file_camera.cpp b/src/zm_file_camera.cpp index 8ba71bcd1..d040c1402 100644 --- a/src/zm_file_camera.cpp +++ b/src/zm_file_camera.cpp @@ -17,14 +17,9 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include -#include -#include #include -#include -#include -#include -#include +#include +#include #include #include "zm.h" diff --git a/src/zm_font.cpp b/src/zm_font.cpp index 3c1cc9aef..cfae49062 100644 --- a/src/zm_font.cpp +++ b/src/zm_font.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include "zm.h" diff --git a/src/zm_group.cpp b/src/zm_group.cpp index 070d3b571..4334fcff8 100644 --- a/src/zm_group.cpp +++ b/src/zm_group.cpp @@ -22,8 +22,8 @@ #include "zm_group.h" -#include -#include +#include +#include Group::Group() { Warning("Instantiating default Group Object. Should not happen."); diff --git a/src/zm_image.cpp b/src/zm_image.cpp index 09e50daeb..b460a9a49 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include static unsigned char y_table_global[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 154, 156, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 170, 171, 172, 173, 174, 175, 176, 178, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 196, 197, 199, 200, 201, 202, 203, 204, 206, 207, 208, 209, 210, 211, 213, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 225, 227, 228, 229, 230, 231, 232, 234, 235, 236, 237, 238, 239, 241, 242, 243, 244, 245, 246, 248, 249, 250, 251, 252, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; diff --git a/src/zm_image.h b/src/zm_image.h index 4d77f99bc..db61114df 100644 --- a/src/zm_image.h +++ b/src/zm_image.h @@ -34,7 +34,7 @@ extern "C" { class Image; #include "zm_ffmpeg.h" -#include +#include #if HAVE_ZLIB_H #include diff --git a/src/zm_logger.cpp b/src/zm_logger.cpp index 1d9bb7ba6..e641dfcef 100644 --- a/src/zm_logger.cpp +++ b/src/zm_logger.cpp @@ -24,14 +24,14 @@ #include "zm_db.h" #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include -#include +#include +#include +#include #include #ifdef __FreeBSD__ #include diff --git a/src/zm_mem_utils.h b/src/zm_mem_utils.h index a9e1ab097..548146a8e 100644 --- a/src/zm_mem_utils.h +++ b/src/zm_mem_utils.h @@ -20,7 +20,7 @@ #ifndef ZM_MEM_UTILS_H #define ZM_MEM_UTILS_H -#include +#include #include "zm.h" inline void* zm_mallocaligned(unsigned int reqalignment, size_t reqsize) { diff --git a/src/zm_mpeg.cpp b/src/zm_mpeg.cpp index 225cdaa5e..72a968b70 100644 --- a/src/zm_mpeg.cpp +++ b/src/zm_mpeg.cpp @@ -17,8 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include -#include +#include +#include #include "zm.h" #include "zm_rgb.h" diff --git a/src/zm_poly.cpp b/src/zm_poly.cpp index 35319d6af..1c197a04e 100644 --- a/src/zm_poly.cpp +++ b/src/zm_poly.cpp @@ -20,11 +20,7 @@ #include "zm.h" #include "zm_poly.h" -#ifndef SOLARIS -#include -#else #include -#endif void Polygon::calcArea() { double float_area = 0.0L; diff --git a/src/zm_poly.h b/src/zm_poly.h index 7c5ee4a07..48193d6c9 100644 --- a/src/zm_poly.h +++ b/src/zm_poly.h @@ -24,7 +24,7 @@ #include "zm_coord.h" #include "zm_box.h" -#include +#include // // Class used for storing a box, which is defined as a region diff --git a/src/zm_regexp.cpp b/src/zm_regexp.cpp index fa3bc2de7..45c78a4d8 100644 --- a/src/zm_regexp.cpp +++ b/src/zm_regexp.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include +#include #include "zm.h" #include "zm_regexp.h" diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index 8484d79a3..e68fe9262 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #ifdef SOLARIS diff --git a/src/zm_remote_camera_nvsocket.cpp b/src/zm_remote_camera_nvsocket.cpp index 0fe213753..fd4bbdea3 100644 --- a/src/zm_remote_camera_nvsocket.cpp +++ b/src/zm_remote_camera_nvsocket.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #ifdef SOLARIS diff --git a/src/zm_rtp_ctrl.cpp b/src/zm_rtp_ctrl.cpp index 2ffc0c404..651df5f7c 100644 --- a/src/zm_rtp_ctrl.cpp +++ b/src/zm_rtp_ctrl.cpp @@ -26,7 +26,7 @@ #include "zm_time.h" #include "zm_rtsp.h" -#include +#include RtpCtrlThread::RtpCtrlThread( RtspThread &rtspThread, RtpSource &rtpSource ) : mRtspThread( rtspThread ), mRtpSource( rtpSource ), mStop( false ) diff --git a/src/zm_rtsp_auth.cpp b/src/zm_rtsp_auth.cpp index 5cd05063c..14f4aa3bf 100644 --- a/src/zm_rtsp_auth.cpp +++ b/src/zm_rtsp_auth.cpp @@ -20,9 +20,8 @@ #include "zm_utils.h" #include "zm_rtsp_auth.h" -#include -#include -#include +#include +#include namespace zm { diff --git a/src/zm_rtsp_server_frame.h b/src/zm_rtsp_server_frame.h index 1a6396711..7df7c4b8b 100644 --- a/src/zm_rtsp_server_frame.h +++ b/src/zm_rtsp_server_frame.h @@ -4,8 +4,8 @@ #if HAVE_RTSP_SERVER -#include -#include +#include +#include // --------------------------------- // Captured frame // --------------------------------- diff --git a/src/zm_rtsp_server_thread.h b/src/zm_rtsp_server_thread.h index 43942ac82..405c5dd29 100644 --- a/src/zm_rtsp_server_thread.h +++ b/src/zm_rtsp_server_thread.h @@ -5,7 +5,7 @@ #define ZM_RTSP_SERVER_THREAD_H #include "zm_thread.h" -#include +#include #include "zm_monitor.h" diff --git a/src/zm_sdp.h b/src/zm_sdp.h index 403c8a740..e17ea7fd1 100644 --- a/src/zm_sdp.h +++ b/src/zm_sdp.h @@ -26,7 +26,7 @@ #include "zm_exception.h" #include "zm_ffmpeg.h" -#include +#include #include #include diff --git a/src/zm_signal.cpp b/src/zm_signal.cpp index 2756802a3..6d31619f0 100644 --- a/src/zm_signal.cpp +++ b/src/zm_signal.cpp @@ -20,9 +20,9 @@ #include "zm.h" #include "zm_signal.h" -#include -#include -#include +#include +#include +#include #define TRACE_SIZE 16 diff --git a/src/zm_signal.h b/src/zm_signal.h index 89a4b408a..cf345fdb9 100644 --- a/src/zm_signal.h +++ b/src/zm_signal.h @@ -20,7 +20,7 @@ #ifndef ZM_SIGNAL_H #define ZM_SIGNAL_H -#include +#include #if HAVE_EXECINFO_H #include diff --git a/src/zm_storage.cpp b/src/zm_storage.cpp index 9eae26b85..0ea2f950a 100644 --- a/src/zm_storage.cpp +++ b/src/zm_storage.cpp @@ -22,9 +22,9 @@ #include "zm_storage.h" -#include -#include -#include +#include +#include +#include Storage::Storage() : id(0) { Warning("Instantiating default Storage Object. Should not happen."); diff --git a/src/zm_thread.cpp b/src/zm_thread.cpp index ec97b3578..23682b53f 100644 --- a/src/zm_thread.cpp +++ b/src/zm_thread.cpp @@ -22,10 +22,10 @@ #include "zm_logger.h" #include "zm_utils.h" -#include -#include -#include -#include +#include +#include +#include +#include struct timespec getTimeout( int secs ) { struct timespec timeout; diff --git a/src/zm_user.cpp b/src/zm_user.cpp index 4636d6b42..5b0654e28 100644 --- a/src/zm_user.cpp +++ b/src/zm_user.cpp @@ -22,10 +22,10 @@ #include "zm_user.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #if HAVE_GNUTLS_GNUTLS_H diff --git a/src/zm_utils.cpp b/src/zm_utils.cpp index 253e6a297..6ab97da14 100644 --- a/src/zm_utils.cpp +++ b/src/zm_utils.cpp @@ -21,10 +21,10 @@ #include "zm.h" #include "zm_utils.h" -#include +#include #include -#include -#include +#include +#include #include /* Definition of AT_* constants */ #include #if defined(__arm__) diff --git a/src/zm_utils.h b/src/zm_utils.h index 9c8cc01a0..f3aabaca1 100644 --- a/src/zm_utils.h +++ b/src/zm_utils.h @@ -20,7 +20,7 @@ #ifndef ZM_UTILS_H #define ZM_UTILS_H -#include +#include #include #include #include diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index fc49ed60a..979a2e4dc 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -24,9 +24,6 @@ #include "zm.h" #include "zm_videostore.h" -#include -#include - extern "C" { #include "libavutil/time.h" } diff --git a/src/zmc.cpp b/src/zmc.cpp index f963e514c..c09c8d325 100644 --- a/src/zmc.cpp +++ b/src/zmc.cpp @@ -54,7 +54,7 @@ possible, this should run at more or less constant speed. */ #include -#include +#include #if defined(__FreeBSD__) #include #else diff --git a/src/zms.cpp b/src/zms.cpp index 652b87350..87b63552e 100644 --- a/src/zms.cpp +++ b/src/zms.cpp @@ -17,8 +17,6 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include -#include #include #include "zm.h" From 0dbc39ee254603f489be90af8b64d79235641523 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Thu, 4 Feb 2021 04:47:28 +0100 Subject: [PATCH 2/6] 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 --- src/zm.h | 10 +++--- src/zm_analysis_thread.cpp | 2 ++ src/zm_analysis_thread.h | 2 +- src/zm_box.cpp | 3 +- src/zm_box.h | 1 - src/zm_buffer.cpp | 1 - src/zm_buffer.h | 2 +- src/zm_camera.cpp | 3 +- src/zm_camera.h | 11 +++--- src/zm_comms.cpp | 12 +++---- src/zm_comms.h | 8 ++--- src/zm_config.cpp | 11 +++--- src/zm_config.h | 11 +++--- src/zm_coord.cpp | 1 - src/zm_coord.h | 2 +- src/zm_crypt.cpp | 7 ++-- src/zm_curl_camera.cpp | 6 ++-- src/zm_curl_camera.h | 13 +++---- src/zm_db.cpp | 7 ++-- src/zm_db.h | 2 +- src/zm_event.cpp | 22 +++++------- src/zm_event.h | 33 +++++------------ src/zm_eventstream.cpp | 16 ++++----- src/zm_eventstream.h | 3 -- src/zm_ffmpeg.cpp | 4 ++- src/zm_ffmpeg_camera.cpp | 7 ++-- src/zm_ffmpeg_camera.h | 4 --- src/zm_ffmpeg_input.cpp | 4 +-- src/zm_fifo.cpp | 13 +++---- src/zm_fifo.h | 17 ++------- src/zm_file_camera.cpp | 9 ++--- src/zm_file_camera.h | 5 --- src/zm_font.cpp | 7 ++-- src/zm_font.h | 1 - src/zm_frame.h | 11 +++--- src/zm_group.cpp | 7 ++-- src/zm_group.h | 4 +-- src/zm_image.cpp | 12 +++---- src/zm_image.h | 21 +++++------ src/zm_jpeg.cpp | 3 +- src/zm_jpeg.h | 7 ++-- src/zm_libvlc_camera.cpp | 10 +++--- src/zm_libvlc_camera.h | 1 - src/zm_libvnc_camera.cpp | 7 ++-- src/zm_libvnc_camera.h | 2 -- src/zm_local_camera.cpp | 15 +++----- src/zm_local_camera.h | 5 --- src/zm_logger.cpp | 16 +++------ src/zm_logger.h | 5 ++- src/zm_mem_utils.h | 1 - src/zm_monitor.cpp | 35 ++++++++++--------- src/zm_monitor.h | 28 ++++----------- src/zm_monitorstream.cpp | 11 +++--- src/zm_monitorstream.h | 7 ++-- src/zm_mpeg.cpp | 9 +++-- src/zm_packet.cpp | 5 +-- src/zm_packet.h | 7 ++-- src/zm_packetqueue.cpp | 3 +- src/zm_packetqueue.h | 12 +++---- src/zm_poly.cpp | 1 - src/zm_poly.h | 4 +-- src/zm_regexp.cpp | 8 ++--- src/zm_regexp.h | 4 +-- src/zm_remote_camera.cpp | 2 ++ src/zm_remote_camera.h | 5 --- src/zm_remote_camera_http.cpp | 10 +++--- src/zm_remote_camera_http.h | 5 +-- src/zm_remote_camera_nvsocket.cpp | 8 ++--- src/zm_remote_camera_nvsocket.h | 5 +-- src/zm_remote_camera_rtsp.cpp | 12 +++---- src/zm_remote_camera_rtsp.h | 9 ++--- src/zm_rgb.h | 4 ++- src/zm_rtp.h | 2 -- src/zm_rtp_ctrl.cpp | 11 +++--- src/zm_rtp_ctrl.h | 2 -- src/zm_rtp_data.cpp | 8 ++--- src/zm_rtp_data.h | 1 - src/zm_rtp_source.cpp | 2 +- src/zm_rtp_source.h | 4 +-- src/zm_rtsp.cpp | 10 ++---- src/zm_rtsp.h | 6 +--- src/zm_rtsp_auth.cpp | 7 ++-- src/zm_rtsp_auth.h | 3 ++ src/zm_rtsp_server_adts_source.cpp | 10 +++--- src/zm_rtsp_server_adts_source.h | 7 ++-- src/zm_rtsp_server_device_source.cpp | 8 +++-- src/zm_rtsp_server_device_source.h | 16 ++++----- src/zm_rtsp_server_frame.h | 7 ++-- src/zm_rtsp_server_h264_device_source.cpp | 13 +++---- src/zm_rtsp_server_h264_device_source.h | 2 -- ...zm_rtsp_server_server_media_subsession.cpp | 10 +++--- src/zm_rtsp_server_server_media_subsession.h | 10 ++---- src/zm_rtsp_server_thread.cpp | 11 +++--- src/zm_rtsp_server_thread.h | 12 +++---- ...server_unicast_server_media_subsession.cpp | 6 ++-- ...p_server_unicast_server_media_subsession.h | 1 + src/zm_sdp.cpp | 7 ++-- src/zm_sdp.h | 8 +---- src/zm_signal.cpp | 5 ++- src/zm_signal.h | 4 +-- src/zm_storage.cpp | 9 ++--- src/zm_storage.h | 7 ++-- src/zm_stream.cpp | 16 ++++----- src/zm_stream.h | 8 ++--- src/zm_swscale.cpp | 9 +++-- src/zm_swscale.h | 4 ++- src/zm_thread.cpp | 4 +-- src/zm_thread.h | 11 +++--- src/zm_time.h | 3 +- src/zm_timer.h | 7 ++-- src/zm_user.cpp | 13 ++----- src/zm_user.h | 4 +-- src/zm_utils.cpp | 9 +++-- src/zm_utils.h | 1 - src/zm_video.cpp | 8 ++--- src/zm_video.h | 5 +-- src/zm_videostore.cpp | 6 ++-- src/zm_videostore.h | 11 +++--- src/zm_zone.cpp | 7 ++-- src/zm_zone.h | 8 +++-- src/zmc.cpp | 19 +++++----- src/zms.cpp | 4 +-- src/zmu.cpp | 3 +- 123 files changed, 376 insertions(+), 574 deletions(-) diff --git a/src/zm.h b/src/zm.h index f22bc5b2e..521a37d4c 100644 --- a/src/zm.h +++ b/src/zm.h @@ -21,17 +21,17 @@ #ifndef ZM_H #define ZM_H -#include "zm_define.h" - #include "zm_config.h" +#include "zm_define.h" +#include "zm_logger.h" #include "zm_signal.h" + +#include + #ifdef SOLARIS #undef DEFAULT_TYPE // pthread defines this which breaks StreamType DEFAULT_TYPE #include // define strerror() and friends #endif -#include "zm_logger.h" - -#include extern const char *self; diff --git a/src/zm_analysis_thread.cpp b/src/zm_analysis_thread.cpp index 675be2986..7e94313b2 100644 --- a/src/zm_analysis_thread.cpp +++ b/src/zm_analysis_thread.cpp @@ -1,5 +1,7 @@ #include "zm_analysis_thread.h" +#include "zm_signal.h" + AnalysisThread::AnalysisThread(Monitor *p_monitor) { monitor = p_monitor; terminate = false; diff --git a/src/zm_analysis_thread.h b/src/zm_analysis_thread.h index cde0f70df..085e9bd3a 100644 --- a/src/zm_analysis_thread.h +++ b/src/zm_analysis_thread.h @@ -1,8 +1,8 @@ #ifndef ZM_ANALYSIS_THREAD_H #define ZM_ANALYSIS_THREAD_H -#include "zm_thread.h" #include "zm_monitor.h" +#include "zm_thread.h" #include class AnalysisThread : public Thread { diff --git a/src/zm_box.cpp b/src/zm_box.cpp index 4a69fbf6d..6129b7a29 100644 --- a/src/zm_box.cpp +++ b/src/zm_box.cpp @@ -15,9 +15,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// +// -#include "zm.h" #include "zm_box.h" // This section deliberately left blank diff --git a/src/zm_box.h b/src/zm_box.h index 44869fb05..d7b5fc853 100644 --- a/src/zm_box.h +++ b/src/zm_box.h @@ -20,7 +20,6 @@ #ifndef ZM_BOX_H #define ZM_BOX_H -#include "zm.h" #include "zm_coord.h" #include diff --git a/src/zm_buffer.cpp b/src/zm_buffer.cpp index 76d11d969..e5d0d21c9 100644 --- a/src/zm_buffer.cpp +++ b/src/zm_buffer.cpp @@ -17,7 +17,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "zm.h" #include "zm_buffer.h" unsigned int Buffer::assign(const unsigned char *pStorage, unsigned int pSize) { diff --git a/src/zm_buffer.h b/src/zm_buffer.h index 04a78b1c0..1f9a0183a 100644 --- a/src/zm_buffer.h +++ b/src/zm_buffer.h @@ -20,7 +20,7 @@ #ifndef ZM_BUFFER_H #define ZM_BUFFER_H -#include "zm.h" +#include "zm_logger.h" #include class Buffer diff --git a/src/zm_camera.cpp b/src/zm_camera.cpp index d75a03d27..8a919a083 100644 --- a/src/zm_camera.cpp +++ b/src/zm_camera.cpp @@ -17,9 +17,10 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" #include "zm_camera.h" +#include "zm_monitor.h" + Camera::Camera( unsigned int p_monitor_id, SourceType p_type, diff --git a/src/zm_camera.h b/src/zm_camera.h index 31f40d914..718ce3a48 100644 --- a/src/zm_camera.h +++ b/src/zm_camera.h @@ -20,15 +20,12 @@ #ifndef ZM_CAMERA_H #define ZM_CAMERA_H -#include -#include - #include "zm_image.h" -#include "zm_packet.h" +#include +#include -class Camera; - -#include "zm_monitor.h" +class Monitor; +class ZMPacket; // // Abstract base class for cameras. This is intended just to express diff --git a/src/zm_comms.cpp b/src/zm_comms.cpp index 6a55f1559..3d4157284 100644 --- a/src/zm_comms.cpp +++ b/src/zm_comms.cpp @@ -18,17 +18,17 @@ // #include "zm_comms.h" -#include "zm_logger.h" +#include "zm_logger.h" +#include // for debug output #include -#include #include -#include +#include // for snprintf +#include +#include #include #include -#include -#include // for debug output -#include // for snprintf +#include #ifdef SOLARIS #include // define FIONREAD diff --git a/src/zm_comms.h b/src/zm_comms.h index b9bf617fd..9b8abfe6d 100644 --- a/src/zm_comms.h +++ b/src/zm_comms.h @@ -20,15 +20,13 @@ #ifndef ZM_COMMS_H #define ZM_COMMS_H -#include "zm_logger.h" #include "zm_exception.h" - -#include +#include "zm_logger.h" #include -#include #include -#include #include +#include +#include #if defined(BSD) #include diff --git a/src/zm_config.cpp b/src/zm_config.cpp index dc6d0f9c8..a1ebedaab 100644 --- a/src/zm_config.cpp +++ b/src/zm_config.cpp @@ -15,18 +15,17 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// +// + +#include "zm_config.h" -#include "zm.h" #include "zm_db.h" - +#include "zm_logger.h" +#include "zm_utils.h" #include #include #include -#include "zm_utils.h" -#include "zm_config.h" - // Note that Error and Debug calls won't actually go anywhere unless you // set the relevant ENV vars because the logger gets it's setting from the // config. diff --git a/src/zm_config.h b/src/zm_config.h index 687ac430c..43d38f6f8 100644 --- a/src/zm_config.h +++ b/src/zm_config.h @@ -20,16 +20,15 @@ #ifndef ZM_CONFIG_H #define ZM_CONFIG_H +#include "config.h" +#include "zm_config_data.h" +#include "zm_config_defines.h" +#include + #if !defined(PATH_MAX) #define PATH_MAX 1024 #endif -#include "config.h" -#include "zm_config_defines.h" -#include "zm_config_data.h" - -#include - #ifdef HAVE_LIBAVFORMAT #define ZM_HAS_FFMPEG 1 #endif // HAVE_LIBAVFORMAT diff --git a/src/zm_coord.cpp b/src/zm_coord.cpp index df9bc0a87..0b7ab0e71 100644 --- a/src/zm_coord.cpp +++ b/src/zm_coord.cpp @@ -17,7 +17,6 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" #include "zm_coord.h" // This section deliberately left blank diff --git a/src/zm_coord.h b/src/zm_coord.h index d5167d46b..b7e8fd046 100644 --- a/src/zm_coord.h +++ b/src/zm_coord.h @@ -20,7 +20,7 @@ #ifndef ZM_COORD_H #define ZM_COORD_H -#include "zm.h" +#include "zm_define.h" // // Class used for storing an x,y pair, i.e. a coordinate diff --git a/src/zm_crypt.cpp b/src/zm_crypt.cpp index 7c5398490..a550007a6 100644 --- a/src/zm_crypt.cpp +++ b/src/zm_crypt.cpp @@ -1,12 +1,15 @@ -#include "zm.h" #include "zm_crypt.h" + +#include "zm_logger.h" #include "BCrypt.hpp" +#include + #if HAVE_LIBJWT #include #else #include "jwt_cpp.h" #endif -#include + #if HAVE_LIBCRYPTO #include #elif HAVE_GNUTLS_GNUTLS_H diff --git a/src/zm_curl_camera.cpp b/src/zm_curl_camera.cpp index cedce9850..48df87da0 100644 --- a/src/zm_curl_camera.cpp +++ b/src/zm_curl_camera.cpp @@ -17,12 +17,10 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include -#include "zm.h" - #include "zm_curl_camera.h" -#include "zm_packetqueue.h" +#include "zm_packet.h" +#include #if HAVE_LIBCURL diff --git a/src/zm_curl_camera.h b/src/zm_curl_camera.h index 5c1b84fcc..04fe71e32 100644 --- a/src/zm_curl_camera.h +++ b/src/zm_curl_camera.h @@ -20,16 +20,13 @@ #ifndef ZM_CURL_CAMERA_H #define ZM_CURL_CAMERA_H -#if HAVE_LIBCURL - -#include "zm_camera.h" -#include "zm_ffmpeg.h" +#include "zm_config.h" #include "zm_buffer.h" -#include "zm_regexp.h" -#include "zm_utils.h" -#include "zm_signal.h" -#include +#include "zm_camera.h" #include +#include + +#if HAVE_LIBCURL #if HAVE_CURL_CURL_H #include diff --git a/src/zm_db.cpp b/src/zm_db.cpp index a55d8b4a4..dc09c2892 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -16,12 +16,11 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // - -#include - -#include "zm.h" #include "zm_db.h" +#include "zm_logger.h" +#include + MYSQL dbconn; RecursiveMutex db_mutex; diff --git a/src/zm_db.h b/src/zm_db.h index 8c641b0c2..b51ffd5b3 100644 --- a/src/zm_db.h +++ b/src/zm_db.h @@ -20,8 +20,8 @@ #ifndef ZM_DB_H #define ZM_DB_H -#include #include "zm_thread.h" +#include class zmDbRow { private: diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 0b02deaeb..e4c576f0c 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -17,21 +17,17 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include -#include -#include -#include -#include -#include -#include -#include - -#include "zm.h" -#include "zm_db.h" -#include "zm_time.h" -#include "zm_signal.h" #include "zm_event.h" + +#include "zm_camera.h" +#include "zm_db.h" +#include "zm_frame.h" +#include "zm_logger.h" #include "zm_monitor.h" +#include "zm_signal.h" +#include "zm_videostore.h" +#include +#include //#define USE_PREPARED_SQL 1 diff --git a/src/zm_event.h b/src/zm_event.h index b480ba164..c7e660941 100644 --- a/src/zm_event.h +++ b/src/zm_event.h @@ -20,38 +20,23 @@ #ifndef ZM_EVENT_H #define ZM_EVENT_H -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#include "zm_storage.h" #include #include -#include +#include -#include "zm.h" -#include "zm_image.h" -#include "zm_stream.h" -#include "zm_packet.h" -#include "zm_storage.h" - -class VideoStore; -class Zone; -class Monitor; class EventStream; +class Frame; +class Image; +class Monitor; +class VideoStore; +class ZMPacket; +class Zone; // Maximum number of prealarm frames that can be stored #define MAX_PRE_ALARM_FRAMES 16 -typedef uint64_t event_id_t; -typedef enum { NORMAL=0, BULK, ALARM } FrameType; -#include "zm_frame.h" +typedef uint64_t event_id_t; // // Class describing events, i.e. captured periods of activity. diff --git a/src/zm_eventstream.cpp b/src/zm_eventstream.cpp index 25f1c0e7f..fe49bb557 100644 --- a/src/zm_eventstream.cpp +++ b/src/zm_eventstream.cpp @@ -17,18 +17,16 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // // -#include - -#include "zm.h" -#include "zm_db.h" -#include "zm_time.h" -#include "zm_mpeg.h" -#include "zm_event.h" #include "zm_eventstream.h" -#include "zm_storage.h" -#include "zm_monitor.h" +#include "zm_db.h" +#include "zm_image.h" +#include "zm_logger.h" #include "zm_sendfile.h" +#include "zm_signal.h" +#include "zm_storage.h" +#include +#include const std::string EventStream::StreamMode_Strings[4] = { "None", diff --git a/src/zm_eventstream.h b/src/zm_eventstream.h index c109b0120..3dcbe7761 100644 --- a/src/zm_eventstream.h +++ b/src/zm_eventstream.h @@ -20,9 +20,7 @@ #ifndef ZM_EVENTSTREAM_H #define ZM_EVENTSTREAM_H -#include "zm_image.h" #include "zm_stream.h" -#include "zm_video.h" #include "zm_ffmpeg_input.h" #include "zm_monitor.h" #include "zm_storage.h" @@ -37,7 +35,6 @@ extern "C" { } #endif - class EventStream : public StreamBase { public: typedef enum { MODE_NONE, MODE_SINGLE, MODE_ALL, MODE_ALL_GAPLESS } StreamMode; diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index a3cf383ca..bd47a7fc3 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -18,8 +18,10 @@ */ #include "zm_ffmpeg.h" -#include "zm_image.h" + +#include "zm_logger.h" #include "zm_rgb.h" + extern "C" { #include "libavutil/pixdesc.h" } diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index abd180819..4b2f6f6a6 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -17,14 +17,14 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" +#include "zm_ffmpeg_camera.h" + +#include "zm_packet.h" #include "zm_signal.h" #include "zm_utils.h" #if HAVE_LIBAVFORMAT -#include "zm_ffmpeg_camera.h" - extern "C" { #include "libavutil/time.h" #if HAVE_LIBAVUTIL_HWCONTEXT_H @@ -35,7 +35,6 @@ extern "C" { } #include -#include #if HAVE_LIBAVUTIL_HWCONTEXT_H #if LIBAVCODEC_VERSION_CHECK(57, 89, 0, 89, 0) diff --git a/src/zm_ffmpeg_camera.h b/src/zm_ffmpeg_camera.h index 80fd6f260..de5fa4735 100644 --- a/src/zm_ffmpeg_camera.h +++ b/src/zm_ffmpeg_camera.h @@ -22,10 +22,6 @@ #include "zm_camera.h" -#include "zm_buffer.h" -#include "zm_ffmpeg.h" -#include "zm_videostore.h" - #if HAVE_LIBAVUTIL_HWCONTEXT_H typedef struct DecodeContext { AVBufferRef *hw_device_ref; diff --git a/src/zm_ffmpeg_input.cpp b/src/zm_ffmpeg_input.cpp index d4ad3a0bc..ed2f703dc 100644 --- a/src/zm_ffmpeg_input.cpp +++ b/src/zm_ffmpeg_input.cpp @@ -1,7 +1,7 @@ - #include "zm_ffmpeg_input.h" -#include "zm_logger.h" + #include "zm_ffmpeg.h" +#include "zm_logger.h" FFmpeg_Input::FFmpeg_Input() { input_format_context = nullptr; diff --git a/src/zm_fifo.cpp b/src/zm_fifo.cpp index 711ffe703..c89739096 100644 --- a/src/zm_fifo.cpp +++ b/src/zm_fifo.cpp @@ -17,17 +17,14 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // +#include "zm_fifo.h" + +#include "zm_monitor.h" +#include "zm_signal.h" #include #include -#include -#include -#include +#include -#include "zm.h" -#include "zm_time.h" -#include "zm_signal.h" -#include "zm_monitor.h" -#include "zm_fifo.h" #define RAW_BUFFER 512 static bool zm_fifodbg_inited = false; FILE *zm_fifodbg_log_fd = nullptr; diff --git a/src/zm_fifo.h b/src/zm_fifo.h index abd666891..42c313051 100644 --- a/src/zm_fifo.h +++ b/src/zm_fifo.h @@ -19,23 +19,10 @@ #ifndef ZM_FIFO_H #define ZM_FIFO_H -#if 0 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "zm.h" -#include "zm_image.h" -#endif -#include "zm_monitor.h" #include "zm_stream.h" +class Monitor; + #define zmFifoDbgPrintf(level, params...) {\ zmFifoDbgOutput(0, __FILE__, __LINE__, level, ##params);\ } diff --git a/src/zm_file_camera.cpp b/src/zm_file_camera.cpp index d040c1402..5ddaba998 100644 --- a/src/zm_file_camera.cpp +++ b/src/zm_file_camera.cpp @@ -17,14 +17,11 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include -#include -#include -#include - -#include "zm.h" #include "zm_file_camera.h" +#include "zm_packet.h" +#include + FileCamera::FileCamera( int p_id, const char *p_path, diff --git a/src/zm_file_camera.h b/src/zm_file_camera.h index ad3d46f7b..0d815d842 100644 --- a/src/zm_file_camera.h +++ b/src/zm_file_camera.h @@ -21,11 +21,6 @@ #define ZM_FILE_CAMERA_H #include "zm_camera.h" -#include "zm_buffer.h" -#include "zm_regexp.h" -#include "zm_packet.h" - -#include // // Class representing 'file' cameras, i.e. those which are diff --git a/src/zm_font.cpp b/src/zm_font.cpp index cfae49062..1b13e8fef 100644 --- a/src/zm_font.cpp +++ b/src/zm_font.cpp @@ -1,11 +1,8 @@ -#include +#include "zm_font.h" + #include #include -#include "zm.h" -#include "zm_font.h" -#include "zm_utils.h" - int ZmFont::ReadFontFile(const std::string &loc) { FILE *f = fopen(loc.c_str(), "rb"); if ( !f ) return -1; // FILE NOT FOUND diff --git a/src/zm_font.h b/src/zm_font.h index 2790ea4e1..22ecb4612 100644 --- a/src/zm_font.h +++ b/src/zm_font.h @@ -2,7 +2,6 @@ #define ZM_FONT_H #include "zm_define.h" - #include #define NUM_FONT_SIZES 4 diff --git a/src/zm_frame.h b/src/zm_frame.h index 84190e779..6bb02f192 100644 --- a/src/zm_frame.h +++ b/src/zm_frame.h @@ -20,12 +20,15 @@ #ifndef ZM_FRAME_H #define ZM_FRAME_H -#include -#include -class Frame; - #include "zm_event.h" #include "zm_time.h" +#include + +enum FrameType { + NORMAL = 0, + BULK, + ALARM +}; // // This describes a frame record diff --git a/src/zm_group.cpp b/src/zm_group.cpp index 4334fcff8..6b5110d76 100644 --- a/src/zm_group.cpp +++ b/src/zm_group.cpp @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "zm.h" -#include "zm_db.h" +*/ #include "zm_group.h" +#include "zm_logger.h" #include -#include Group::Group() { Warning("Instantiating default Group Object. Should not happen."); diff --git a/src/zm_group.h b/src/zm_group.h index 6adb8cd93..4d1cf5d6e 100644 --- a/src/zm_group.h +++ b/src/zm_group.h @@ -17,11 +17,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "zm_db.h" - #ifndef ZM_GROUP_H #define ZM_GROUP_H +#include "zm_db.h" + class Group { protected: diff --git a/src/zm_image.cpp b/src/zm_image.cpp index b460a9a49..7173887cd 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -16,16 +16,14 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" -#include "zm_font.h" -#include "zm_image.h" -#include "zm_utils.h" -#include "zm_rgb.h" -#include "zm_ffmpeg.h" +#include "zm_image.h" + +#include "zm_font.h" +#include "zm_poly.h" +#include "zm_utils.h" #include #include -#include static unsigned char y_table_global[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 154, 156, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 170, 171, 172, 173, 174, 175, 176, 178, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 196, 197, 199, 200, 201, 202, 203, 204, 206, 207, 208, 209, 210, 211, 213, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 225, 227, 228, 229, 230, 231, 232, 234, 235, 236, 237, 238, 239, 241, 242, 243, 244, 245, 246, 248, 249, 250, 251, 252, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; diff --git a/src/zm_image.h b/src/zm_image.h index db61114df..ebe96f030 100644 --- a/src/zm_image.h +++ b/src/zm_image.h @@ -20,26 +20,21 @@ #ifndef ZM_IMAGE_H #define ZM_IMAGE_H -#include "zm.h" -extern "C" { -#include "zm_jpeg.h" -} -#include "zm_rgb.h" #include "zm_coord.h" -#include "zm_box.h" -#include "zm_poly.h" -#include "zm_mem_utils.h" -#include "zm_utils.h" - -class Image; #include "zm_ffmpeg.h" - -#include +#include "zm_jpeg.h" +#include "zm_logger.h" +#include "zm_mem_utils.h" +#include "zm_rgb.h" #if HAVE_ZLIB_H #include #endif // HAVE_ZLIB_H +class Box; +class Image; +class Polygon; + #define ZM_BUFTYPE_DONTFREE 0 #define ZM_BUFTYPE_MALLOC 1 #define ZM_BUFTYPE_NEW 2 diff --git a/src/zm_jpeg.cpp b/src/zm_jpeg.cpp index 8fab8cb5b..c3fddec1f 100644 --- a/src/zm_jpeg.cpp +++ b/src/zm_jpeg.cpp @@ -18,9 +18,8 @@ */ #include "zm_jpeg.h" -#include "zm_logger.h" -#include +#include "zm_logger.h" /* Overridden error handlers, mostly for decompression */ extern "C" { diff --git a/src/zm_jpeg.h b/src/zm_jpeg.h index f0b4a355c..acf47f809 100644 --- a/src/zm_jpeg.h +++ b/src/zm_jpeg.h @@ -15,13 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include +*/ +#include "jerror.h" #include "jinclude.h" #include "jpeglib.h" -#include "jerror.h" +#include // Stop complaints about deuplicate definitions #undef HAVE_STDLIB_H diff --git a/src/zm_libvlc_camera.cpp b/src/zm_libvlc_camera.cpp index 0edd206cd..22369cb6e 100644 --- a/src/zm_libvlc_camera.cpp +++ b/src/zm_libvlc_camera.cpp @@ -15,13 +15,15 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ +*/ -#include -#include "zm.h" -#include "zm_signal.h" #include "zm_libvlc_camera.h" +#include "zm_packet.h" +#include "zm_signal.h" +#include "zm_utils.h" +#include + #if HAVE_LIBVLC static void *libvlc_lib = nullptr; static void (*libvlc_media_player_release_f)(libvlc_media_player_t* ) = nullptr; diff --git a/src/zm_libvlc_camera.h b/src/zm_libvlc_camera.h index cebd47781..6ffc023aa 100644 --- a/src/zm_libvlc_camera.h +++ b/src/zm_libvlc_camera.h @@ -20,7 +20,6 @@ #ifndef ZM_LIBVLC_CAMERA_H #define ZM_LIBVLC_CAMERA_H -#include "zm_buffer.h" #include "zm_camera.h" #include "zm_thread.h" diff --git a/src/zm_libvnc_camera.cpp b/src/zm_libvnc_camera.cpp index 593e8f6c8..d64f1d2f2 100644 --- a/src/zm_libvnc_camera.cpp +++ b/src/zm_libvnc_camera.cpp @@ -1,8 +1,7 @@ -#include -#include "zm.h" -#include "zm_signal.h" #include "zm_libvnc_camera.h" -#include "zm_swscale.h" + +#include "zm_packet.h" +#include #if HAVE_LIBVNC diff --git a/src/zm_libvnc_camera.h b/src/zm_libvnc_camera.h index f8f531343..019e4ef99 100644 --- a/src/zm_libvnc_camera.h +++ b/src/zm_libvnc_camera.h @@ -2,9 +2,7 @@ #ifndef ZN_LIBVNC_CAMERA_H #define ZN_LIBVNC_CAMERA_H -#include "zm_buffer.h" #include "zm_camera.h" -#include "zm_thread.h" #include "zm_swscale.h" #if HAVE_LIBVNC diff --git a/src/zm_local_camera.cpp b/src/zm_local_camera.cpp index 2b7f9eb72..cada977d0 100644 --- a/src/zm_local_camera.cpp +++ b/src/zm_local_camera.cpp @@ -17,20 +17,15 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" - -#if ZM_HAS_V4L - #include "zm_local_camera.h" -#include -#include +#include "zm_packet.h" +#include "zm_utils.h" #include -#include #include -#include -#include -#include +#include + +#if ZM_HAS_V4L /* Workaround for GNU/kFreeBSD and FreeBSD */ #if defined(__FreeBSD_kernel__) || defined(__FreeBSD__) diff --git a/src/zm_local_camera.h b/src/zm_local_camera.h index beeb5c479..9256dac5a 100644 --- a/src/zm_local_camera.h +++ b/src/zm_local_camera.h @@ -20,10 +20,7 @@ #ifndef ZM_LOCAL_CAMERA_H #define ZM_LOCAL_CAMERA_H -#include "zm.h" #include "zm_camera.h" -#include "zm_image.h" -#include "zm_packet.h" #if ZM_HAS_V4L @@ -42,8 +39,6 @@ #define VIDEO_MAX_FRAME 32 #endif -#include "zm_ffmpeg.h" - // // Class representing 'local' cameras, i.e. those which are // directly connect to the host machine and which are accessed diff --git a/src/zm_logger.cpp b/src/zm_logger.cpp index e641dfcef..8be72c0f4 100644 --- a/src/zm_logger.cpp +++ b/src/zm_logger.cpp @@ -19,24 +19,18 @@ #include "zm_logger.h" -#include "zm_config.h" -#include "zm_utils.h" #include "zm_db.h" - -#include -#include -#include -#include -#include -#include +#include "zm_utils.h" #include #include -#include +#include #include +#include +#include + #ifdef __FreeBSD__ #include #endif -#include bool Logger::smInitialised = false; Logger *Logger::smInstance = nullptr; diff --git a/src/zm_logger.h b/src/zm_logger.h index 647de1f1a..6350449a5 100644 --- a/src/zm_logger.h +++ b/src/zm_logger.h @@ -20,17 +20,16 @@ #ifndef ZM_LOGGER_H #define ZM_LOGGER_H +#include "zm_db.h" #include "zm_config.h" #include "zm_define.h" #include "zm_thread.h" - -#include #include #include + #ifdef HAVE_SYS_SYSCALL_H #include #endif // HAVE_SYS_SYSCALL_H -#include class Logger { public: diff --git a/src/zm_mem_utils.h b/src/zm_mem_utils.h index 548146a8e..72fb2b9aa 100644 --- a/src/zm_mem_utils.h +++ b/src/zm_mem_utils.h @@ -21,7 +21,6 @@ #define ZM_MEM_UTILS_H #include -#include "zm.h" inline void* zm_mallocaligned(unsigned int reqalignment, size_t reqsize) { uint8_t* retptr; diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 01da16563..88a5c295b 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -17,43 +17,46 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include -#include -#include -#include - -#include "zm.h" -#include "zm_db.h" -#include "zm_time.h" -#include "zm_mpeg.h" -#include "zm_signal.h" #include "zm_monitor.h" -#include "zm_video.h" + +#include "zm_group.h" #include "zm_eventstream.h" -#if ZM_HAS_V4L -#include "zm_local_camera.h" -#endif // ZM_HAS_V4L +#include "zm_fifo.h" +#include "zm_file_camera.h" #include "zm_remote_camera.h" #include "zm_remote_camera_http.h" #include "zm_remote_camera_nvsocket.h" +#include "zm_signal.h" +#include "zm_time.h" +#include "zm_zone.h" + +#if ZM_HAS_V4L +#include "zm_local_camera.h" +#endif // ZM_HAS_V4L + #if HAVE_LIBAVFORMAT #include "zm_remote_camera_rtsp.h" #endif // HAVE_LIBAVFORMAT -#include "zm_file_camera.h" + #if HAVE_LIBAVFORMAT #include "zm_ffmpeg_camera.h" #endif // HAVE_LIBAVFORMAT -#include "zm_fifo.h" + #if HAVE_LIBVLC #include "zm_libvlc_camera.h" #endif // HAVE_LIBVLC + #if HAVE_LIBCURL #include "zm_curl_camera.h" #endif // HAVE_LIBCURL + #if HAVE_LIBVNC #include "zm_libvnc_camera.h" #endif // HAVE_LIBVNC +#include +#include + #if ZM_MEM_MAPPED #include #include diff --git a/src/zm_monitor.h b/src/zm_monitor.h index 73794e036..6d908ed20 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -20,30 +20,16 @@ #ifndef ZM_MONITOR_H #define ZM_MONITOR_H -#include -#include -#include - -#include "zm.h" -#include "zm_coord.h" -#include "zm_image.h" -#include "zm_rgb.h" -#include "zm_zone.h" #include "zm_event.h" -#include "zm_video.h" -#include "zm_videostore.h" +#include "zm_image.h" +#include "zm_packet.h" #include "zm_packetqueue.h" -#include "zm_thread.h" - -class Monitor; -#include "zm_group.h" -#include "zm_camera.h" -#include "zm_storage.h" -#include "zm_utils.h" - -#include "zm_image_analyser.h" - +#include "zm_video.h" #include +#include + +class Camera; +class Group; #define SIGNAL_CAUSE "Signal" #define MOTION_CAUSE "Motion" diff --git a/src/zm_monitorstream.cpp b/src/zm_monitorstream.cpp index df7ddc7e8..a3351dd93 100644 --- a/src/zm_monitorstream.cpp +++ b/src/zm_monitorstream.cpp @@ -17,15 +17,14 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" -#include "zm_db.h" -#include "zm_time.h" -#include "zm_mpeg.h" -#include "zm_signal.h" -#include "zm_monitor.h" #include "zm_monitorstream.h" + +#include "zm_monitor.h" +#include "zm_signal.h" +#include "zm_time.h" #include #include +#include const int MAX_SLEEP_USEC = 1000000; // 1 sec diff --git a/src/zm_monitorstream.h b/src/zm_monitorstream.h index 9d45453cb..241c8cf2b 100644 --- a/src/zm_monitorstream.h +++ b/src/zm_monitorstream.h @@ -20,11 +20,8 @@ #ifndef ZM_MONITORSTREAM_H #define ZM_MONITORSTREAM_H -#include "zm.h" -#include "zm_coord.h" -#include "zm_image.h" -#include "zm_utils.h" -#include "zm_monitor.h" +#include "zm_stream.h" +#include class MonitorStream : public StreamBase { protected: diff --git a/src/zm_mpeg.cpp b/src/zm_mpeg.cpp index 72a968b70..7686496b7 100644 --- a/src/zm_mpeg.cpp +++ b/src/zm_mpeg.cpp @@ -17,13 +17,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include -#include - -#include "zm.h" -#include "zm_rgb.h" #include "zm_mpeg.h" +#include "zm_logger.h" +#include "zm_rgb.h" +#include + #if HAVE_LIBAVCODEC extern "C" { #include diff --git a/src/zm_packet.cpp b/src/zm_packet.cpp index 358c05a48..d3abba13a 100644 --- a/src/zm_packet.cpp +++ b/src/zm_packet.cpp @@ -16,10 +16,11 @@ //You should have received a copy of the GNU General Public License //along with ZoneMinder. If not, see . - #include "zm_packet.h" -#include "zm_ffmpeg.h" +#include "zm_ffmpeg.h" +#include "zm_image.h" +#include "zm_logger.h" #include using namespace std; diff --git a/src/zm_packet.h b/src/zm_packet.h index 82c3abdac..ea609429f 100644 --- a/src/zm_packet.h +++ b/src/zm_packet.h @@ -20,6 +20,9 @@ #ifndef ZM_PACKET_H #define ZM_PACKET_H +#include "zm_logger.h" +#include + extern "C" { #include } @@ -28,9 +31,7 @@ extern "C" { #include #endif // __FreeBSD__ -#include "zm_image.h" -#include "zm_thread.h" -#include +class Image; class ZMPacket { public: diff --git a/src/zm_packetqueue.cpp b/src/zm_packetqueue.cpp index 3e90a7472..0c9ca1b43 100644 --- a/src/zm_packetqueue.cpp +++ b/src/zm_packetqueue.cpp @@ -20,10 +20,11 @@ // PacketQueue must know about all iterators and manage them #include "zm_packetqueue.h" + #include "zm_ffmpeg.h" +#include "zm_packet.h" #include "zm_signal.h" #include -#include "zm_time.h" PacketQueue::PacketQueue(): video_stream_id(-1), diff --git a/src/zm_packetqueue.h b/src/zm_packetqueue.h index b4ce89003..4e2159801 100644 --- a/src/zm_packetqueue.h +++ b/src/zm_packetqueue.h @@ -16,19 +16,15 @@ //You should have received a copy of the GNU General Public License //along with ZoneMinder. If not, see . - #ifndef ZM_PACKETQUEUE_H #define ZM_PACKETQUEUE_H -#include -#include "zm_packet.h" -#include "zm_thread.h" -#include #include +#include +#include + +class ZMPacket; -extern "C" { -#include -} typedef std::list::iterator packetqueue_iterator; class PacketQueue { diff --git a/src/zm_poly.cpp b/src/zm_poly.cpp index 1c197a04e..f439b9491 100644 --- a/src/zm_poly.cpp +++ b/src/zm_poly.cpp @@ -17,7 +17,6 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" #include "zm_poly.h" #include diff --git a/src/zm_poly.h b/src/zm_poly.h index 48193d6c9..e7d2581b7 100644 --- a/src/zm_poly.h +++ b/src/zm_poly.h @@ -20,11 +20,9 @@ #ifndef ZM_POLY_H #define ZM_POLY_H -#include "zm.h" -#include "zm_coord.h" #include "zm_box.h" -#include +class Coord; // // Class used for storing a box, which is defined as a region diff --git a/src/zm_regexp.cpp b/src/zm_regexp.cpp index 45c78a4d8..1541b31ef 100644 --- a/src/zm_regexp.cpp +++ b/src/zm_regexp.cpp @@ -15,13 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ +*/ -#include - -#include "zm.h" #include "zm_regexp.h" +#include "zm_logger.h" +#include + #if HAVE_LIBPCRE RegExpr::RegExpr( const char *pattern, int flags, int p_max_matches ) : max_matches( p_max_matches ), match_buffers( nullptr ), match_lengths( nullptr ), match_valid( nullptr ) diff --git a/src/zm_regexp.h b/src/zm_regexp.h index c859823d5..19a13f234 100644 --- a/src/zm_regexp.h +++ b/src/zm_regexp.h @@ -17,11 +17,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "zm.h" - #ifndef ZM_REGEXP_H #define ZM_REGEXP_H +#include "zm_config.h" + #if HAVE_LIBPCRE #if HAVE_PCRE_H diff --git a/src/zm_remote_camera.cpp b/src/zm_remote_camera.cpp index dce4daf5c..55e275751 100644 --- a/src/zm_remote_camera.cpp +++ b/src/zm_remote_camera.cpp @@ -20,6 +20,8 @@ #include "zm_remote_camera.h" #include "zm_utils.h" +#include +#include RemoteCamera::RemoteCamera( unsigned int p_monitor_id, diff --git a/src/zm_remote_camera.h b/src/zm_remote_camera.h index 8e7ad5255..03c041468 100644 --- a/src/zm_remote_camera.h +++ b/src/zm_remote_camera.h @@ -22,12 +22,7 @@ #include "zm_camera.h" #include "zm_rtsp_auth.h" - #include -#include -#include -#include -#include #define SOCKET_BUF_SIZE 8192 diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index e68fe9262..268b20459 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -18,14 +18,12 @@ // #include "zm_remote_camera_http.h" -#include "zm_rtsp_auth.h" -#include "zm_mem_utils.h" +#include "zm_packet.h" #include "zm_signal.h" - -#include -#include -#include +#include "zm_regexp.h" +#include "zm_utils.h" +#include #include #ifdef SOLARIS diff --git a/src/zm_remote_camera_http.h b/src/zm_remote_camera_http.h index 25c464315..0ea90039a 100644 --- a/src/zm_remote_camera_http.h +++ b/src/zm_remote_camera_http.h @@ -20,11 +20,8 @@ #ifndef ZM_REMOTE_CAMERA_HTTP_H #define ZM_REMOTE_CAMERA_HTTP_H -#include "zm_remote_camera.h" - #include "zm_buffer.h" -#include "zm_regexp.h" -#include "zm_utils.h" +#include "zm_remote_camera.h" // // Class representing 'http' cameras, i.e. those which are diff --git a/src/zm_remote_camera_nvsocket.cpp b/src/zm_remote_camera_nvsocket.cpp index fd4bbdea3..580b9ee28 100644 --- a/src/zm_remote_camera_nvsocket.cpp +++ b/src/zm_remote_camera_nvsocket.cpp @@ -19,12 +19,10 @@ #include "zm_remote_camera_nvsocket.h" -#include "zm_mem_utils.h" - -#include -#include -#include +#include "zm_packet.h" #include +#include +#include #ifdef SOLARIS #include // FIONREAD and friends diff --git a/src/zm_remote_camera_nvsocket.h b/src/zm_remote_camera_nvsocket.h index 4da34215d..7a6374a1b 100644 --- a/src/zm_remote_camera_nvsocket.h +++ b/src/zm_remote_camera_nvsocket.h @@ -20,11 +20,8 @@ #ifndef ZM_REMOTE_CAMERA_NVSOCKET_H #define ZM_REMOTE_CAMERA_NVSOCKET_H -#include "zm_remote_camera.h" - #include "zm_buffer.h" -#include "zm_regexp.h" -#include "zm_utils.h" +#include "zm_remote_camera.h" class RemoteCameraNVSocket : public RemoteCamera { protected: diff --git a/src/zm_remote_camera_rtsp.cpp b/src/zm_remote_camera_rtsp.cpp index e5326d191..83748c338 100644 --- a/src/zm_remote_camera_rtsp.cpp +++ b/src/zm_remote_camera_rtsp.cpp @@ -17,17 +17,13 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" +#include "zm_remote_camera_rtsp.h" + +#include "zm_config.h" +#include "zm_packet.h" #if HAVE_LIBAVFORMAT -#include "zm_remote_camera_rtsp.h" -#include "zm_ffmpeg.h" -#include "zm_mem_utils.h" - -#include -#include - RemoteCameraRtsp::RemoteCameraRtsp( unsigned int p_monitor_id, const std::string &p_method, diff --git a/src/zm_remote_camera_rtsp.h b/src/zm_remote_camera_rtsp.h index b4efc2d4b..a715d9517 100644 --- a/src/zm_remote_camera_rtsp.h +++ b/src/zm_remote_camera_rtsp.h @@ -20,14 +20,9 @@ #ifndef ZM_REMOTE_CAMERA_RTSP_H #define ZM_REMOTE_CAMERA_RTSP_H -#include "zm_remote_camera.h" - -#include "zm_buffer.h" -#include "zm_utils.h" -#include "zm_rtsp.h" #include "zm_ffmpeg.h" -#include "zm_videostore.h" -#include "zm_packetqueue.h" +#include "zm_remote_camera.h" +#include "zm_rtsp.h" // // Class representing 'rtsp' cameras, i.e. those which are diff --git a/src/zm_rgb.h b/src/zm_rgb.h index 1b6cb7550..05c006ee4 100644 --- a/src/zm_rgb.h +++ b/src/zm_rgb.h @@ -20,7 +20,9 @@ #ifndef ZM_RGB_H #define ZM_RGB_H -typedef uint32_t Rgb; // RGB colour type +#include "zm_define.h" + +typedef uint32 Rgb; // RGB colour type #define WHITE 0xff #define WHITE_R 0xff diff --git a/src/zm_rtp.h b/src/zm_rtp.h index 25403f1a5..f45e14c74 100644 --- a/src/zm_rtp.h +++ b/src/zm_rtp.h @@ -20,8 +20,6 @@ #ifndef ZM_RTP_H #define ZM_RTP_H -#include "zm.h" - #define RTP_VERSION 2 #endif // ZM_RTP_H diff --git a/src/zm_rtp_ctrl.cpp b/src/zm_rtp_ctrl.cpp index 651df5f7c..f33cf46d4 100644 --- a/src/zm_rtp_ctrl.cpp +++ b/src/zm_rtp_ctrl.cpp @@ -15,18 +15,15 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// - -#include "zm.h" - -#if HAVE_LIBAVFORMAT +// #include "zm_rtp_ctrl.h" -#include "zm_time.h" +#include "zm_config.h" +#include "zm_rtp.h" #include "zm_rtsp.h" -#include +#if HAVE_LIBAVFORMAT RtpCtrlThread::RtpCtrlThread( RtspThread &rtspThread, RtpSource &rtpSource ) : mRtspThread( rtspThread ), mRtpSource( rtpSource ), mStop( false ) diff --git a/src/zm_rtp_ctrl.h b/src/zm_rtp_ctrl.h index 9e5306f92..5fd428ead 100644 --- a/src/zm_rtp_ctrl.h +++ b/src/zm_rtp_ctrl.h @@ -20,8 +20,6 @@ #ifndef ZM_RTP_CTRL_H #define ZM_RTP_CTRL_H -#include "zm_rtp.h" -#include "zm_comms.h" #include "zm_thread.h" // Defined in ffmpeg rtp.h diff --git a/src/zm_rtp_data.cpp b/src/zm_rtp_data.cpp index de7c732d3..aadc760c6 100644 --- a/src/zm_rtp_data.cpp +++ b/src/zm_rtp_data.cpp @@ -17,15 +17,13 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" - -#if HAVE_LIBAVFORMAT - #include "zm_rtp_data.h" +#include "zm_config.h" #include "zm_rtsp.h" +#include "zm_signal.h" -#include +#if HAVE_LIBAVFORMAT RtpDataThread::RtpDataThread(RtspThread &rtspThread, RtpSource &rtpSource) : mRtspThread(rtspThread), mRtpSource(rtpSource), mStop(false) diff --git a/src/zm_rtp_data.h b/src/zm_rtp_data.h index 0e05df84b..9ecef8305 100644 --- a/src/zm_rtp_data.h +++ b/src/zm_rtp_data.h @@ -20,7 +20,6 @@ #ifndef ZM_RTP_DATA_H #define ZM_RTP_DATA_H -#include "zm_buffer.h" #include "zm_define.h" #include "zm_thread.h" diff --git a/src/zm_rtp_source.cpp b/src/zm_rtp_source.cpp index b6d215f25..e9edfb821 100644 --- a/src/zm_rtp_source.cpp +++ b/src/zm_rtp_source.cpp @@ -21,7 +21,7 @@ #include "zm_time.h" #include "zm_rtp_data.h" - +#include "zm_utils.h" #include #if HAVE_LIBAVCODEC diff --git a/src/zm_rtp_source.h b/src/zm_rtp_source.h index 4869d405c..522ba4324 100644 --- a/src/zm_rtp_source.h +++ b/src/zm_rtp_source.h @@ -21,12 +21,12 @@ #define ZM_RTP_SOURCE_H #include "zm_buffer.h" +#include "zm_config.h" #include "zm_define.h" #include "zm_ffmpeg.h" #include "zm_thread.h" - -#include #include +#include #if HAVE_LIBAVCODEC diff --git a/src/zm_rtsp.cpp b/src/zm_rtsp.cpp index 076558656..51b91dae2 100644 --- a/src/zm_rtsp.cpp +++ b/src/zm_rtsp.cpp @@ -17,20 +17,14 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" - -#if HAVE_LIBAVFORMAT - #include "zm_rtsp.h" +#include "zm_config.h" #include "zm_rtp_data.h" #include "zm_rtp_ctrl.h" #include "zm_db.h" -#include -#include -#include -#include +#if HAVE_LIBAVFORMAT int RtspThread::smMinDataPort = 0; int RtspThread::smMaxDataPort = 0; diff --git a/src/zm_rtsp.h b/src/zm_rtsp.h index 14ef02010..7dd48d5b1 100644 --- a/src/zm_rtsp.h +++ b/src/zm_rtsp.h @@ -20,16 +20,12 @@ #ifndef ZM_RTSP_H #define ZM_RTSP_H -#include "zm.h" -#include "zm_ffmpeg.h" #include "zm_comms.h" -#include "zm_thread.h" #include "zm_rtp_source.h" #include "zm_rtsp_auth.h" #include "zm_sdp.h" - -#include #include +#include class RtspThread : public Thread { public: diff --git a/src/zm_rtsp_auth.cpp b/src/zm_rtsp_auth.cpp index 14f4aa3bf..138036fd1 100644 --- a/src/zm_rtsp_auth.cpp +++ b/src/zm_rtsp_auth.cpp @@ -14,13 +14,12 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// +// -#include "zm.h" -#include "zm_utils.h" #include "zm_rtsp_auth.h" -#include +#include "zm_logger.h" +#include "zm_utils.h" #include namespace zm { diff --git a/src/zm_rtsp_auth.h b/src/zm_rtsp_auth.h index 8e65746de..8721ab2e6 100644 --- a/src/zm_rtsp_auth.h +++ b/src/zm_rtsp_auth.h @@ -19,6 +19,9 @@ #ifndef ZM_RTSP_AUTH_H #define ZM_RTSP_AUTH_H +#include "zm_config.h" +#include + #if HAVE_GNUTLS_GNUTLS_H #include #endif diff --git a/src/zm_rtsp_server_adts_source.cpp b/src/zm_rtsp_server_adts_source.cpp index bc553d555..29ef7ca46 100644 --- a/src/zm_rtsp_server_adts_source.cpp +++ b/src/zm_rtsp_server_adts_source.cpp @@ -6,17 +6,15 @@ ** ** -------------------------------------------------------------------------*/ -#include "zm.h" +#include "zm_rtsp_server_adts_source.h" + +#include "zm_config.h" +#include #if HAVE_RTSP_SERVER -#include -#include - // live555 #include -#include "zm_rtsp_server_adts_source.h" - static unsigned const samplingFrequencyTable[16] = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, diff --git a/src/zm_rtsp_server_adts_source.h b/src/zm_rtsp_server_adts_source.h index bb9c8db91..a3f7a3494 100644 --- a/src/zm_rtsp_server_adts_source.h +++ b/src/zm_rtsp_server_adts_source.h @@ -9,17 +9,14 @@ ** ** -------------------------------------------------------------------------*/ -#include "zm.h" +#include "zm_config.h" +#include "zm_rtsp_server_device_source.h" #if HAVE_RTSP_SERVER #ifndef ADTS_ZoneMinder_DEVICE_SOURCE #define ADTS_ZoneMinder_DEVICE_SOURCE -// project -#include "zm_rtsp_server_device_source.h" -#include "zm_rtsp_server_frame.h" - // --------------------------------- // ADTS(AAC) ZoneMinder FramedSource // --------------------------------- diff --git a/src/zm_rtsp_server_device_source.cpp b/src/zm_rtsp_server_device_source.cpp index d35d8abd9..4b867490c 100644 --- a/src/zm_rtsp_server_device_source.cpp +++ b/src/zm_rtsp_server_device_source.cpp @@ -8,11 +8,13 @@ ** ** -------------------------------------------------------------------------*/ -#include - #include "zm_rtsp_server_device_source.h" -#include "zm_rtsp_server_frame.h" + +#include "zm_config.h" #include "zm_logger.h" +#include "zm_rtsp_server_frame.h" +#include "zm_signal.h" + #if HAVE_RTSP_SERVER ZoneMinderDeviceSource::ZoneMinderDeviceSource( diff --git a/src/zm_rtsp_server_device_source.h b/src/zm_rtsp_server_device_source.h index e8766fdc3..72704bb0a 100644 --- a/src/zm_rtsp_server_device_source.h +++ b/src/zm_rtsp_server_device_source.h @@ -6,24 +6,20 @@ ** ** -------------------------------------------------------------------------*/ -#include "zm.h" +#include "zm_config.h" +#include "zm_monitor.h" +#include +#include +#include #if HAVE_RTSP_SERVER #ifndef DEVICE_SOURCE #define DEVICE_SOURCE -#include -#include -#include - #include -#include "zm_monitor.h" -#include "zm_rtsp_server_frame.h" -#include "zm_packetqueue.h" - -#include +class NAL_Frame; class ZoneMinderDeviceSource: public FramedSource { diff --git a/src/zm_rtsp_server_frame.h b/src/zm_rtsp_server_frame.h index 7df7c4b8b..346696dfb 100644 --- a/src/zm_rtsp_server_frame.h +++ b/src/zm_rtsp_server_frame.h @@ -1,11 +1,12 @@ #pragma once + +#include "zm_config.h" #include "zm_logger.h" -#include "zm.h" +#include +#include #if HAVE_RTSP_SERVER -#include -#include // --------------------------------- // Captured frame // --------------------------------- diff --git a/src/zm_rtsp_server_h264_device_source.cpp b/src/zm_rtsp_server_h264_device_source.cpp index 82f873f70..a4acd66ef 100644 --- a/src/zm_rtsp_server_h264_device_source.cpp +++ b/src/zm_rtsp_server_h264_device_source.cpp @@ -6,18 +6,19 @@ ** ** -------------------------------------------------------------------------*/ -#include "zm.h" +#include "zm_rtsp_server_h264_device_source.h" + +#include "zm_config.h" +#include "zm_logger.h" +#include "zm_rtsp_server_frame.h" +#include +#include #if HAVE_RTSP_SERVER -#include -#include - // live555 #include -#include "zm_rtsp_server_h264_device_source.h" - // --------------------------------- // H264 ZoneMinder FramedSource // --------------------------------- diff --git a/src/zm_rtsp_server_h264_device_source.h b/src/zm_rtsp_server_h264_device_source.h index a3d907ec4..e6fde341c 100644 --- a/src/zm_rtsp_server_h264_device_source.h +++ b/src/zm_rtsp_server_h264_device_source.h @@ -9,12 +9,10 @@ ** ** -------------------------------------------------------------------------*/ - #ifndef H264_ZoneMinder_DEVICE_SOURCE #define H264_ZoneMinder_DEVICE_SOURCE #include "zm_rtsp_server_device_source.h" -#include "zm_rtsp_server_frame.h" // --------------------------------- // H264 ZoneMinder FramedSource diff --git a/src/zm_rtsp_server_server_media_subsession.cpp b/src/zm_rtsp_server_server_media_subsession.cpp index 41a4a252b..6793a7a53 100644 --- a/src/zm_rtsp_server_server_media_subsession.cpp +++ b/src/zm_rtsp_server_server_media_subsession.cpp @@ -4,15 +4,13 @@ ** ** -------------------------------------------------------------------------*/ -#include "zm.h" +#include "zm_rtsp_server_server_media_subsession.h" -#if HAVE_RTSP_SERVER +#include "zm_config.h" +#include "zm_rtsp_server_adts_source.h" #include -#include "zm_rtsp_server_server_media_subsession.h" -#include "zm_rtsp_server_device_source.h" -#include "zm_rtsp_server_adts_source.h" - +#if HAVE_RTSP_SERVER // --------------------------------- // BaseServerMediaSubsession // --------------------------------- diff --git a/src/zm_rtsp_server_server_media_subsession.h b/src/zm_rtsp_server_server_media_subsession.h index 27fbc0c3f..2cd85dd5b 100644 --- a/src/zm_rtsp_server_server_media_subsession.h +++ b/src/zm_rtsp_server_server_media_subsession.h @@ -9,17 +9,11 @@ #pragma once -#include "zm.h" +#include "zm_config.h" +#include #if HAVE_RTSP_SERVER -#include - -#include -#include -#include -#include - #include class ZoneMinderDeviceSource; diff --git a/src/zm_rtsp_server_thread.cpp b/src/zm_rtsp_server_thread.cpp index b6dcdebc5..8c70a375e 100644 --- a/src/zm_rtsp_server_thread.cpp +++ b/src/zm_rtsp_server_thread.cpp @@ -1,12 +1,11 @@ +#include "zm_rtsp_server_thread.h" -#include "zm.h" +#include "zm_config.h" +#include "zm_rtsp_server_adts_source.h" +#include "zm_rtsp_server_h264_device_source.h" +#include "zm_rtsp_server_unicast_server_media_subsession.h" #if HAVE_RTSP_SERVER -#include "zm_rtsp_server_thread.h" -#include "zm_rtsp_server_device_source.h" -#include "zm_rtsp_server_h264_device_source.h" -#include "zm_rtsp_server_adts_source.h" -#include "zm_rtsp_server_unicast_server_media_subsession.h" #include RTSPServerThread::RTSPServerThread(Monitor *p_monitor) : diff --git a/src/zm_rtsp_server_thread.h b/src/zm_rtsp_server_thread.h index 405c5dd29..0a94d63c7 100644 --- a/src/zm_rtsp_server_thread.h +++ b/src/zm_rtsp_server_thread.h @@ -1,17 +1,17 @@ -#include "zm.h" -#if HAVE_RTSP_SERVER - #ifndef ZM_RTSP_SERVER_THREAD_H #define ZM_RTSP_SERVER_THREAD_H +#include "zm_config.h" +#include "zm_ffmpeg.h" #include "zm_thread.h" -#include +#include -#include "zm_monitor.h" +#if HAVE_RTSP_SERVER #include #include -#include "zm_ffmpeg.h" + +class Monitor; class RTSPServerThread : public Thread { private: diff --git a/src/zm_rtsp_server_unicast_server_media_subsession.cpp b/src/zm_rtsp_server_unicast_server_media_subsession.cpp index 63b3d27e9..94ed06903 100644 --- a/src/zm_rtsp_server_unicast_server_media_subsession.cpp +++ b/src/zm_rtsp_server_unicast_server_media_subsession.cpp @@ -7,11 +7,13 @@ ** ** -------------------------------------------------------------------------*/ -#include "zm.h" -#if HAVE_RTSP_SERVER #include "zm_rtsp_server_unicast_server_media_subsession.h" + +#include "zm_config.h" #include "zm_rtsp_server_device_source.h" +#if HAVE_RTSP_SERVER + // ----------------------------------------- // ServerMediaSubsession for Unicast // ----------------------------------------- diff --git a/src/zm_rtsp_server_unicast_server_media_subsession.h b/src/zm_rtsp_server_unicast_server_media_subsession.h index 5cafbaebb..817b18f27 100644 --- a/src/zm_rtsp_server_unicast_server_media_subsession.h +++ b/src/zm_rtsp_server_unicast_server_media_subsession.h @@ -9,6 +9,7 @@ #pragma once +#include "zm_config.h" #include "zm_rtsp_server_server_media_subsession.h" // ----------------------------------------- diff --git a/src/zm_sdp.cpp b/src/zm_sdp.cpp index a96fe888a..247ce82cb 100644 --- a/src/zm_sdp.cpp +++ b/src/zm_sdp.cpp @@ -17,12 +17,13 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" +#include "zm_sdp.h" + +#include "zm_config.h" +#include "zm_logger.h" #if HAVE_LIBAVFORMAT -#include "zm_sdp.h" - #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0)) SessionDescriptor::StaticPayloadDesc SessionDescriptor::smStaticPayloads[] = { { 0, "PCMU", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_MULAW, 8000, 1 }, diff --git a/src/zm_sdp.h b/src/zm_sdp.h index e17ea7fd1..456a9613b 100644 --- a/src/zm_sdp.h +++ b/src/zm_sdp.h @@ -20,14 +20,8 @@ #ifndef ZM_SDP_H #define ZM_SDP_H -#include "zm.h" - -#include "zm_utils.h" -#include "zm_exception.h" #include "zm_ffmpeg.h" - -#include - +#include "zm_utils.h" #include #include diff --git a/src/zm_signal.cpp b/src/zm_signal.cpp index 6d31619f0..2d1315049 100644 --- a/src/zm_signal.cpp +++ b/src/zm_signal.cpp @@ -17,12 +17,11 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include "zm.h" #include "zm_signal.h" -#include +#include "zm.h" +#include "zm_logger.h" #include -#include #define TRACE_SIZE 16 diff --git a/src/zm_signal.h b/src/zm_signal.h index cf345fdb9..27fa2e766 100644 --- a/src/zm_signal.h +++ b/src/zm_signal.h @@ -20,6 +20,7 @@ #ifndef ZM_SIGNAL_H #define ZM_SIGNAL_H +#include "zm_config.h" #include #if HAVE_EXECINFO_H @@ -29,9 +30,6 @@ #include #endif - -#include "zm.h" - typedef RETSIGTYPE (SigHandler)( int ); extern bool zm_reload; diff --git a/src/zm_storage.cpp b/src/zm_storage.cpp index 0ea2f950a..5edc36e00 100644 --- a/src/zm_storage.cpp +++ b/src/zm_storage.cpp @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "zm.h" -#include "zm_db.h" +*/ #include "zm_storage.h" +#include "zm_db.h" +#include "zm_logger.h" #include -#include -#include Storage::Storage() : id(0) { Warning("Instantiating default Storage Object. Should not happen."); diff --git a/src/zm_storage.h b/src/zm_storage.h index f0886c9f3..f878a137d 100644 --- a/src/zm_storage.h +++ b/src/zm_storage.h @@ -15,13 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "zm_db.h" +*/ #ifndef ZM_STORAGE_H #define ZM_STORAGE_H +#include "zm_db.h" +#include + class Storage { public: typedef enum { diff --git a/src/zm_stream.cpp b/src/zm_stream.cpp index 98c08922d..4df30aa96 100644 --- a/src/zm_stream.cpp +++ b/src/zm_stream.cpp @@ -17,18 +17,14 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include -#include -#include -#include -#include - -#include "zm.h" -#include "zm_mpeg.h" -#include "zm_monitor.h" - #include "zm_stream.h" +#include "zm_box.h" +#include "zm_monitor.h" +#include +#include +#include + StreamBase::~StreamBase() { #if HAVE_LIBAVCODEC if ( vid_stream ) { diff --git a/src/zm_stream.h b/src/zm_stream.h index 65e9659be..607d4d07a 100644 --- a/src/zm_stream.h +++ b/src/zm_stream.h @@ -20,12 +20,12 @@ #ifndef ZM_STREAM_H #define ZM_STREAM_H -#include -#include - -#include "zm.h" +#include "zm_logger.h" #include "zm_mpeg.h" +#include + +class Image; class Monitor; #define TV_2_FLOAT( tv ) ( double((tv).tv_sec) + (double((tv).tv_usec) / 1000000.0) ) diff --git a/src/zm_swscale.cpp b/src/zm_swscale.cpp index a47e0de35..1344d54b7 100644 --- a/src/zm_swscale.cpp +++ b/src/zm_swscale.cpp @@ -15,14 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "zm_ffmpeg.h" -#include "zm_image.h" -#include "zm_rgb.h" +*/ #include "zm_swscale.h" +#include "zm_image.h" +#include "zm_logger.h" + #if HAVE_LIBSWSCALE && HAVE_LIBAVUTIL SWScale::SWScale() : gotdefaults(false), swscale_ctx(nullptr), input_avframe(nullptr), output_avframe(nullptr) { Debug(4, "SWScale object created"); diff --git a/src/zm_swscale.h b/src/zm_swscale.h index f55f7e759..9f618f1a2 100644 --- a/src/zm_swscale.h +++ b/src/zm_swscale.h @@ -1,9 +1,11 @@ #ifndef ZM_SWSCALE_H #define ZM_SWSCALE_H -#include "zm_image.h" +#include "zm_config.h" #include "zm_ffmpeg.h" +class Image; + /* SWScale wrapper class to make our life easier and reduce code reuse */ #if HAVE_LIBSWSCALE && HAVE_LIBAVUTIL class SWScale { diff --git a/src/zm_thread.cpp b/src/zm_thread.cpp index 23682b53f..ad5670fec 100644 --- a/src/zm_thread.cpp +++ b/src/zm_thread.cpp @@ -21,11 +21,9 @@ #include "zm_logger.h" #include "zm_utils.h" - #include #include -#include -#include +#include struct timespec getTimeout( int secs ) { struct timespec timeout; diff --git a/src/zm_thread.h b/src/zm_thread.h index 3f3e8c6b9..fbf4cc038 100644 --- a/src/zm_thread.h +++ b/src/zm_thread.h @@ -20,17 +20,16 @@ #ifndef ZM_THREAD_H #define ZM_THREAD_H -class RecursiveMutex; - - #include "zm_config.h" -#include +#include "zm_exception.h" +#include "zm_utils.h" #include +#include + #ifdef HAVE_SYS_SYSCALL_H #include #endif // HAVE_SYS_SYSCALL_H -#include "zm_exception.h" -#include "zm_utils.h" + #ifdef __FreeBSD__ #include #endif diff --git a/src/zm_time.h b/src/zm_time.h index 490ca1e2c..5a54bea46 100644 --- a/src/zm_time.h +++ b/src/zm_time.h @@ -20,8 +20,7 @@ #ifndef ZM_TIME_H #define ZM_TIME_H -#include "zm.h" - +#include #include // Structure used for storing the results of the subtraction diff --git a/src/zm_timer.h b/src/zm_timer.h index da3b95783..f5db16f3a 100644 --- a/src/zm_timer.h +++ b/src/zm_timer.h @@ -20,12 +20,13 @@ #ifndef ZM_TIMER_H #define ZM_TIMER_H +#include "zm_exception.h" +#include "zm_thread.h" +#include "zm_utils.h" + #ifdef HAVE_SYS_SYSCALL_H #include #endif // HAVE_SYS_SYSCALL_H -#include "zm_thread.h" - -#include "zm_exception.h" class Timer { diff --git a/src/zm_user.cpp b/src/zm_user.cpp index 5b0654e28..dfba0d51d 100644 --- a/src/zm_user.cpp +++ b/src/zm_user.cpp @@ -17,16 +17,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "zm.h" -#include "zm_db.h" - #include "zm_user.h" -#include -#include +#include "zm_crypt.h" +#include "zm_logger.h" +#include "zm_utils.h" #include -#include -#include #if HAVE_GNUTLS_GNUTLS_H #include @@ -38,9 +34,6 @@ #include #endif // HAVE_GCRYPT_H || HAVE_LIBCRYPTO -#include "zm_utils.h" -#include "zm_crypt.h" - User::User() { id = 0; username[0] = password[0] = 0; diff --git a/src/zm_user.h b/src/zm_user.h index 519ea13de..d327500a8 100644 --- a/src/zm_user.h +++ b/src/zm_user.h @@ -17,12 +17,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "zm.h" -#include "zm_db.h" + #ifndef ZM_USER_H #define ZM_USER_H +#include "zm_db.h" #include #include diff --git a/src/zm_utils.cpp b/src/zm_utils.cpp index 6ab97da14..507ace40f 100644 --- a/src/zm_utils.cpp +++ b/src/zm_utils.cpp @@ -17,16 +17,15 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -//#include "zm_logger.h" -#include "zm.h" #include "zm_utils.h" -#include +#include "zm_config.h" +#include "zm_logger.h" #include -#include -#include #include /* Definition of AT_* constants */ +#include #include + #if defined(__arm__) #include #endif diff --git a/src/zm_utils.h b/src/zm_utils.h index f3aabaca1..9e94cf578 100644 --- a/src/zm_utils.h +++ b/src/zm_utils.h @@ -23,7 +23,6 @@ #include #include #include -#include #include typedef std::vector StringVector; diff --git a/src/zm_video.cpp b/src/zm_video.cpp index 2d7033a84..c2a9e161e 100644 --- a/src/zm_video.cpp +++ b/src/zm_video.cpp @@ -13,13 +13,11 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // -#include "zm.h" + #include "zm_video.h" -#include "zm_image.h" -#include "zm_utils.h" -#include "zm_rgb.h" -#include + #include +#include #include VideoWriter::VideoWriter( diff --git a/src/zm_video.h b/src/zm_video.h index e185f82fc..89e5e33af 100644 --- a/src/zm_video.h +++ b/src/zm_video.h @@ -16,11 +16,8 @@ #ifndef ZM_VIDEO_H #define ZM_VIDEO_H -#include "zm.h" -#include "zm_rgb.h" -#include "zm_utils.h" -#include "zm_ffmpeg.h" #include "zm_buffer.h" +#include "zm_config.h" #include "zm_swscale.h" /* diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index 979a2e4dc..6691f670d 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -19,11 +19,11 @@ // #define __STDC_FORMAT_MACROS 1 - - -#include "zm.h" #include "zm_videostore.h" +#include "zm_logger.h" +#include "zm_monitor.h" + extern "C" { #include "libavutil/time.h" } diff --git a/src/zm_videostore.h b/src/zm_videostore.h index 067f552d6..32083d6b8 100644 --- a/src/zm_videostore.h +++ b/src/zm_videostore.h @@ -1,7 +1,10 @@ #ifndef ZM_VIDEOSTORE_H #define ZM_VIDEOSTORE_H +#include "zm_config.h" #include "zm_ffmpeg.h" +#include "zm_swscale.h" + extern "C" { #ifdef HAVE_LIBSWRESAMPLE #include "libswresample/swresample.h" @@ -15,11 +18,9 @@ extern "C" { #if HAVE_LIBAVCODEC -class VideoStore; -#include "zm_monitor.h" -#include "zm_packet.h" -#include "zm_packetqueue.h" -#include "zm_swscale.h" +class Monitor; +class ZMPacket; +class PacketQueue; class VideoStore { private: diff --git a/src/zm_zone.cpp b/src/zm_zone.cpp index a057684ae..36ecb5ebe 100644 --- a/src/zm_zone.cpp +++ b/src/zm_zone.cpp @@ -18,13 +18,10 @@ // #define __STDC_FORMAT_MACROS 1 -#include "zm.h" -#include "zm_db.h" #include "zm_zone.h" -#include "zm_image.h" -#include "zm_monitor.h" -#include "zm_fifo.h" +#include "zm_fifo.h" +#include "zm_monitor.h" void Zone::Setup( Monitor *p_monitor, diff --git a/src/zm_zone.h b/src/zm_zone.h index 7d7797725..7505396d8 100644 --- a/src/zm_zone.h +++ b/src/zm_zone.h @@ -20,12 +20,14 @@ #ifndef ZM_ZONE_H #define ZM_ZONE_H -#include "zm_rgb.h" +#include "zm_box.h" #include "zm_coord.h" +#include "zm_config.h" #include "zm_poly.h" -#include "zm_image.h" -#include "zm_event.h" +#include "zm_rgb.h" +class Event; +class Image; class Monitor; // diff --git a/src/zmc.cpp b/src/zmc.cpp index c09c8d325..b7014d62e 100644 --- a/src/zmc.cpp +++ b/src/zmc.cpp @@ -53,8 +53,17 @@ possible, this should run at more or less constant speed. */ +#include "zm.h" +#include "zm_analysis_thread.h" +#include "zm_camera.h" +#include "zm_db.h" +#include "zm_monitor.h" +#include "zm_rtsp_server_thread.h" +#include "zm_signal.h" +#include "zm_time.h" #include -#include +#include + #if defined(__FreeBSD__) #include #else @@ -65,14 +74,6 @@ possible, this should run at more or less constant speed. #define MAXINT INT_MAX #endif -#include "zm.h" -#include "zm_db.h" -#include "zm_time.h" -#include "zm_signal.h" -#include "zm_monitor.h" -#include "zm_analysis_thread.h" -#include "zm_rtsp_server_thread.h" - void Usage() { fprintf(stderr, "zmc -d or -r -H -P -p or -f or -m \n"); diff --git a/src/zms.cpp b/src/zms.cpp index 87b63552e..d7a9cc04a 100644 --- a/src/zms.cpp +++ b/src/zms.cpp @@ -17,16 +17,14 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -#include - #include "zm.h" #include "zm_db.h" #include "zm_user.h" #include "zm_signal.h" -#include "zm_monitor.h" #include "zm_monitorstream.h" #include "zm_eventstream.h" #include "zm_fifo.h" +#include bool ValidateAccess(User *user, int mon_id) { bool allowed = true; diff --git a/src/zmu.cpp b/src/zmu.cpp index dd14aacb8..32b9ad001 100644 --- a/src/zmu.cpp +++ b/src/zmu.cpp @@ -86,14 +86,13 @@ Options for use with monitors: */ -#include - #include "zm.h" #include "zm_db.h" #include "zm_user.h" #include "zm_signal.h" #include "zm_monitor.h" #include "zm_local_camera.h" +#include void Usage(int status=-1) { fputs( From 8869bfd9032870ec2fa3acd30bf5545db71d2963 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Thu, 4 Feb 2021 04:48:38 +0100 Subject: [PATCH 3/6] Gut out zm.h since it is used only to store the self variable --- src/zm.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/zm.h b/src/zm.h index 521a37d4c..46d6edf08 100644 --- a/src/zm.h +++ b/src/zm.h @@ -21,18 +21,6 @@ #ifndef ZM_H #define ZM_H -#include "zm_config.h" -#include "zm_define.h" -#include "zm_logger.h" -#include "zm_signal.h" - -#include - -#ifdef SOLARIS -#undef DEFAULT_TYPE // pthread defines this which breaks StreamType DEFAULT_TYPE -#include // define strerror() and friends -#endif - extern const char *self; #endif // ZM_H From 22372b51176090014bf478227a39b128ad051d25 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Thu, 4 Feb 2021 04:59:03 +0100 Subject: [PATCH 4/6] Replace #pragama once with include guards to be consistent --- src/zm_rtsp_server_adts_source.cpp | 2 +- src/zm_rtsp_server_adts_source.h | 12 ++++++------ src/zm_rtsp_server_device_source.cpp | 3 +-- src/zm_rtsp_server_device_source.h | 11 +++++------ src/zm_rtsp_server_frame.h | 8 +++++--- src/zm_rtsp_server_h264_device_source.cpp | 3 +-- src/zm_rtsp_server_h264_device_source.h | 11 +++++++---- src/zm_rtsp_server_server_media_subsession.cpp | 2 +- src/zm_rtsp_server_server_media_subsession.h | 8 +++++--- src/zm_rtsp_server_thread.cpp | 2 +- src/zm_rtsp_server_thread.h | 5 ++--- ...m_rtsp_server_unicast_server_media_subsession.cpp | 3 +-- src/zm_rtsp_server_unicast_server_media_subsession.h | 7 ++++++- 13 files changed, 42 insertions(+), 35 deletions(-) diff --git a/src/zm_rtsp_server_adts_source.cpp b/src/zm_rtsp_server_adts_source.cpp index 29ef7ca46..723d17001 100644 --- a/src/zm_rtsp_server_adts_source.cpp +++ b/src/zm_rtsp_server_adts_source.cpp @@ -45,4 +45,4 @@ ADTS_ZoneMinderDeviceSource::ADTS_ZoneMinderDeviceSource( << "\r\n"; m_auxLine.assign(os.str()); } -#endif +#endif // HAVE_RTSP_SERVER diff --git a/src/zm_rtsp_server_adts_source.h b/src/zm_rtsp_server_adts_source.h index a3f7a3494..e4292d9a0 100644 --- a/src/zm_rtsp_server_adts_source.h +++ b/src/zm_rtsp_server_adts_source.h @@ -9,14 +9,13 @@ ** ** -------------------------------------------------------------------------*/ +#ifndef ZM_RTSP_SERVER_ADTS_SOURCE_H +#define ZM_RTSP_SERVER_ADTS_SOURCE_H + #include "zm_config.h" #include "zm_rtsp_server_device_source.h" #if HAVE_RTSP_SERVER - -#ifndef ADTS_ZoneMinder_DEVICE_SOURCE -#define ADTS_ZoneMinder_DEVICE_SOURCE - // --------------------------------- // ADTS(AAC) ZoneMinder FramedSource // --------------------------------- @@ -64,5 +63,6 @@ class ADTS_ZoneMinderDeviceSource : public ZoneMinderDeviceSource { int samplingFrequencyIndex; int channels; }; -#endif -#endif +#endif // HAVE_RTSP_SERVER + +#endif // ZM_RTSP_SERVER_ADTS_SOURCE_H diff --git a/src/zm_rtsp_server_device_source.cpp b/src/zm_rtsp_server_device_source.cpp index 4b867490c..0616f8410 100644 --- a/src/zm_rtsp_server_device_source.cpp +++ b/src/zm_rtsp_server_device_source.cpp @@ -16,7 +16,6 @@ #include "zm_signal.h" #if HAVE_RTSP_SERVER - ZoneMinderDeviceSource::ZoneMinderDeviceSource( UsageEnvironment& env, Monitor* monitor, @@ -215,4 +214,4 @@ unsigned char* ZoneMinderDeviceSource::extractFrame(unsigned char* frame, size_ size = 0; return frame; } -#endif +#endif // HAVE_RTSP_SERVER diff --git a/src/zm_rtsp_server_device_source.h b/src/zm_rtsp_server_device_source.h index 72704bb0a..8c2982495 100644 --- a/src/zm_rtsp_server_device_source.h +++ b/src/zm_rtsp_server_device_source.h @@ -6,6 +6,9 @@ ** ** -------------------------------------------------------------------------*/ +#ifndef ZM_RTSP_SERVER_DEVICE_SOURCE_H +#define ZM_RTSP_SERVER_DEVICE_SOURCE_H + #include "zm_config.h" #include "zm_monitor.h" #include @@ -13,10 +16,6 @@ #include #if HAVE_RTSP_SERVER - -#ifndef DEVICE_SOURCE -#define DEVICE_SOURCE - #include class NAL_Frame; @@ -73,6 +72,6 @@ class ZoneMinderDeviceSource: public FramedSource { std::string m_auxLine; int stop; }; +#endif // HAVE_RTSP_SERVER -#endif -#endif +#endif // ZM_RTSP_SERVER_DEVICE_SOURCE_H diff --git a/src/zm_rtsp_server_frame.h b/src/zm_rtsp_server_frame.h index 346696dfb..4afa31958 100644 --- a/src/zm_rtsp_server_frame.h +++ b/src/zm_rtsp_server_frame.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef ZM_RTSP_SERVER_FRAME_H +#define ZM_RTSP_SERVER_FRAME_H #include "zm_config.h" #include "zm_logger.h" @@ -6,7 +7,6 @@ #include #if HAVE_RTSP_SERVER - // --------------------------------- // Captured frame // --------------------------------- @@ -61,4 +61,6 @@ class NAL_Frame { private: int m_ref_count; }; -#endif +#endif // HAVE_RTSP_SERVER + +#endif // ZM_RTSP_SERVER_FRAME_H \ No newline at end of file diff --git a/src/zm_rtsp_server_h264_device_source.cpp b/src/zm_rtsp_server_h264_device_source.cpp index a4acd66ef..0a312efe3 100644 --- a/src/zm_rtsp_server_h264_device_source.cpp +++ b/src/zm_rtsp_server_h264_device_source.cpp @@ -15,7 +15,6 @@ #include #if HAVE_RTSP_SERVER - // live555 #include @@ -227,4 +226,4 @@ unsigned char* H26X_ZoneMinderDeviceSource::extractFrame(unsigned char* frame, return outFrame; } -#endif +#endif // HAVE_RTSP_SERVER diff --git a/src/zm_rtsp_server_h264_device_source.h b/src/zm_rtsp_server_h264_device_source.h index e6fde341c..a2ef81b52 100644 --- a/src/zm_rtsp_server_h264_device_source.h +++ b/src/zm_rtsp_server_h264_device_source.h @@ -9,15 +9,16 @@ ** ** -------------------------------------------------------------------------*/ -#ifndef H264_ZoneMinder_DEVICE_SOURCE -#define H264_ZoneMinder_DEVICE_SOURCE +#ifndef ZM_RTSP_H264_DEVICE_SOURCE_H +#define ZM_RTSP_H264_DEVICE_SOURCE_H +#include "zm_config.h" #include "zm_rtsp_server_device_source.h" // --------------------------------- // H264 ZoneMinder FramedSource // --------------------------------- - +#if HAVE_RTSP_SERVER class H26X_ZoneMinderDeviceSource : public ZoneMinderDeviceSource { protected: H26X_ZoneMinderDeviceSource( @@ -98,4 +99,6 @@ class H265_ZoneMinderDeviceSource : public H26X_ZoneMinderDeviceSource { protected: std::string m_vps; }; -#endif +#endif // HAVE_RTSP_SERVER + +#endif // ZM_RTSP_H264_DEVICE_SOURCE_H diff --git a/src/zm_rtsp_server_server_media_subsession.cpp b/src/zm_rtsp_server_server_media_subsession.cpp index 6793a7a53..72702c02d 100644 --- a/src/zm_rtsp_server_server_media_subsession.cpp +++ b/src/zm_rtsp_server_server_media_subsession.cpp @@ -104,4 +104,4 @@ char const* BaseServerMediaSubsession::getAuxLine( } return auxLine; } -#endif +#endif // HAVE_RTSP_SERVER diff --git a/src/zm_rtsp_server_server_media_subsession.h b/src/zm_rtsp_server_server_media_subsession.h index 2cd85dd5b..4b6166b44 100644 --- a/src/zm_rtsp_server_server_media_subsession.h +++ b/src/zm_rtsp_server_server_media_subsession.h @@ -7,13 +7,13 @@ ** ** -------------------------------------------------------------------------*/ -#pragma once +#ifndef ZM_RTSP_SERVER_SERVER_MEDIA_SUBSESSION_H +#define ZM_RTSP_SERVER_SERVER_MEDIA_SUBSESSION_H #include "zm_config.h" #include #if HAVE_RTSP_SERVER - #include class ZoneMinderDeviceSource; @@ -42,4 +42,6 @@ class BaseServerMediaSubsession { protected: StreamReplicator* m_replicator; }; -#endif +#endif // HAVE_RTSP_SERVER + +#endif // ZM_RTSP_SERVER_SERVER_MEDIA_SUBSESSION_H diff --git a/src/zm_rtsp_server_thread.cpp b/src/zm_rtsp_server_thread.cpp index 8c70a375e..891363510 100644 --- a/src/zm_rtsp_server_thread.cpp +++ b/src/zm_rtsp_server_thread.cpp @@ -154,4 +154,4 @@ const std::string RTSPServerThread::getRtpFormat(AVCodecID codec_id, bool muxTS) return ""; } -#endif +#endif // HAVE_RTSP_SERVER diff --git a/src/zm_rtsp_server_thread.h b/src/zm_rtsp_server_thread.h index 0a94d63c7..e3f19554e 100644 --- a/src/zm_rtsp_server_thread.h +++ b/src/zm_rtsp_server_thread.h @@ -7,7 +7,6 @@ #include #if HAVE_RTSP_SERVER - #include #include @@ -39,6 +38,6 @@ class RTSPServerThread : public Thread { const std::list & subSession ); }; +#endif // HAVE_RTSP_SERVER -#endif -#endif +#endif // ZM_RTSP_SERVER_THREAD_H diff --git a/src/zm_rtsp_server_unicast_server_media_subsession.cpp b/src/zm_rtsp_server_unicast_server_media_subsession.cpp index 94ed06903..0b5566860 100644 --- a/src/zm_rtsp_server_unicast_server_media_subsession.cpp +++ b/src/zm_rtsp_server_unicast_server_media_subsession.cpp @@ -13,7 +13,6 @@ #include "zm_rtsp_server_device_source.h" #if HAVE_RTSP_SERVER - // ----------------------------------------- // ServerMediaSubsession for Unicast // ----------------------------------------- @@ -48,4 +47,4 @@ char const* UnicastServerMediaSubsession::getAuxSDPLine( ) { return this->getAuxLine(dynamic_cast(m_replicator->inputSource()), rtpSink->rtpPayloadType()); } -#endif +#endif // HAVE_RTSP_SERVER diff --git a/src/zm_rtsp_server_unicast_server_media_subsession.h b/src/zm_rtsp_server_unicast_server_media_subsession.h index 817b18f27..d10e3abf1 100644 --- a/src/zm_rtsp_server_unicast_server_media_subsession.h +++ b/src/zm_rtsp_server_unicast_server_media_subsession.h @@ -7,7 +7,8 @@ ** ** -------------------------------------------------------------------------*/ -#pragma once +#ifndef ZM_RTSP_SERVER_UNICAST_SERVER_MEDIA_SUBSESSION_H +#define ZM_RTSP_SERVER_UNICAST_SERVER_MEDIA_SUBSESSION_H #include "zm_config.h" #include "zm_rtsp_server_server_media_subsession.h" @@ -15,6 +16,7 @@ // ----------------------------------------- // ServerMediaSubsession for Unicast // ----------------------------------------- +#if HAVE_RTSP_SERVER class UnicastServerMediaSubsession : public OnDemandServerMediaSubsession, public BaseServerMediaSubsession @@ -44,3 +46,6 @@ class UnicastServerMediaSubsession : protected: const std::string m_format; }; +#endif // HAVE_RTSP_SERVER + +#endif // ZM_RTSP_SERVER_UNICAST_SERVER_MEDIA_SUBSESSION_H From 21fdb1f345b4a84e72f60411ae0dc6056002c02f Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Thu, 4 Feb 2021 05:35:08 +0100 Subject: [PATCH 5/6] Build: Add libLive555 to optlibsnotfound if not found --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ff2cb7d2..5ac360113 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -670,7 +670,7 @@ if(NOT ZM_NO_RTSPSERVER) set(optlibsfound "${optlibsfound} libLive555") else(Live555_FOUND) set(HAVE_RTSP_SERVER 0) - set(optlibsfound "${optlibsnotfound} libLive555") + set(optlibsnotfound "${optlibsnotfound} libLive555") endif(Live555_FOUND) else(NOT ZM_NO_RTSPSERVER) set(HAVE_RTSP_SERVER 0) From eef0da8f195ced54604ed357b7d19b68bd165bb2 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Thu, 4 Feb 2021 17:24:18 +0100 Subject: [PATCH 6/6] Remove references to from AnalysisThread The removed block_set member was unused. --- src/zm_analysis_thread.cpp | 1 - src/zm_analysis_thread.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/zm_analysis_thread.cpp b/src/zm_analysis_thread.cpp index 7e94313b2..8ad67b6ce 100644 --- a/src/zm_analysis_thread.cpp +++ b/src/zm_analysis_thread.cpp @@ -5,7 +5,6 @@ AnalysisThread::AnalysisThread(Monitor *p_monitor) { monitor = p_monitor; terminate = false; - //sigemptyset(&block_set); } AnalysisThread::~AnalysisThread() { diff --git a/src/zm_analysis_thread.h b/src/zm_analysis_thread.h index 085e9bd3a..1adeac3a8 100644 --- a/src/zm_analysis_thread.h +++ b/src/zm_analysis_thread.h @@ -3,12 +3,10 @@ #include "zm_monitor.h" #include "zm_thread.h" -#include class AnalysisThread : public Thread { private: bool terminate; - sigset_t block_set; Monitor *monitor; public: