You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.1 KiB

#!/bin/bash
set -ex
#########################################################################
## return error code
#########################################################################
E_INVAL=22 #Invalid param
FFMPEG_DIR=`pwd`
cd ${FFMPEG_DIR}
tar -jxvf ffmpeg_patch.tar.bz2 -C ${FFMPEG_DIR}/
FF_PATCH_DIR=${FFMPEG_DIR}/ffmpeg_patch
FF_ORG_TAR_NAME="ffmpeg-4.4.1.tar.gz"
FF_ORG_DIR=${FFMPEG_DIR}/ffmpeg-4.4.1
#FFMPEG_URL="http://ffmpeg.org/releases/ffmpeg-4.4.1.tar.gz"
#if [ ! -d "${FF_PATCH_DIR}" ];then
# mkdir -p ${FF_PATCH_DIR}
#fi
#
#if [ -f "${FF_ORG_TAR_NAME}" ];then
# echo "rm old file: ${FF_ORG_TAR_NAME}"
# rm ${FF_ORG_TAR_NAME}
#fi
#
#curl --version
#if [ $? -eq 0 ]; then
# echo "Using curl download ..."
# curl ${FFMPEG_URL} -o ${FF_ORG_TAR_NAME}
#else
# wget --version
# if [ $? -eq 0 ]; then
# echo "Using wget download ..."
# wget ${FFMPEG_URL} -O ${FF_ORG_TAR_NAME}
# else
# echo "error Neither curl nor wget found!"
# fi
#fi
#
#echo "ffmpeg org download success"
tar -xzvf ${FF_ORG_TAR_NAME}
mkdir -p ffmpeg_tmp
cp -ra ${FF_ORG_DIR}/* ffmpeg_tmp/
cp -rf ${FF_PATCH_DIR}/* ffmpeg_tmp/
rm -rf ${FF_ORG_DIR}
rm -rf ffmpeg_patch
mkdir -p ../ffmpeg
cp -rf ffmpeg_tmp/* ../ffmpeg/
rm -rf ffmpeg_tmp
OPENSOURCE_LIB_DIR=${FFMPEG_DIR}/../../huanglong/binary/open_source/nxplayer
if [ -d "$OPENSOURCE_LIB_DIR" ];then
rm -f ${OPENSOURCE_LIB_DIR}/lib64/libavutil.so
rm -f ${OPENSOURCE_LIB_DIR}/lib64/libavformat.so
rm -f ${OPENSOURCE_LIB_DIR}/lib64/libavcodec.so
rm -f ${OPENSOURCE_LIB_DIR}/lib64/libswscale.so
sed -i -e '$!N;/\n.*name: "libavformat"/!P;D' ${OPENSOURCE_LIB_DIR}/Android.bp
sed -i '/name: "libavformat"/,+75d' ${OPENSOURCE_LIB_DIR}/Android.bp
else
OPENSOURCE_LIB_DIR=${FFMPEG_DIR}/../../huanglong/binary/modules/nxplayer
rm -f ${OPENSOURCE_LIB_DIR}/Android.mk
mv ${OPENSOURCE_LIB_DIR}/Android.mk.rel ${OPENSOURCE_LIB_DIR}/Android.mk
fi
rm -f ${OPENSOURCE_LIB_DIR}/lib/libavutil.so
rm -f ${OPENSOURCE_LIB_DIR}/lib/libavformat.so
rm -f ${OPENSOURCE_LIB_DIR}/lib/libavcodec.so
rm -f ${OPENSOURCE_LIB_DIR}/lib/libswscale.so
echo "make ffmpeg patch file success"