Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #############################################################################
- # contains_item ${needle} ${haystack[@]}
- #############################################################################
- contains_item() {
- set +x
- local ITEM=$1
- local LIST=${@:2}
- for ELEM in ${LIST[@]}
- do
- #echo "Scanning for needle:${ITEM}: currently @ ${ELEM}"
- if [ ${ITEM} == ${ELEM} ]; then
- #echo "Found ${ITEM} == ${ELEM}"
- return 0
- fi
- done
- #echo "Did not find ${ITEM}"
- return 1
- }
- #############################################################################
- #
- # Example: We want to populate --enable-decoder= and --disable-decoder= flags
- # to invoke a ./configure script, the script gives us the list of all decoders available
- # we we want to exclude the ones in a given list
- #
- # ENABLED_DECODERS=(flv h263 h263i h264 hevc mpeg1video mpeg2video mpeg4 svq1 svq3 vp6 vp8 vp9 wmv1 wmv2 aac ac3 flac mp3 mp3 vorbis wmav1 wmav2 adpcm_g726)
- # AVAILABLE_DECODERS=`./configure --list-decoders` # We get all the available decoders
- #
- # DISABLED_DECODERS_FLAGS="" # We'll store the final decoders to disable here
- #
- # for DECODER in ${AVAILABLE_DECODERS}
- # do
- # ENCODER_ENABLED=`contains_item ${DECODER} ${ENABLED_DECODERS[@]}`
- # # if we don't find it in the enabled list, we add it.
- # # (Yes, in bash 1 stands for false. functions return 0 when everything went fine as in errors)
- # if [[ ${ENCODER_ENABLED} == 1 ]]; then
- # echo "Disabling not found decoder: ${DECODER}"
- # DISABLED_DECODERS_FLAGS+="--disable-decoder=${DECODER} ";
- # fi
- # done;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement