Skip to content

Commit

Permalink
feat(codec): support dav1d with set external lib
Browse files Browse the repository at this point in the history
  • Loading branch information
skufly committed Feb 11, 2020
1 parent 871c3a6 commit 1c50acf
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build_tools/build_curl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ function build_curl(){
--without-libidn2 \
--without-librtmp \
--without-libidn"
local build_dir="build/curl/$1/$2"
local install_dir="$PWD/install/curl/$1/$2"
local build_dir="${CWD}/build/curl/$1/$2"
local install_dir="${CWD}/install/curl/$1/$2"

mkdir -p ${build_dir}/
if [ "${BUILD}" != "False" ];then
Expand Down
9 changes: 9 additions & 0 deletions build_tools/build_iOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ CWD=$PWD
function build_fat_lib(){

local lib_names=$(cd ./install/$1/iOS/${IOS_ARCHS%% *}/lib; ls *.a)
if [ ! -n "$lib_names" ] ;then
echo "break create $1 fat"
return
fi

local fat_dir=install/$1/iOS/fat/lib
rm -rf ${fat_dir}
mkdir -p ${fat_dir}
Expand Down Expand Up @@ -79,6 +84,10 @@ function build_shared_framework(){
fi
done

if [ -d "${DAV1D_EXTERNAL_DIR}/iOS/fat" ];then
SRC_LIBRARIES_DIR="$SRC_LIBRARIES_DIR ${DAV1D_EXTERNAL_DIR}/iOS/fat/lib"
SRC_LIBRARIES="$SRC_LIBRARIES dav1d"
fi

# $CWD/install/openssl/iOS/fat/lib"
cd ./install/ffmpeg/iOS/
Expand Down
5 changes: 5 additions & 0 deletions build_tools/common_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function apply_ffmpeg_config(){
}
function build_static_lib(){
local arch=$2
export TARGET_ARCH=$2
cd ${CWD}

if [ -d "$BOOST_SOURCE_DIR" ];then
Expand Down Expand Up @@ -183,6 +184,10 @@ function link_shared_lib_Android(){
ldflags="$ldflags -lssl -lcrypto -L${OPENSSL_INSTALL_DIR}/lib/"
fi

if [ -d "${DAV1D_INSTALL_DIR}" ];then
ldflags="$ldflags -ldav1d -L${DAV1D_INSTALL_DIR}/lib/"
fi

if [ -d "${X264_INSTALL_DIR}" ];then
ldflags="$ldflags -lx264 -L${X264_INSTALL_DIR}/lib/"
fi
Expand Down
1 change: 1 addition & 0 deletions external/build_external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function patch_ffmpeg() {
git am ../../contribute/ffmpeg/0002-chore-avformat-change-MAX_PES_PAYLOAD-to-5M.patch
git am ../../contribute/ffmpeg/0003-chore-libavformat-exoport-some-functions.patch
git am ../../contribute/ffmpeg/0004-chore-fix-Linux-build.patch
git am ../../contribute/ffmpeg/0005-chore-disable-libdav1d-check.patch
}

function load_source() {
Expand Down
25 changes: 25 additions & 0 deletions external/contribute/ffmpeg/0005-chore-disable-libdav1d-check.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From ae77ae182ba69a9a5614742d927c17886936cc89 Mon Sep 17 00:00:00 2001
From: skufly <skufly@163.com>
Date: Tue, 11 Feb 2020 15:27:35 +0800
Subject: [PATCH] chore: disable libdav1d check

---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index eebf0aef57..67b092e395 100755
--- a/configure
+++ b/configure
@@ -6196,7 +6196,7 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas
enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lcodec2
-enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.2.1" "dav1d/dav1d.h" dav1d_version
+enabled libdav1d #&& require_pkg_config libdav1d "dav1d >= 0.2.1" "dav1d/dav1d.h" dav1d_version
enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open
enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
--
2.21.1 (Apple Git-122.3)

10 changes: 10 additions & 0 deletions external/player_ffmpeg_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,14 @@ if [[ "$TARGET_PLATFORM" != "Android" ]];then
ffmpeg_config_add_protocols udp
fi

DAV1D_INSTALL_DIR=
if [[ -n "${DAV1D_EXTERNAL_DIR}" ]];then
if [ -d "${DAV1D_EXTERNAL_DIR}/$TARGET_PLATFORM/$TARGET_ARCH" ];then
DAV1D_INSTALL_DIR="${DAV1D_EXTERNAL_DIR}/$TARGET_PLATFORM/$TARGET_ARCH"
ffmpeg_config_add_user "--enable-libdav1d --enable-decoder=libdav1d"
ffmpeg_config_add_extra_cflags "-I${DAV1D_INSTALL_DIR}/include"
ffmpeg_config_add_extra_ldflags "-L${DAV1D_INSTALL_DIR}/lib -ldav1d"
fi
fi

echo "DAV1D_INSTALL_DIR is $DAV1D_INSTALL_DIR"
1 change: 1 addition & 0 deletions framework/utils/AFMediaType.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ enum AFCodecID {
// AF_CODEC_ID_MJPEG,
// AF_CODEC_ID_H263,
AF_CODEC_ID_HEVC,
AF_CODEC_ID_AV1,

AF_CODEC_ID_AAC,
AF_CODEC_ID_AC3,
Expand Down
4 changes: 4 additions & 0 deletions framework/utils/ffmpeg_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ enum AFCodecID AVCodec2CicadaCodec(enum AVCodecID codec)
case AV_CODEC_ID_HEVC:
return AF_CODEC_ID_HEVC;

case AV_CODEC_ID_AV1:
return AF_CODEC_ID_AV1;

/* subtitle */
// case AV_CODEC_ID_TEXT:
// return AF_CODEC_ID_TEXT;
Expand Down Expand Up @@ -322,6 +325,7 @@ static codec_pair codec_pair_table[] = {
// {AF_CODEC_ID_FLAC, AV_CODEC_ID_FLAC},
{AF_CODEC_ID_H264, AV_CODEC_ID_H264},
{AF_CODEC_ID_HEVC, AV_CODEC_ID_HEVC},
{AF_CODEC_ID_AV1, AV_CODEC_ID_AV1},
{AF_CODEC_ID_MPEG4, AV_CODEC_ID_MPEG4},
{AF_CODEC_ID_NONE, AV_CODEC_ID_NONE},
};
Expand Down

0 comments on commit 1c50acf

Please sign in to comment.