From 0625f6ca1cdb5ccce13127710ea6e548ddc13d49 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Sat, 5 Jun 2021 14:37:52 +0200 Subject: [PATCH] Misc: Cleanup some includes --- src/zm_eventstream.h | 10 +++------- src/zm_ffmpeg.cpp | 2 +- src/zm_ffmpeg.h | 6 ------ src/zm_ffmpeg_camera.cpp | 6 +++--- src/zm_ffmpeg_input.h | 12 +++--------- src/zm_ffmpeg_output.h | 12 +++--------- src/zm_sendfile.h | 10 +--------- src/zm_videostore.cpp | 2 +- 8 files changed, 15 insertions(+), 45 deletions(-) diff --git a/src/zm_eventstream.h b/src/zm_eventstream.h index 54b7687ab..4592e97e7 100644 --- a/src/zm_eventstream.h +++ b/src/zm_eventstream.h @@ -26,15 +26,11 @@ #include "zm_storage.h" #include "zm_stream.h" -#ifdef __cplusplus extern "C" { -#endif -#include "libavformat/avformat.h" -#include "libavformat/avio.h" -#include "libavcodec/avcodec.h" -#ifdef __cplusplus +#include +#include +#include } -#endif class EventStream : public StreamBase { public: diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index 431f64c33..955d7f91d 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -24,7 +24,7 @@ #include "zm_utils.h" extern "C" { -#include "libavutil/pixdesc.h" +#include } void log_libav_callback(void *ptr, int level, const char *fmt, va_list vargs) { diff --git a/src/zm_ffmpeg.h b/src/zm_ffmpeg.h index 93a5a286d..84cfa342d 100644 --- a/src/zm_ffmpeg.h +++ b/src/zm_ffmpeg.h @@ -148,9 +148,7 @@ extern "C" { ( (LIBSWSCALE_VERSION_MICRO < 100 && LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \ (LIBSWSCALE_VERSION_MICRO >= 100 && LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(a, d, e) ) ) -#ifdef __cplusplus } -#endif #if !LIBAVFORMAT_VERSION_CHECK(52, 107, 0, 107, 0) #if defined(AVIO_WRONLY) @@ -197,8 +195,6 @@ enum _AVPIXELFORMAT GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subp * C++ friendly version of av_err2str taken from http://libav-users.943685.n4.nabble.com/Libav-user-g-4-7-2-fails-to-compile-av-err2str-td4656417.html. * Newer g++ versions fail with "error: taking address of temporary array" when using native libav version. */ -#ifdef __cplusplus - inline static const std::string av_make_error_string(int errnum) { static char errbuf[AV_ERROR_MAX_STRING_SIZE]; #if LIBAVUTIL_VERSION_CHECK(50, 13, 0, 13, 0) @@ -220,8 +216,6 @@ enum _AVPIXELFORMAT GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subp int flags); #endif -#endif // __cplusplus - #ifndef av_rescale_delta /** * Rescale a timestamp while preserving known durations. diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index 04a39a1b3..f98d3e090 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -26,12 +26,12 @@ #include "zm_utils.h" extern "C" { -#include "libavutil/time.h" +#include #if HAVE_LIBAVUTIL_HWCONTEXT_H - #include "libavutil/hwcontext.h" + #include #endif -#include "libavutil/pixdesc.h" +#include } #include diff --git a/src/zm_ffmpeg_input.h b/src/zm_ffmpeg_input.h index 5ca5f07dc..6ccc87682 100644 --- a/src/zm_ffmpeg_input.h +++ b/src/zm_ffmpeg_input.h @@ -3,17 +3,11 @@ #include "zm_define.h" -#ifdef __cplusplus extern "C" { -#endif - -#include "libavformat/avformat.h" -#include "libavformat/avio.h" -#include "libavcodec/avcodec.h" - -#ifdef __cplusplus +#include +#include +#include } -#endif class FFmpeg_Input { diff --git a/src/zm_ffmpeg_output.h b/src/zm_ffmpeg_output.h index 76afad0d7..9ab4ea403 100644 --- a/src/zm_ffmpeg_output.h +++ b/src/zm_ffmpeg_output.h @@ -1,17 +1,11 @@ #ifndef ZM_FFMPEG_INPUT_H #define ZM_FFMPEG_INPUT_H -#ifdef __cplusplus extern "C" { -#endif - -#include "libavformat/avformat.h" -#include "libavformat/avio.h" -#include "libavcodec/avcodec.h" - -#ifdef __cplusplus +#include +#include +#include } -#endif class FFmpeg_Output { diff --git a/src/zm_sendfile.h b/src/zm_sendfile.h index 593a94833..fd72e2e61 100644 --- a/src/zm_sendfile.h +++ b/src/zm_sendfile.h @@ -1,10 +1,6 @@ #ifndef ZM_SENDFILE_H #define ZM_SENDFILE_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef HAVE_SENDFILE4_SUPPORT #include int zm_sendfile(int out_fd, int in_fd, off_t *offset, size_t size) { @@ -37,8 +33,4 @@ int zm_sendfile(int out_fd, int in_fd, off_t *offset, off_t size) { #error "Your platform does not support sendfile. Sorry." #endif -#ifdef __cplusplus -} -#endif - -#endif +#endif // ZM_SENDFILE_H diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index af2ba8444..c7f7aa3ef 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -24,7 +24,7 @@ #include "zm_monitor.h" extern "C" { -#include "libavutil/time.h" +#include } /*