Skip to content

Commit

Permalink
Implemented build script and module map to support embedding FFmpeg i…
Browse files Browse the repository at this point in the history
…n the Optimus Player macOS app
  • Loading branch information
Darren Mo committed Nov 8, 2019
1 parent 1529dfb commit 6ab4722
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
/src
/mapfile
/tools/python/__pycache__/
/optimus-player-build/
63 changes: 63 additions & 0 deletions build-for-optimus-player
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
#
# A script to build FFmpeg so that it may be embedded in the
# Optimus Player macOS app.
#
# Copyright (c) 2019 Darren Mo. Licensed under LGPL version 2.1.
#
# TODO: Enable the following external libraries in order to
# support more formats/codecs/protocols.
# AV1: libdav1d
# AviSynth: libavxsynth
# BluRay: libbluray
# CELT: libcelt
# codec2: libcodec2
# DASH: libxml2
# DVB teletext: libzvbi
# Game Music Emu: libgme
# Haivision SRT: libsrt
# iLBC: libilbc
# MOD: libopenmpt
# SAMBA: libsmbclient
# SFTP: libssh
# Speex: libspeex
# SVG: librsvg

SCRIPT_DIR="$(dirname "$BASH_SOURCE")"
cd "$SCRIPT_DIR"

export DESTDIR="$SCRIPT_DIR/optimus-player-build"

make clean
rm -rf "$DESTDIR"

./configure \
--prefix="/" \
--install-name-dir="@executable_path/../Frameworks" \
--disable-static \
--enable-shared \
--disable-programs \
--disable-doc \
--disable-avdevice \
--disable-swresample \
--disable-postproc \
--disable-avfilter \
--disable-w32threads \
--disable-os2threads \
--disable-encoders \
--disable-muxers \
--disable-devices \
--disable-filters \
--disable-amf \
--disable-cuvid \
--disable-d3d11va \
--disable-dxva2 \
--disable-ffnvcodec \
--disable-nvdec \
--disable-vaapi \
--disable-vdpau \
|| exit $?

make install || exit $?

cp module.modulemap "$DESTDIR/include/"
68 changes: 68 additions & 0 deletions module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module CFFmpeg {
explicit module AVCodec [system] [extern_c] {
link "avcodec"
link "avutil"
link "iconv"
link "lzma"
link "m"
link framework "AudioToolbox"
link framework "CoreFoundation"
link framework "CoreMedia"
link framework "CoreServices"
link framework "CoreVideo"
link framework "VideoToolbox"

umbrella "libavcodec"
exclude header "libavcodec/d3d11va.h"
exclude header "libavcodec/dxva2.h"
exclude header "libavcodec/qsv.h"
exclude header "libavcodec/vdpau.h"
exclude header "libavcodec/xvmc.h"

export *
}

explicit module AVFormat [system] [extern_c] {
link "avcodec"
link "avformat"
link "avutil"
link "bz2"
link "m"
link framework "CoreFoundation"
link framework "Security"

umbrella "libavformat"

export *
}

explicit module AVUtil [system] [extern_c] {
link "avutil"
link "m"
link framework "CoreFoundation"
link framework "CoreMedia"
link framework "CoreServices"
link framework "CoreVideo"
link framework "VideoToolbox"

umbrella "libavutil"
exclude header "libavutil/hwcontext_cuda.h"
exclude header "libavutil/hwcontext_d3d11va.h"
exclude header "libavutil/hwcontext_dxva2.h"
exclude header "libavutil/hwcontext_qsv.h"
exclude header "libavutil/hwcontext_vaapi.h"
exclude header "libavutil/hwcontext_vdpau.h"

export *
}

explicit module SWScale [system] [extern_c] {
link "avutil"
link "m"
link "swscale"

umbrella "libswscale"

export *
}
}

0 comments on commit 6ab4722

Please sign in to comment.