Bundle FFmpeg for everything

so that we can enable videorecorder by default

Works as expected.
This commit is contained in:
def 2020-09-05 01:16:12 +02:00
parent cbc272fd5d
commit 45457b6185
4 changed files with 41 additions and 15 deletions

View file

@ -2364,6 +2364,11 @@ if(CLIENT AND (DMGTOOLS_FOUND OR HDIUTIL))
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${TARGET_CLIENT}> ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/ddnet-libs/sdl/mac/lib64/SDL2.framework ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/SDL2.framework
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/freetype/mac/lib64/libfreetype.6.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/mac/lib64/libavcodec.58.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/mac/lib64/libavformat.58.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/mac/lib64/libavutil.56.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/mac/lib64/libswresample.3.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/mac/lib64/libswscale.5.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/libsteam_api.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/darwin_strip_rpath.py ${CMAKE_OTOOL} ${CMAKE_INSTALL_NAME_TOOL} ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/${TARGET_CLIENT}
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @loader_path/../Frameworks ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/${TARGET_CLIENT}

View file

@ -5,44 +5,56 @@ if(NOT CMAKE_CROSSCOMPILING)
pkg_check_modules(PC_AVUTIL libavutil)
pkg_check_modules(PC_SWSCALE libswscale)
pkg_check_modules(PC_SWRESAMPLE libswresample)
if(TARGET_OS STREQUAL "linux")
pkg_check_modules(PC_X264 libx264)
endif()
endif()
set_extra_dirs_lib(FFMPEG ffmpeg)
find_library(AVCODEC_LIBRARY
NAMES avcodec libavcodec
NAMES avcodec libavcodec avcodec.58
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_AVCODEC_LIBRARY_DIRS}
PATHS ${PATHS_AVCODEC_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)
find_library(AVFORMAT_LIBRARY
NAMES avformat libavformat
NAMES avformat libavformat avformat.58
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_AVFORMAT_LIBRARY_DIRS}
PATHS ${PATHS_AVFORMAT_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)
find_library(AVUTIL_LIBRARY
NAMES avutil libavutil
NAMES avutil libavutil avutil.56
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_AVUTIL_LIBRARY_DIRS}
PATHS ${PATHS_AVUTIL_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)
find_library(SWSCALE_LIBRARY
NAMES swscale libswscale
NAMES swscale libswscale swscale.5
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_SWSCALE_LIBRARY_DIRS}
PATHS ${PATHS_SWSCALE_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)
find_library(SWRESAMPLE_LIBRARY
NAMES swresample libswresample
NAMES swresample libswresample swresample.3
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_SWRESAMPLE_LIBRARY_DIRS}
PATHS ${PATHS_SWRESAMPLE_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)
if(TARGET_OS STREQUAL "linux")
find_library(X264_LIBRARY
NAMES x264 libx264
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_X264_LIBRARY_DIRS}
PATHS ${PATHS_X264_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)
endif()
set_extra_dirs_include(AVCODEC ffmpeg "${AVCODEC_LIBRARY}")
find_path(AVCODEC_INCLUDEDIR libavcodec
HINTS ${HINTS_AVCODEC_INCLUDEDIR} ${PC_AVCODEC_INCLUDE_DIRS}
@ -78,6 +90,10 @@ find_path(SWRESAMPLE_INCLUDEDIR libswresample
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)
if(TARGET_OS STREQUAL "linux")
set_extra_dirs_include(X264 x264 "${X264_LIBRARY}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFMPEG DEFAULT_MSG
AVCODEC_LIBRARY
@ -105,7 +121,7 @@ mark_as_advanced(
SWRESAMPLE_INCLUDEDIR
)
set(FFMPEG_LIBRARIES
set(FFMPEG_LIBRARIES
${AVCODEC_LIBRARY}
${AVFORMAT_LIBRARY}
${AVUTIL_LIBRARY}
@ -113,6 +129,14 @@ set(FFMPEG_LIBRARIES
${SWRESAMPLE_LIBRARY}
)
if(TARGET_OS STREQUAL "linux")
list(APPEND FFMPEG_LIBRARIES ${X264_LIBRARY})
endif()
if(NOT TARGET_OS STREQUAL "windows")
list(APPEND FFMPEG_LIBRARIES ${CMAKE_DL_LIBS})
endif()
set(FFMPEG_INCLUDE_DIRS
${AVCODEC_INCLUDEDIR}
${AVFORMAT_INCLUDEDIR}
@ -121,15 +145,12 @@ set(FFMPEG_INCLUDE_DIRS
${SWRESAMPLE_INCLUDEDIR}
)
is_bundled(IS_BUNDLED "${AVCODEC_LIBRARY}")
if(IS_BUNDLED AND TARGET_OS STREQUAL "windows")
is_bundled(FFMPEG_BUNDLED "${AVCODEC_LIBRARY}")
if(FFMPEG_BUNDLED AND TARGET_OS STREQUAL "windows")
set(FFMPEG_COPY_FILES
"${EXTRA_FFMPEG_LIBDIR}/avcodec-58.dll"
"${EXTRA_FFMPEG_LIBDIR}/avdevice-58.dll"
"${EXTRA_FFMPEG_LIBDIR}/avfilter-7.dll"
"${EXTRA_FFMPEG_LIBDIR}/avformat-58.dll"
"${EXTRA_FFMPEG_LIBDIR}/avutil-56.dll"
"${EXTRA_FFMPEG_LIBDIR}/postproc-55.dll"
"${EXTRA_FFMPEG_LIBDIR}/swresample-3.dll"
"${EXTRA_FFMPEG_LIBDIR}/swscale-5.dll"
)

@ -1 +1 @@
Subproject commit a3958b0d8a8ce75f4217067677c72e863e97f37c
Subproject commit e7c701d814069be63bcce027d69924756c4875cc

View file

@ -221,7 +221,7 @@ void CVideo::NextVideoFrameThread()
{
m_ProcessingVideoFrame = true;
m_VideoStream.pFrame->pts = (int64)m_VideoStream.pEnc->frame_number;
dbg_msg("video_recorder", "vframe: %d", m_VideoStream.pEnc->frame_number);
//dbg_msg("video_recorder", "vframe: %d", m_VideoStream.pEnc->frame_number);
ReadRGBFromGL();
FillVideoFrame();
@ -245,7 +245,7 @@ void CVideo::NextVideoFrame()
// CAutoreleasePool AutoreleasePool;
// #endif
dbg_msg("video_recorder", "called");
//dbg_msg("video_recorder", "called");
ms_Time += ms_TickTime;
ms_LocalTime = (ms_Time-ms_LocalStartTime)/(float)time_freq();
@ -281,7 +281,7 @@ void CVideo::NextAudioFrame(void (*Mix)(short *pFinalOut, unsigned Frames))
//return;
Mix(m_aBuffer, ALEN);
//m_AudioStream.pFrame->pts = m_AudioStream.pEnc->frame_number;
dbg_msg("video_recorder", "aframe: %d", m_AudioStream.pEnc->frame_number);
//dbg_msg("video_recorder", "aframe: %d", m_AudioStream.pEnc->frame_number);
// memcpy(m_AudioStream.pTmpFrame->data[0], pData, sizeof(int16_t) * m_SndBufferSize * 2);
//