ffmpeg_6.0.0
luoye 1 year ago
parent ecd31b982e
commit 0a1bff83b2
  1. 62
      scripts/ffmpeg/build.sh

@ -1,40 +1,39 @@
#!/usr/bin/env bash #!/usr/bin/env bash
case $ANDROID_ABI in case $ANDROID_ABI in
x86) x86)
# Disabling assembler optimizations, because they have text relocations # Disabling assembler optimizations, because they have text relocations
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --disable-neon --disable-asm" EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --disable-neon --disable-asm"
;; ;;
x86_64) x86_64)
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --disable-neon --disable-asm" EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --disable-neon --disable-asm"
;; ;;
armeabi-v7a) armeabi-v7a)
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-neon --disable-asm --enable-inline-asm" EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-neon --disable-asm --enable-inline-asm"
;; ;;
arm64-v8a) arm64-v8a)
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-neon --disable-asm --enable-inline-asm" EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-neon --disable-asm --enable-inline-asm"
;; ;;
esac esac
if [ "$FFMPEG_GPL_ENABLED" = true ] ; then if [ "$FFMPEG_GPL_ENABLED" = true ]; then
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-gpl" EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-gpl"
fi fi
# Preparing flags for enabling requested libraries # Preparing flags for enabling requested libraries
ADDITIONAL_COMPONENTS= ADDITIONAL_COMPONENTS=
for LIBARY_NAME in ${FFMPEG_EXTERNAL_LIBRARIES[@]} for LIBARY_NAME in ${FFMPEG_EXTERNAL_LIBRARIES[@]}; do
do
ADDITIONAL_COMPONENTS+=" --enable-$LIBARY_NAME" ADDITIONAL_COMPONENTS+=" --enable-$LIBARY_NAME"
case $LIBARY_NAME in case $LIBARY_NAME in
libx264) libx264)
ADDITIONAL_COMPONENTS+=" --enable-encoder=libx264" ADDITIONAL_COMPONENTS+=" --enable-encoder=libx264"
;; ;;
libmp3lame) libmp3lame)
ADDITIONAL_COMPONENTS+=" --enable-encoder=libmp3lame" ADDITIONAL_COMPONENTS+=" --enable-encoder=libmp3lame"
;; ;;
*) *)
echo "Unknown ADDITIONAL_COMPONENTS LIBARY_NAME: $LIBARY_NAME" echo "Unknown ADDITIONAL_COMPONENTS LIBARY_NAME: $LIBARY_NAME"
;; ;;
esac esac
done done
@ -163,6 +162,10 @@ DEP_LD_FLAGS="-L${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/lib $FFMPEG_EXTRA_LD_FLAGS"
--enable-jni \ --enable-jni \
--enable-nonfree \ --enable-nonfree \
--enable-mediacodec \ --enable-mediacodec \
--enable-decoder=h264_mediacodec \
--enable-decoder=hevc_mediacodec \
--enable-encoder=h264_mediacodec \
--enable-encoder=hevc_mediacodec \
--enable-version3 \ --enable-version3 \
--pkg-config=${PKG_CONFIG_EXECUTABLE} \ --pkg-config=${PKG_CONFIG_EXECUTABLE} \
${EXTRA_BUILD_CONFIGURATION_FLAGS} \ ${EXTRA_BUILD_CONFIGURATION_FLAGS} \
@ -172,7 +175,6 @@ ${MAKE_EXECUTABLE} clean
${MAKE_EXECUTABLE} -j${HOST_NPROC} ${MAKE_EXECUTABLE} -j${HOST_NPROC}
${MAKE_EXECUTABLE} install ${MAKE_EXECUTABLE} install
export STATIC_LIB_DIR=${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib export STATIC_LIB_DIR=${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib
export EXTERNAL_LIB_DIR=${INSTALL_DIR}/lib export EXTERNAL_LIB_DIR=${INSTALL_DIR}/lib
echo STATIC_LIB_DIR=${STATIC_LIB_DIR} echo STATIC_LIB_DIR=${STATIC_LIB_DIR}
@ -180,15 +182,14 @@ echo EXTERNAL_LIB_DIR=${EXTERNAL_LIB_DIR}
echo FAM_CC=${FAM_CC} echo FAM_CC=${FAM_CC}
EXTERNAL_STATIC_LIB_PATH="" EXTERNAL_STATIC_LIB_PATH=""
for LIBARY_NAME in ${FFMPEG_EXTERNAL_LIBRARIES[@]} for LIBARY_NAME in ${FFMPEG_EXTERNAL_LIBRARIES[@]}; do
do
EXTERNAL_STATIC_LIB_PATH+="${EXTERNAL_LIB_DIR}/${LIBARY_NAME}.a " EXTERNAL_STATIC_LIB_PATH+="${EXTERNAL_LIB_DIR}/${LIBARY_NAME}.a "
done done
echo EXTERNAL_STATIC_LIB_PATH=${EXTERNAL_STATIC_LIB_PATH} echo EXTERNAL_STATIC_LIB_PATH=${EXTERNAL_STATIC_LIB_PATH}
${FAM_CC} -shared -o ${STATIC_LIB_DIR}/${OUTPUT_SO_NAME} \ ${FAM_CC} -shared -o ${STATIC_LIB_DIR}/${OUTPUT_SO_NAME} \
-Wl,--whole-archive \ -Wl,--whole-archive \
${EXTERNAL_STATIC_LIB_PATH}\ ${EXTERNAL_STATIC_LIB_PATH} \
${STATIC_LIB_DIR}/libavutil.a \ ${STATIC_LIB_DIR}/libavutil.a \
${STATIC_LIB_DIR}/libavcodec.a \ ${STATIC_LIB_DIR}/libavcodec.a \
${STATIC_LIB_DIR}/libavfilter.a \ ${STATIC_LIB_DIR}/libavfilter.a \
@ -202,4 +203,3 @@ mkdir -p ${OUTPUT_CONFIG_HEADERS_DIR}
cp config.h ${OUTPUT_CONFIG_HEADERS_DIR}/config.h cp config.h ${OUTPUT_CONFIG_HEADERS_DIR}/config.h
${FAM_STRIP} --strip-unneeded ${STATIC_LIB_DIR}/${OUTPUT_SO_NAME} ${FAM_STRIP} --strip-unneeded ${STATIC_LIB_DIR}/${OUTPUT_SO_NAME}

Loading…
Cancel
Save