Build: Promote libavutil to a required dependency
FFmpeg is an integral component of ZM. Promote the appropriate libraries to required dependencies. This reduces the possible build configurations greatly and thus maintenance burden.
This commit is contained in:
parent
70c626a30e
commit
1a6904a297
|
@ -469,18 +469,9 @@ else()
|
||||||
set(optlibsnotfound "${optlibsnotfound} AVDevice")
|
set(optlibsnotfound "${optlibsnotfound} AVDevice")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(FFMPEG COMPONENTS avutil)
|
find_package(FFMPEG REQUIRED COMPONENTS avutil)
|
||||||
if(FFMPEG_avutil_FOUND)
|
|
||||||
set(HAVE_LIBAVUTIL 1)
|
|
||||||
set(HAVE_LIBAVUTIL_AVUTIL_H 1)
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${FFMPEG_avutil_INCLUDE_DIRS})
|
set(CMAKE_REQUIRED_INCLUDES ${FFMPEG_avutil_INCLUDE_DIRS})
|
||||||
check_include_file("libavutil/mathematics.h" HAVE_LIBAVUTIL_MATHEMATICS_H)
|
|
||||||
check_include_file("libavutil/hwcontext.h" HAVE_LIBAVUTIL_HWCONTEXT_H)
|
check_include_file("libavutil/hwcontext.h" HAVE_LIBAVUTIL_HWCONTEXT_H)
|
||||||
list(APPEND ZM_BIN_LIBS "${FFMPEG_avutil_LIBRARIES}")
|
|
||||||
set(optlibsfound "${optlibsfound} AVUtil")
|
|
||||||
else()
|
|
||||||
set(optlibsnotfound "${optlibsnotfound} AVUtil")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(FFMPEG COMPONENTS swscale)
|
find_package(FFMPEG COMPONENTS swscale)
|
||||||
if(FFMPEG_swscale_FOUND)
|
if(FFMPEG_swscale_FOUND)
|
||||||
|
|
|
@ -77,6 +77,7 @@ target_include_directories(zm
|
||||||
|
|
||||||
target_link_libraries(zm
|
target_link_libraries(zm
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
FFMPEG::avutil
|
||||||
libbcrypt::bcrypt
|
libbcrypt::bcrypt
|
||||||
RtspServer::RtspServer
|
RtspServer::RtspServer
|
||||||
martinmoene::span-lite
|
martinmoene::span-lite
|
||||||
|
|
|
@ -27,8 +27,6 @@ extern "C" {
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_LIBAVCODEC || HAVE_LIBAVUTIL || HAVE_LIBSWSCALE
|
|
||||||
|
|
||||||
void log_libav_callback(void *ptr, int level, const char *fmt, va_list vargs) {
|
void log_libav_callback(void *ptr, int level, const char *fmt, va_list vargs) {
|
||||||
Logger *log = Logger::fetch();
|
Logger *log = Logger::fetch();
|
||||||
int log_level = 0;
|
int log_level = 0;
|
||||||
|
@ -100,7 +98,6 @@ void FFMPEGDeInit() {
|
||||||
bInit = false;
|
bInit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_LIBAVUTIL
|
|
||||||
enum _AVPIXELFORMAT GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder) {
|
enum _AVPIXELFORMAT GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder) {
|
||||||
enum _AVPIXELFORMAT pf;
|
enum _AVPIXELFORMAT pf;
|
||||||
|
|
||||||
|
@ -190,11 +187,8 @@ int av_dict_parse_string(AVDictionary **pm, const char *str,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif // HAVE_LIBAVUTIL
|
|
||||||
|
|
||||||
#endif // HAVE_LIBAVCODEC || HAVE_LIBAVUTIL || HAVE_LIBSWSCALE
|
|
||||||
|
|
||||||
#if HAVE_LIBAVUTIL
|
|
||||||
#if LIBAVUTIL_VERSION_CHECK(56, 0, 0, 17, 100)
|
#if LIBAVUTIL_VERSION_CHECK(56, 0, 0, 17, 100)
|
||||||
int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb){
|
int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb){
|
||||||
int64_t a, b, this_thing;
|
int64_t a, b, this_thing;
|
||||||
|
@ -219,7 +213,6 @@ simple_round:
|
||||||
return av_rescale_q(this_thing, fs_tb, out_tb);
|
return av_rescale_q(this_thing, fs_tb, out_tb);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
static void zm_log_fps(double d, const char *postfix) {
|
static void zm_log_fps(double d, const char *postfix) {
|
||||||
uint64_t v = lrintf(d * 100);
|
uint64_t v = lrintf(d * 100);
|
||||||
|
|
|
@ -30,7 +30,6 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// AVUTIL
|
// AVUTIL
|
||||||
#if HAVE_LIBAVUTIL_AVUTIL_H
|
|
||||||
#include "libavutil/avassert.h"
|
#include "libavutil/avassert.h"
|
||||||
#include <libavutil/avutil.h>
|
#include <libavutil/avutil.h>
|
||||||
#include <libavutil/base64.h>
|
#include <libavutil/base64.h>
|
||||||
|
@ -109,7 +108,6 @@ extern "C" {
|
||||||
//#define AV_PIX_FMT_VDPAU_MPEG1 PIX_FMT_VDPAU_MPEG1
|
//#define AV_PIX_FMT_VDPAU_MPEG1 PIX_FMT_VDPAU_MPEG1
|
||||||
//#define AV_PIX_FMT_VDPAU_MPEG2 PIX_FMT_VDPAU_MPEG2
|
//#define AV_PIX_FMT_VDPAU_MPEG2 PIX_FMT_VDPAU_MPEG2
|
||||||
#endif
|
#endif
|
||||||
#endif /* HAVE_LIBAVUTIL_AVUTIL_H */
|
|
||||||
|
|
||||||
// AVCODEC
|
// AVCODEC
|
||||||
#if HAVE_LIBAVCODEC_AVCODEC_H
|
#if HAVE_LIBAVCODEC_AVCODEC_H
|
||||||
|
@ -179,8 +177,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( HAVE_LIBAVUTIL_AVUTIL_H || HAVE_LIBAVCODEC_AVCODEC_H || HAVE_LIBAVFORMAT_AVFORMAT_H || HAVE_LIBAVDEVICE_AVDEVICE_H )
|
|
||||||
|
|
||||||
#if !LIBAVFORMAT_VERSION_CHECK(52, 107, 0, 107, 0)
|
#if !LIBAVFORMAT_VERSION_CHECK(52, 107, 0, 107, 0)
|
||||||
#if defined(AVIO_WRONLY)
|
#if defined(AVIO_WRONLY)
|
||||||
#define AVIO_FLAG_WRITE AVIO_WRONLY
|
#define AVIO_FLAG_WRITE AVIO_WRONLY
|
||||||
|
@ -193,9 +189,7 @@ extern "C" {
|
||||||
void FFMPEGInit();
|
void FFMPEGInit();
|
||||||
void FFMPEGDeInit();
|
void FFMPEGDeInit();
|
||||||
|
|
||||||
#if HAVE_LIBAVUTIL
|
|
||||||
enum _AVPIXELFORMAT GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder);
|
enum _AVPIXELFORMAT GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder);
|
||||||
#endif // HAVE_LIBAVUTIL
|
|
||||||
|
|
||||||
#if !LIBAVCODEC_VERSION_CHECK(54, 25, 0, 51, 100)
|
#if !LIBAVCODEC_VERSION_CHECK(54, 25, 0, 51, 100)
|
||||||
#define AV_CODEC_ID_NONE CODEC_ID_NONE
|
#define AV_CODEC_ID_NONE CODEC_ID_NONE
|
||||||
|
@ -253,9 +247,6 @@ enum _AVPIXELFORMAT GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subp
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
|
||||||
#endif // ( HAVE_LIBAVUTIL_AVUTIL_H || HAVE_LIBAVCODEC_AVCODEC_H || HAVE_LIBAVFORMAT_AVFORMAT_H || HAVE_LIBAVDEVICE_AVDEVICE_H )
|
|
||||||
|
|
||||||
#ifndef av_rescale_delta
|
#ifndef av_rescale_delta
|
||||||
/**
|
/**
|
||||||
* Rescale a timestamp while preserving known durations.
|
* Rescale a timestamp while preserving known durations.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "zm_image.h"
|
#include "zm_image.h"
|
||||||
#include "zm_logger.h"
|
#include "zm_logger.h"
|
||||||
|
|
||||||
#if HAVE_LIBSWSCALE && HAVE_LIBAVUTIL
|
#if HAVE_LIBSWSCALE
|
||||||
SWScale::SWScale() : gotdefaults(false), swscale_ctx(nullptr), input_avframe(nullptr), output_avframe(nullptr) {
|
SWScale::SWScale() : gotdefaults(false), swscale_ctx(nullptr), input_avframe(nullptr), output_avframe(nullptr) {
|
||||||
Debug(4, "SWScale object created");
|
Debug(4, "SWScale object created");
|
||||||
}
|
}
|
||||||
|
@ -291,4 +291,4 @@ size_t SWScale::GetBufferSize(enum _AVPIXELFORMAT pf, unsigned int width, unsign
|
||||||
return outsize = avpicture_get_size(pf, width,height);
|
return outsize = avpicture_get_size(pf, width,height);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif // HAVE_LIBSWSCALE && HAVE_LIBAVUTIL
|
#endif // HAVE_LIBSWSCALE
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
class Image;
|
class Image;
|
||||||
|
|
||||||
/* SWScale wrapper class to make our life easier and reduce code reuse */
|
/* SWScale wrapper class to make our life easier and reduce code reuse */
|
||||||
#if HAVE_LIBSWSCALE && HAVE_LIBAVUTIL
|
#if HAVE_LIBSWSCALE
|
||||||
class SWScale {
|
class SWScale {
|
||||||
public:
|
public:
|
||||||
SWScale();
|
SWScale();
|
||||||
|
@ -32,6 +32,6 @@ class SWScale {
|
||||||
unsigned int default_width;
|
unsigned int default_width;
|
||||||
unsigned int default_height;
|
unsigned int default_height;
|
||||||
};
|
};
|
||||||
#endif // HAVE_LIBSWSCALE && HAVE_LIBAVUTIL
|
#endif // HAVE_LIBSWSCALE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,9 +40,6 @@
|
||||||
#cmakedefine HAVE_LIBAVCODEC_AVCODEC_H 1
|
#cmakedefine HAVE_LIBAVCODEC_AVCODEC_H 1
|
||||||
#cmakedefine HAVE_LIBAVDEVICE 1
|
#cmakedefine HAVE_LIBAVDEVICE 1
|
||||||
#cmakedefine HAVE_LIBAVDEVICE_AVDEVICE_H 1
|
#cmakedefine HAVE_LIBAVDEVICE_AVDEVICE_H 1
|
||||||
#cmakedefine HAVE_LIBAVUTIL 1
|
|
||||||
#cmakedefine HAVE_LIBAVUTIL_AVUTIL_H 1
|
|
||||||
#cmakedefine HAVE_LIBAVUTIL_MATHEMATICS_H 1
|
|
||||||
#cmakedefine HAVE_LIBAVUTIL_HWCONTEXT_H 1
|
#cmakedefine HAVE_LIBAVUTIL_HWCONTEXT_H 1
|
||||||
#cmakedefine HAVE_LIBSWSCALE 1
|
#cmakedefine HAVE_LIBSWSCALE 1
|
||||||
#cmakedefine HAVE_LIBSWSCALE_SWSCALE_H 1
|
#cmakedefine HAVE_LIBSWSCALE_SWSCALE_H 1
|
||||||
|
|
Loading…
Reference in New Issue