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
This commit is contained in:
Peter Keresztes Schmidt 2021-02-04 04:47:28 +01:00
parent 5a57efdfe2
commit 0dbc39ee25
123 changed files with 376 additions and 574 deletions

View File

@ -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 <iostream>
#ifdef SOLARIS
#undef DEFAULT_TYPE // pthread defines this which breaks StreamType DEFAULT_TYPE
#include <string.h> // define strerror() and friends
#endif
#include "zm_logger.h"
#include <iostream>
extern const char *self;

View File

@ -1,5 +1,7 @@
#include "zm_analysis_thread.h"
#include "zm_signal.h"
AnalysisThread::AnalysisThread(Monitor *p_monitor) {
monitor = p_monitor;
terminate = false;

View File

@ -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 <csignal>
class AnalysisThread : public Thread {

View File

@ -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

View File

@ -20,7 +20,6 @@
#ifndef ZM_BOX_H
#define ZM_BOX_H
#include "zm.h"
#include "zm_coord.h"
#include <cmath>

View File

@ -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) {

View File

@ -20,7 +20,7 @@
#ifndef ZM_BUFFER_H
#define ZM_BUFFER_H
#include "zm.h"
#include "zm_logger.h"
#include <cstring>
class Buffer

View File

@ -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,

View File

@ -20,15 +20,12 @@
#ifndef ZM_CAMERA_H
#define ZM_CAMERA_H
#include <sys/types.h>
#include <sys/ioctl.h>
#include "zm_image.h"
#include "zm_packet.h"
#include <sys/ioctl.h>
#include <sys/types.h>
class Camera;
#include "zm_monitor.h"
class Monitor;
class ZMPacket;
//
// Abstract base class for cameras. This is intended just to express

View File

@ -18,17 +18,17 @@
//
#include "zm_comms.h"
#include "zm_logger.h"
#include "zm_logger.h"
#include <arpa/inet.h> // for debug output
#include <cerrno>
#include <fcntl.h>
#include <cstdarg>
#include <utility>
#include <cstdio> // for snprintf
#include <fcntl.h>
#include <netinet/tcp.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <netinet/tcp.h>
#include <arpa/inet.h> // for debug output
#include <cstdio> // for snprintf
#include <utility>
#ifdef SOLARIS
#include <sys/filio.h> // define FIONREAD

View File

@ -20,15 +20,13 @@
#ifndef ZM_COMMS_H
#define ZM_COMMS_H
#include "zm_logger.h"
#include "zm_exception.h"
#include <unistd.h>
#include "zm_logger.h"
#include <netdb.h>
#include <sys/un.h>
#include <set>
#include <vector>
#include <sys/uio.h>
#include <sys/un.h>
#include <vector>
#if defined(BSD)
#include <sys/socket.h>

View File

@ -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 <cstring>
#include <dirent.h>
#include <glob.h>
#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.

View File

@ -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 <string>
#if !defined(PATH_MAX)
#define PATH_MAX 1024
#endif
#include "config.h"
#include "zm_config_defines.h"
#include "zm_config_data.h"
#include <string>
#ifdef HAVE_LIBAVFORMAT
#define ZM_HAS_FFMPEG 1
#endif // HAVE_LIBAVFORMAT

View File

@ -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

View File

@ -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

View File

@ -1,12 +1,15 @@
#include "zm.h"
#include "zm_crypt.h"
#include "zm_logger.h"
#include "BCrypt.hpp"
#include <algorithm>
#if HAVE_LIBJWT
#include <jwt.h>
#else
#include "jwt_cpp.h"
#endif
#include <algorithm>
#if HAVE_LIBCRYPTO
#include <openssl/sha.h>
#elif HAVE_GNUTLS_GNUTLS_H

View File

@ -17,12 +17,10 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#include <dlfcn.h>
#include "zm.h"
#include "zm_curl_camera.h"
#include "zm_packetqueue.h"
#include "zm_packet.h"
#include <dlfcn.h>
#if HAVE_LIBCURL

View File

@ -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 <string>
#include "zm_camera.h"
#include <deque>
#include <string>
#if HAVE_LIBCURL
#if HAVE_CURL_CURL_H
#include <curl/curl.h>

View File

@ -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 <cstdlib>
#include "zm.h"
#include "zm_db.h"
#include "zm_logger.h"
#include <cstdlib>
MYSQL dbconn;
RecursiveMutex db_mutex;

View File

@ -20,8 +20,8 @@
#ifndef ZM_DB_H
#define ZM_DB_H
#include <mysql/mysql.h>
#include "zm_thread.h"
#include <mysql/mysql.h>
class zmDbRow {
private:

View File

@ -17,21 +17,17 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#include <fcntl.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <sys/uio.h>
#include <getopt.h>
#include <arpa/inet.h>
#include <glob.h>
#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 <cstring>
#include <sys/stat.h>
//#define USE_PREPARED_SQL 1

View File

@ -20,38 +20,23 @@
#ifndef ZM_EVENT_H
#define ZM_EVENT_H
#include <cstdlib>
#include <unistd.h>
#include <cerrno>
#include <climits>
#include <ctime>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <mysql/mysql.h>
#include <set>
#include "zm_storage.h"
#include <map>
#include <queue>
#include <string>
#include <set>
#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.

View File

@ -17,18 +17,16 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
//
#include <arpa/inet.h>
#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 <arpa/inet.h>
#include <sys/stat.h>
const std::string EventStream::StreamMode_Strings[4] = {
"None",

View File

@ -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;

View File

@ -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"
}

View File

@ -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 <string>
#include <locale>
#if HAVE_LIBAVUTIL_HWCONTEXT_H
#if LIBAVCODEC_VERSION_CHECK(57, 89, 0, 89, 0)

View File

@ -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;

View File

@ -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;

View File

@ -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 <fcntl.h>
#include <sys/file.h>
#include <cstdio>
#include <cstdarg>
#include <csignal>
#include <sys/stat.h>
#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;

View File

@ -19,23 +19,10 @@
#ifndef ZM_FIFO_H
#define ZM_FIFO_H
#if 0
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <limits.h>
#include <time.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
#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);\
}

View File

@ -17,14 +17,11 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#include <unistd.h>
#include <ctime>
#include <cerrno>
#include <sys/stat.h>
#include "zm.h"
#include "zm_file_camera.h"
#include "zm_packet.h"
#include <sys/stat.h>
FileCamera::FileCamera(
int p_id,
const char *p_path,

View File

@ -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 <sys/param.h>
//
// Class representing 'file' cameras, i.e. those which are

View File

@ -1,11 +1,8 @@
#include <cstdio>
#include "zm_font.h"
#include <cstring>
#include <sys/stat.h>
#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

View File

@ -2,7 +2,6 @@
#define ZM_FONT_H
#include "zm_define.h"
#include <string>
#define NUM_FONT_SIZES 4

View File

@ -20,12 +20,15 @@
#ifndef ZM_FRAME_H
#define ZM_FRAME_H
#include <sys/time.h>
#include <sys/types.h>
class Frame;
#include "zm_event.h"
#include "zm_time.h"
#include <sys/time.h>
enum FrameType {
NORMAL = 0,
BULK,
ALARM
};
//
// This describes a frame record

View File

@ -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 <cstring>
#include <cstdlib>
Group::Group() {
Warning("Instantiating default Group Object. Should not happen.");

View File

@ -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:

View File

@ -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 <fcntl.h>
#include <sys/stat.h>
#include <cerrno>
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};

View File

@ -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 <cerrno>
#include "zm_jpeg.h"
#include "zm_logger.h"
#include "zm_mem_utils.h"
#include "zm_rgb.h"
#if HAVE_ZLIB_H
#include <zlib.h>
#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

View File

@ -18,9 +18,8 @@
*/
#include "zm_jpeg.h"
#include "zm_logger.h"
#include <unistd.h>
#include "zm_logger.h"
/* Overridden error handlers, mostly for decompression */
extern "C" {

View File

@ -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 <setjmp.h>
*/
#include "jerror.h"
#include "jinclude.h"
#include "jpeglib.h"
#include "jerror.h"
#include <csetjmp>
// Stop complaints about deuplicate definitions
#undef HAVE_STDLIB_H

View File

@ -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 <dlfcn.h>
#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 <dlfcn.h>
#if HAVE_LIBVLC
static void *libvlc_lib = nullptr;
static void (*libvlc_media_player_release_f)(libvlc_media_player_t* ) = nullptr;

View File

@ -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"

View File

@ -1,8 +1,7 @@
#include <dlfcn.h>
#include "zm.h"
#include "zm_signal.h"
#include "zm_libvnc_camera.h"
#include "zm_swscale.h"
#include "zm_packet.h"
#include <dlfcn.h>
#if HAVE_LIBVNC

View File

@ -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

View File

@ -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 <sys/types.h>
#include <sys/stat.h>
#include "zm_packet.h"
#include "zm_utils.h"
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <errno.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/stat.h>
#if ZM_HAS_V4L
/* Workaround for GNU/kFreeBSD and FreeBSD */
#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)

View File

@ -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

View File

@ -19,24 +19,18 @@
#include "zm_logger.h"
#include "zm_config.h"
#include "zm_utils.h"
#include "zm_db.h"
#include <unistd.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <syslog.h>
#include "zm_utils.h"
#include <csignal>
#include <cstdarg>
#include <cerrno>
#include <cstring>
#include <libgen.h>
#include <syslog.h>
#include <sys/time.h>
#ifdef __FreeBSD__
#include <sys/thr.h>
#endif
#include <cstdarg>
bool Logger::smInitialised = false;
Logger *Logger::smInstance = nullptr;

View File

@ -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 <unistd.h>
#include <string>
#include <map>
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif // HAVE_SYS_SYSCALL_H
#include <mysql/mysql.h>
class Logger {
public:

View File

@ -21,7 +21,6 @@
#define ZM_MEM_UTILS_H
#include <cstdlib>
#include "zm.h"
inline void* zm_mallocaligned(unsigned int reqalignment, size_t reqsize) {
uint8_t* retptr;

View File

@ -17,43 +17,46 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#include <sys/types.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include <glob.h>
#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 <sys/types.h>
#include <sys/stat.h>
#if ZM_MEM_MAPPED
#include <sys/mman.h>
#include <fcntl.h>

View File

@ -20,30 +20,16 @@
#ifndef ZM_MONITOR_H
#define ZM_MONITOR_H
#include <vector>
#include <sstream>
#include <thread>
#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 <sys/time.h>
#include <vector>
class Camera;
class Group;
#define SIGNAL_CAUSE "Signal"
#define MOTION_CAUSE "Motion"

View File

@ -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 <arpa/inet.h>
#include <glob.h>
#include <sys/stat.h>
const int MAX_SLEEP_USEC = 1000000; // 1 sec

View File

@ -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 <sys/time.h>
class MonitorStream : public StreamBase {
protected:

View File

@ -17,13 +17,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <cstdlib>
#include <cstring>
#include "zm.h"
#include "zm_rgb.h"
#include "zm_mpeg.h"
#include "zm_logger.h"
#include "zm_rgb.h"
#include <cstring>
#if HAVE_LIBAVCODEC
extern "C" {
#include <libavutil/mathematics.h>

View File

@ -16,10 +16,11 @@
//You should have received a copy of the GNU General Public License
//along with ZoneMinder. If not, see <http://www.gnu.org/licenses/>.
#include "zm_packet.h"
#include "zm_ffmpeg.h"
#include "zm_ffmpeg.h"
#include "zm_image.h"
#include "zm_logger.h"
#include <sys/time.h>
using namespace std;

View File

@ -20,6 +20,9 @@
#ifndef ZM_PACKET_H
#define ZM_PACKET_H
#include "zm_logger.h"
#include <mutex>
extern "C" {
#include <libavformat/avformat.h>
}
@ -28,9 +31,7 @@ extern "C" {
#include <sys/time.h>
#endif // __FreeBSD__
#include "zm_image.h"
#include "zm_thread.h"
#include <mutex>
class Image;
class ZMPacket {
public:

View File

@ -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 <sys/time.h>
#include "zm_time.h"
PacketQueue::PacketQueue():
video_stream_id(-1),

View File

@ -16,19 +16,15 @@
//You should have received a copy of the GNU General Public License
//along with ZoneMinder. If not, see <http://www.gnu.org/licenses/>.
#ifndef ZM_PACKETQUEUE_H
#define ZM_PACKETQUEUE_H
#include <list>
#include "zm_packet.h"
#include "zm_thread.h"
#include <mutex>
#include <condition_variable>
#include <list>
#include <mutex>
class ZMPacket;
extern "C" {
#include <libavformat/avformat.h>
}
typedef std::list<ZMPacket *>::iterator packetqueue_iterator;
class PacketQueue {

View File

@ -17,7 +17,6 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#include "zm.h"
#include "zm_poly.h"
#include <cmath>

View File

@ -20,11 +20,9 @@
#ifndef ZM_POLY_H
#define ZM_POLY_H
#include "zm.h"
#include "zm_coord.h"
#include "zm_box.h"
#include <cmath>
class Coord;
//
// Class used for storing a box, which is defined as a region

View File

@ -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 <cstring>
#include "zm.h"
#include "zm_regexp.h"
#include "zm_logger.h"
#include <cstring>
#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 )

View File

@ -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

View File

@ -20,6 +20,8 @@
#include "zm_remote_camera.h"
#include "zm_utils.h"
#include <arpa/inet.h>
#include <netdb.h>
RemoteCamera::RemoteCamera(
unsigned int p_monitor_id,

View File

@ -22,12 +22,7 @@
#include "zm_camera.h"
#include "zm_rtsp_auth.h"
#include <string>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#define SOCKET_BUF_SIZE 8192

View File

@ -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 <sys/types.h>
#include <sys/socket.h>
#include <cerrno>
#include "zm_regexp.h"
#include "zm_utils.h"
#include <arpa/inet.h>
#include <netdb.h>
#ifdef SOLARIS

View File

@ -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

View File

@ -19,12 +19,10 @@
#include "zm_remote_camera_nvsocket.h"
#include "zm_mem_utils.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <cerrno>
#include "zm_packet.h"
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#ifdef SOLARIS
#include <sys/filio.h> // FIONREAD and friends

View File

@ -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:

View File

@ -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 <sys/types.h>
#include <sys/socket.h>
RemoteCameraRtsp::RemoteCameraRtsp(
unsigned int p_monitor_id,
const std::string &p_method,

View File

@ -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

View File

@ -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

View File

@ -20,8 +20,6 @@
#ifndef ZM_RTP_H
#define ZM_RTP_H
#include "zm.h"
#define RTP_VERSION 2
#endif // ZM_RTP_H

View File

@ -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 <cerrno>
#if HAVE_LIBAVFORMAT
RtpCtrlThread::RtpCtrlThread( RtspThread &rtspThread, RtpSource &rtpSource )
: mRtspThread( rtspThread ), mRtpSource( rtpSource ), mStop( false )

View File

@ -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

View File

@ -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 <arpa/inet.h>
#if HAVE_LIBAVFORMAT
RtpDataThread::RtpDataThread(RtspThread &rtspThread, RtpSource &rtpSource) :
mRtspThread(rtspThread), mRtpSource(rtpSource), mStop(false)

View File

@ -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"

View File

@ -21,7 +21,7 @@
#include "zm_time.h"
#include "zm_rtp_data.h"
#include "zm_utils.h"
#include <arpa/inet.h>
#if HAVE_LIBAVCODEC

View File

@ -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 <sys/time.h>
#include <string>
#include <sys/time.h>
#if HAVE_LIBAVCODEC

View File

@ -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 <sys/time.h>
#include <signal.h>
#include <stdlib.h>
#include <errno.h>
#if HAVE_LIBAVFORMAT
int RtspThread::smMinDataPort = 0;
int RtspThread::smMaxDataPort = 0;

View File

@ -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 <set>
#include <map>
#include <set>
class RtspThread : public Thread {
public:

View File

@ -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 <cstdio>
#include "zm_logger.h"
#include "zm_utils.h"
#include <cstring>
namespace zm {

View File

@ -19,6 +19,9 @@
#ifndef ZM_RTSP_AUTH_H
#define ZM_RTSP_AUTH_H
#include "zm_config.h"
#include <string>
#if HAVE_GNUTLS_GNUTLS_H
#include <gnutls/gnutls.h>
#endif

View File

@ -6,17 +6,15 @@
**
** -------------------------------------------------------------------------*/
#include "zm.h"
#include "zm_rtsp_server_adts_source.h"
#include "zm_config.h"
#include <sstream>
#if HAVE_RTSP_SERVER
#include <sstream>
#include <iomanip>
// live555
#include <Base64.hh>
#include "zm_rtsp_server_adts_source.h"
static unsigned const samplingFrequencyTable[16] = {
96000, 88200, 64000, 48000,
44100, 32000, 24000, 22050,

View File

@ -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
// ---------------------------------

View File

@ -8,11 +8,13 @@
**
** -------------------------------------------------------------------------*/
#include <utility>
#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(

View File

@ -6,24 +6,20 @@
**
** -------------------------------------------------------------------------*/
#include "zm.h"
#include "zm_config.h"
#include "zm_monitor.h"
#include <list>
#include <string>
#include <utility>
#if HAVE_RTSP_SERVER
#ifndef DEVICE_SOURCE
#define DEVICE_SOURCE
#include <string>
#include <list>
#include <iostream>
#include <liveMedia.hh>
#include "zm_monitor.h"
#include "zm_rtsp_server_frame.h"
#include "zm_packetqueue.h"
#include <linux/types.h>
class NAL_Frame;
class ZoneMinderDeviceSource: public FramedSource {

View File

@ -1,11 +1,12 @@
#pragma once
#include "zm_config.h"
#include "zm_logger.h"
#include "zm.h"
#include <cstring>
#include <sys/time.h>
#if HAVE_RTSP_SERVER
#include <ctime>
#include <cstring>
// ---------------------------------
// Captured frame
// ---------------------------------

View File

@ -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 <iomanip>
#include <sstream>
#if HAVE_RTSP_SERVER
#include <sstream>
#include <iomanip>
// live555
#include <Base64.hh>
#include "zm_rtsp_server_h264_device_source.h"
// ---------------------------------
// H264 ZoneMinder FramedSource
// ---------------------------------

View File

@ -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

View File

@ -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 <sstream>
#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
// ---------------------------------

View File

@ -9,17 +9,11 @@
#pragma once
#include "zm.h"
#include "zm_config.h"
#include <string>
#if HAVE_RTSP_SERVER
#include <sys/stat.h>
#include <string>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <liveMedia.hh>
class ZoneMinderDeviceSource;

View File

@ -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 <StreamReplicator.hh>
RTSPServerThread::RTSPServerThread(Monitor *p_monitor) :

View File

@ -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 <csignal>
#include <list>
#include "zm_monitor.h"
#if HAVE_RTSP_SERVER
#include <BasicUsageEnvironment.hh>
#include <RTSPServer.hh>
#include "zm_ffmpeg.h"
class Monitor;
class RTSPServerThread : public Thread {
private:

View File

@ -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
// -----------------------------------------

View File

@ -9,6 +9,7 @@
#pragma once
#include "zm_config.h"
#include "zm_rtsp_server_server_media_subsession.h"
// -----------------------------------------

View File

@ -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 },

View File

@ -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 <cstdlib>
#include "zm_utils.h"
#include <string>
#include <vector>

View File

@ -17,12 +17,11 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#include "zm.h"
#include "zm_signal.h"
#include <cstdio>
#include "zm.h"
#include "zm_logger.h"
#include <cstring>
#include <cstdlib>
#define TRACE_SIZE 16

View File

@ -20,6 +20,7 @@
#ifndef ZM_SIGNAL_H
#define ZM_SIGNAL_H
#include "zm_config.h"
#include <csignal>
#if HAVE_EXECINFO_H
@ -29,9 +30,6 @@
#include <ucontext.h>
#endif
#include "zm.h"
typedef RETSIGTYPE (SigHandler)( int );
extern bool zm_reload;

Some files were not shown because too many files have changed in this diff Show More