vpxdec.sh: Refactor vpxdec().
- Split vpxdec wrapper function into vpxdec() and vpxdec_pipe(). - Remove hard coded --noblit and --summary arguments from the wrappers in favor of shifting off the first argument (the input file) and passing all remaining parameters to vpxdec. - Add --noblit and --summary args to existing tests, and update the pipe input test to use vpxdec_pipe(). Change-Id: Ia390a9990eace793058b3603ada733fb878eb78c
This commit is contained in:
parent
6e0748e142
commit
06b64c5bc5
@ -27,31 +27,25 @@ vpxdec_available() {
|
|||||||
[ -n "$(vpx_tool_available vpxdec)" ] && echo yes
|
[ -n "$(vpx_tool_available vpxdec)" ] && echo yes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Wrapper function for running vpxdec in noblit mode. Requires that
|
# Wrapper function for running vpxdec with pipe input. Requires that
|
||||||
# LIBVPX_BIN_PATH points to the directory containing vpxdec. Positional
|
# LIBVPX_BIN_PATH points to the directory containing vpxdec. $1 is used as the
|
||||||
# parameter one is used as the input file path. Positional parameter two, when
|
# input file path and shifted away. All remaining parameters are passed through
|
||||||
# present, is interpreted as a boolean flag that means the input should be sent
|
# to vpxdec.
|
||||||
# to vpxdec via pipe from cat instead of directly.
|
vpxdec_pipe() {
|
||||||
vpxdec() {
|
|
||||||
local input="${1}"
|
|
||||||
local pipe_input=${2}
|
|
||||||
|
|
||||||
if [ $# -gt 2 ]; then
|
|
||||||
# shift away $1 and $2 so the remaining arguments can be passed to vpxdec
|
|
||||||
# via $@.
|
|
||||||
shift 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}"
|
local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}"
|
||||||
|
local input="$1"
|
||||||
|
shift
|
||||||
|
cat "${input}" | eval "${VPX_TEST_PREFIX}" "${decoder}" - "$@" ${devnull}
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z "${pipe_input}" ]; then
|
# Wrapper function for running vpxdec. Requires that LIBVPX_BIN_PATH points to
|
||||||
eval "${VPX_TEST_PREFIX}" "${decoder}" "$input" --summary --noblit "$@" \
|
# the directory containing vpxdec. $1 one is used as the input file path and
|
||||||
${devnull}
|
# shifted away. All remaining parameters are passed through to vpxdec.
|
||||||
else
|
vpxdec() {
|
||||||
cat "${input}" \
|
local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}"
|
||||||
| eval "${VPX_TEST_PREFIX}" "${decoder}" - --summary --noblit "$@" \
|
local input="${1}"
|
||||||
${devnull}
|
shift
|
||||||
fi
|
eval "${VPX_TEST_PREFIX}" "${decoder}" "$input" "$@" ${devnull}
|
||||||
}
|
}
|
||||||
|
|
||||||
vpxdec_can_decode_vp8() {
|
vpxdec_can_decode_vp8() {
|
||||||
@ -70,20 +64,20 @@ vpxdec_can_decode_vp9() {
|
|||||||
|
|
||||||
vpxdec_vp8_ivf() {
|
vpxdec_vp8_ivf() {
|
||||||
if [ "$(vpxdec_can_decode_vp8)" = "yes" ]; then
|
if [ "$(vpxdec_can_decode_vp8)" = "yes" ]; then
|
||||||
vpxdec "${VP8_IVF_FILE}"
|
vpxdec "${VP8_IVF_FILE}" --summary --noblit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
vpxdec_vp8_ivf_pipe_input() {
|
vpxdec_vp8_ivf_pipe_input() {
|
||||||
if [ "$(vpxdec_can_decode_vp8)" = "yes" ]; then
|
if [ "$(vpxdec_can_decode_vp8)" = "yes" ]; then
|
||||||
vpxdec "${VP8_IVF_FILE}" -
|
vpxdec_pipe "${VP8_IVF_FILE}" --summary --noblit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
vpxdec_vp9_webm() {
|
vpxdec_vp9_webm() {
|
||||||
if [ "$(vpxdec_can_decode_vp9)" = "yes" ] && \
|
if [ "$(vpxdec_can_decode_vp9)" = "yes" ] && \
|
||||||
[ "$(webm_io_available)" = "yes" ]; then
|
[ "$(webm_io_available)" = "yes" ]; then
|
||||||
vpxdec "${VP9_WEBM_FILE}"
|
vpxdec "${VP9_WEBM_FILE}" --summary --noblit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user