Skip to content

Commit

Permalink
Build FFmpeg v4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bear101 committed Oct 31, 2024
1 parent 72b146b commit b967cce
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 44 deletions.
10 changes: 5 additions & 5 deletions Library/TeamTalkLib/avstream/FFMpeg3Streamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern "C" {
#include <libavcodec/avcodec.h>
#include <libavdevice/avdevice.h>
#include <libavformat/avformat.h>
#include <libavfilter/avfiltergraph.h>
#include <libavfilter/avfilter.h>
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
#include <libavutil/opt.h>
Expand Down Expand Up @@ -694,8 +694,8 @@ AVFilterGraph* createAudioFilterGraph(AVFormatContext *fmt_ctx,
//init filters
AVFilterGraph *filter_graph = NULL;

AVFilter *abuffersrc = avfilter_get_by_name("abuffer");
AVFilter *abuffersink = avfilter_get_by_name("abuffersink");
const AVFilter *abuffersrc = avfilter_get_by_name("abuffer");
const AVFilter *abuffersink = avfilter_get_by_name("abuffersink");
AVFilterInOut *outputs = avfilter_inout_alloc(); //TODO: Free??
AVFilterInOut *inputs = avfilter_inout_alloc(); //TODO: Free??
const enum AVSampleFormat out_sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE };
Expand Down Expand Up @@ -812,8 +812,8 @@ AVFilterGraph* createVideoFilterGraph(AVFormatContext *fmt_ctx,
AVFilterGraph *filter_graph;
char args[512];
int ret;
AVFilter *buffersrc = avfilter_get_by_name("buffer");
AVFilter *buffersink = avfilter_get_by_name("buffersink");
const AVFilter *buffersrc = avfilter_get_by_name("buffer");
const AVFilter *buffersink = avfilter_get_by_name("buffersink");
AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc();
const enum AVPixelFormat pix_fmts[] = { output_pixfmt, AV_PIX_FMT_NONE };
Expand Down
108 changes: 69 additions & 39 deletions Library/TeamTalkLib/build/ffmpeg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,38 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

ExternalProject_Add(ffmpeg-arm64-src
GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg
GIT_TAG n3.4.13
GIT_TAG n4.0
GIT_SHALLOW TRUE
UPDATE_COMMAND ""
PREFIX ${TOOLCHAIN_BUILD_PREFIX}/ffmpeg-arm64
INSTALL_DIR ${TOOLCHAIN_INSTALL_PREFIX_FFMPEG}-arm64
PATCH_COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-signature-of-read_probe-AVProbeData-p-in-libavfo.patch
COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0002-Fix-int-vs.-ptrdiff_t-signature-for-weight_h264_pixe.patch
CONFIGURE_COMMAND export PKG_CONFIG_PATH=${OPENSSL_DIR}/lib/pkgconfig &&
<SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-iconv
--disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes
--disable-libxcb-shape --disable-securetransport
--disable-schannel --disable-xlib --disable-jack
CONFIGURE_COMMAND export PKG_CONFIG_PATH=${OPENSSL_DIR}/lib/pkgconfig && <SOURCE_DIR>/configure
--prefix=<INSTALL_DIR>
# External libraries:
--disable-iconv
--disable-libxcb
--disable-libxcb-shape
--disable-libxcb-shm
--disable-libxcb-xfixes
--disable-lzma
--extra-cflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -arch\ arm64
--extra-cxxflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -arch\ arm64
--extra-ldexeflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -arch\ arm64
--disable-videotoolbox --disable-sdl2 --pkg-config-flags=--static
--enable-debug=3 --disable-optimizations --disable-stripping --enable-openssl
--enable-cross-compile --target-os=darwin --arch=arm64 --disable-asm
# Seems --arch=arm64 has no effect and '-arch arm64' has to be applied
--disable-schannel
--disable-sdl2
--disable-securetransport
--disable-xlib
--enable-openssl
# Programs/docs
--disable-doc
--disable-programs
# Compile options (yasm does not work for arm64)
--disable-asm
--disable-optimizations
--disable-stripping
--enable-debug=3
--extra-cflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}
--extra-cxxflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}
--extra-ldexeflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}
--pkg-config-flags=--static
--enable-cross-compile --target-os=darwin --arch=arm64
BUILD_COMMAND make ${TOOLCHAIN_BUILD_MAKEJOBS}
INSTALL_COMMAND make ${TOOLCHAIN_BUILD_MAKEJOBS} install
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libavdevice.a
Expand All @@ -49,24 +61,36 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

ExternalProject_Add(ffmpeg-intel-src
GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg
GIT_TAG n3.4.13
GIT_TAG n4.0
GIT_SHALLOW TRUE
UPDATE_COMMAND ""
PREFIX ${TOOLCHAIN_BUILD_PREFIX}/ffmpeg-intel
INSTALL_DIR ${TOOLCHAIN_INSTALL_PREFIX_FFMPEG}-intel
PATCH_COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-signature-of-read_probe-AVProbeData-p-in-libavfo.patch
COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0002-Fix-int-vs.-ptrdiff_t-signature-for-weight_h264_pixe.patch
CONFIGURE_COMMAND export PKG_CONFIG_PATH=${OPENSSL_DIR}/lib/pkgconfig &&
<SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-iconv
--disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes
--disable-libxcb-shape --disable-securetransport
--disable-schannel --disable-xlib --disable-jack
CONFIGURE_COMMAND export PKG_CONFIG_PATH=${OPENSSL_DIR}/lib/pkgconfig && <SOURCE_DIR>/configure
--prefix=<INSTALL_DIR>
# External libraries:
--disable-iconv
--disable-libxcb
--disable-libxcb-shape
--disable-libxcb-shm
--disable-libxcb-xfixes
--disable-lzma
--extra-cflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -arch\ x86_64
--extra-cxxflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -arch\ x86_64
--extra-ldexeflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -arch\ x86_64
--disable-videotoolbox --disable-sdl2 --pkg-config-flags=--static
--enable-debug=3 --disable-optimizations --disable-stripping --enable-openssl
--disable-schannel
--disable-sdl2
--disable-securetransport
--disable-xlib
--enable-openssl
# Programs/docs
--disable-doc
--disable-programs
# Compile options
--disable-optimizations
--disable-stripping
--enable-debug=3
--extra-cflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}
--extra-cxxflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}
--extra-ldexeflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}
--pkg-config-flags=--static
--enable-cross-compile --target-os=darwin --arch=x86_64
BUILD_COMMAND make ${TOOLCHAIN_BUILD_MAKEJOBS}
INSTALL_COMMAND make ${TOOLCHAIN_BUILD_MAKEJOBS} install
Expand Down Expand Up @@ -244,13 +268,11 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "iOS")

ExternalProject_Add(ffmpeg-src
GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg
GIT_TAG n3.4.13
GIT_TAG n4.0
GIT_SHALLOW TRUE
UPDATE_COMMAND ""
PREFIX ${TOOLCHAIN_BUILD_PREFIX}/ffmpeg
INSTALL_DIR ${TOOLCHAIN_INSTALL_PREFIX_FFMPEG}
PATCH_COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-signature-of-read_probe-AVProbeData-p-in-libavfo.patch
COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0002-Fix-int-vs.-ptrdiff_t-signature-for-weight_h264_pixe.patch
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> ${FFMPEG_CFG_FLAGS}
BUILD_COMMAND make ${TOOLCHAIN_BUILD_MAKEJOBS}
INSTALL_COMMAND make ${TOOLCHAIN_BUILD_MAKEJOBS} install
Expand Down Expand Up @@ -332,16 +354,20 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (TOOLCHAIN_BUILD_EXTERNALPROJECTS)
ExternalProject_Add(ffmpeg-src
GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg
GIT_TAG n3.4.13
GIT_TAG n4.0
GIT_SHALLOW TRUE
UPDATE_COMMAND ""
PREFIX ${TOOLCHAIN_BUILD_PREFIX}/ffmpeg
INSTALL_DIR ${TOOLCHAIN_INSTALL_PREFIX_FFMPEG}
PATCH_COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-signature-of-read_probe-AVProbeData-p-in-libavfo.patch
COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0002-Fix-int-vs.-ptrdiff_t-signature-for-weight_h264_pixe.patch
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
--enable-pic --enable-openssl --disable-jack
# External libraries:
--disable-libxcb
--enable-openssl
# Programs/docs
--disable-doc
--disable-programs
# Compile options
--enable-pic
BUILD_COMMAND make ${TOOLCHAIN_BUILD_MAKEJOBS}
INSTALL_COMMAND make ${TOOLCHAIN_BUILD_MAKEJOBS} install
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libavdevice.a
Expand Down Expand Up @@ -485,16 +511,20 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Android")

ExternalProject_Add(ffmpeg-src
GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg
GIT_TAG n3.4.13
GIT_TAG n4.0
GIT_SHALLOW TRUE
UPDATE_COMMAND ""
PREFIX ${TOOLCHAIN_BUILD_PREFIX}/ffmpeg
INSTALL_DIR ${TOOLCHAIN_INSTALL_PREFIX_FFMPEG}
PATCH_COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-signature-of-read_probe-AVProbeData-p-in-libavfo.patch
COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0002-Fix-int-vs.-ptrdiff_t-signature-for-weight_h264_pixe.patch
CONFIGURE_COMMAND ${FFMPEG_EXPORT} && <SOURCE_DIR>/configure ${FFMPEG_CFG} --prefix=<INSTALL_DIR>
# External libraries:
--disable-indev=v4l2
# Programs/docs
--disable-doc
--disable-programs
# Compile options
--enable-pic
--enable-cross-compile --sysroot=${CMAKE_SYSROOT} --target-os=android
--enable-pic --disable-doc --disable-programs --disable-indev=v4l2
BUILD_COMMAND ${FFMPEG_EXPORT} && make ${TOOLCHAIN_BUILD_MAKEJOBS}
INSTALL_COMMAND ${FFMPEG_EXPORT} && make ${TOOLCHAIN_BUILD_MAKEJOBS} install
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libavdevice.a
Expand Down

0 comments on commit b967cce

Please sign in to comment.