#!/bin/bash

install_path=""

echo "use \r\n./lib_install.sh {dst_dir}\r\n to install lib of sdk in {dst_dir}. default{dst_dir} is ./"
WORK_PATH=$PWD
if [[ $# -eq 1 ]]
then
    install_path=$1
    echo "install lib to path ${install_path}"
else
    install_path=$PWD
fi


if [[ $install_path != "" && $install_path != $PWD ]]
then
    cp -rf ./sdk_lib ${install_path}
fi

cd ${install_path}/sdk_lib/third_lib


########################## 创建链接文件  ######################################


if [ ! -f libavcodec.so ]
then
    ln -sf libavcodec.so.60 libavcodec.so
fi

    
if [ ! -f libavdevice.so ]
then
    ln -sf libavdevice.so.60 libavdevice.so
fi


if [ ! -f libavfilter.so ]
then
    ln -sf libavfilter.so.9 libavfilter.so
fi
 
if [ ! -f libavformat.so ]
then
    ln -sf libavformat.so.60 libavformat.so
fi



if [ ! -f libavutil.so ]
then
    ln -sf libavutil.so.58 libavutil.so
fi


if [ ! -f libswresample.so ]
then
    ln -sf libswresample.so.4 libswresample.so
fi



if [ ! -f libswscale.so ]
then
    ln -sf libswscale.so.7 libswscale.so
fi


cd ${WORK_PATH}