diff --git a/CMakeLists.txt b/CMakeLists.txt index c1e9f25ba..400245ec1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,14 @@ if(WIN32) add_definitions(-DUNICODE -D_UNICODE) endif() +if(MSVC) + set(CMAKE_C_FLAGS_DEBUG "/DDEBUG=1 /D_DEBUG=1 ${CMAKE_C_FLAGS_DEBUG}") + set(CMAKE_CXX_FLAGS_DEBUG "/DDEBUG=1 /D_DEBUG=1 ${CMAKE_C_FLAGS_DEBUG}") +else() + set(CMAKE_C_FLAGS_DEBUG "-DDEBUG=1 -D_DEBUG=1 ${CMAKE_C_FLAGS_DEBUG}") + set(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG=1 -D_DEBUG=1 ${CMAKE_C_FLAGS_DEBUG}") +endif() + if(APPLE) set(CMAKE_MACOSX_RPATH TRUE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-aac.c b/plugins/obs-ffmpeg/obs-ffmpeg-aac.c index 40abef0d3..c16bf76e4 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-aac.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-aac.c @@ -20,7 +20,9 @@ #include #include + #include "obs-ffmpeg-formats.h" +#include "obs-ffmpeg-compat.h" struct aac_encoder { obs_encoder_t encoder; diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-compat.h b/plugins/obs-ffmpeg/obs-ffmpeg-compat.h new file mode 100644 index 000000000..922891781 --- /dev/null +++ b/plugins/obs-ffmpeg/obs-ffmpeg-compat.h @@ -0,0 +1,22 @@ +#pragma once + +#include + +/* LIBAVCODEC_VERSION_CHECK checks for the right version of libav and FFmpeg + * a is the major version + * b and c the minor and micro versions of libav + * d and e the minor and micro versions of FFmpeg */ +#define LIBAVCODEC_VERSION_CHECK( a, b, c, d, e ) \ + ( (LIBAVCODEC_VERSION_MICRO < 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \ + (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) ) + +#if !LIBAVCODEC_VERSION_CHECK(54, 28, 0, 59, 100) +# define avcodec_free_frame av_freep +#endif + +#if LIBAVCODEC_VERSION_INT < 0x371c01 +# define av_frame_alloc avcodec_alloc_frame +# define av_frame_unref avcodec_get_frame_defaults +# define av_frame_free avcodec_free_frame +#endif + diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-output.c b/plugins/obs-ffmpeg/obs-ffmpeg-output.c index cef2815ed..2c4579329 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-output.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-output.c @@ -27,6 +27,7 @@ #include #include "obs-ffmpeg-formats.h" +#include "obs-ffmpeg-compat.h" //#define OBS_FFMPEG_VIDEO_FORMAT VIDEO_FORMAT_I420 #define OBS_FFMPEG_VIDEO_FORMAT VIDEO_FORMAT_NV12