#!/bin/sh
PROG_DIR=$(dirname "$0")/ffplay

if [ -f "$1" ]; then
	VIDEO="$1"
else
	if grep -q "简体中文" /mnt/mmc/CFW/language.flag; then
		VIDEO="${PROG_DIR}/FFplay-controls-cn.mp4"
	else
		VIDEO="${PROG_DIR}/FFplay-controls-en.mp4"
	fi
fi

cd ${PROG_DIR}
HOME=${PROG_DIR} \
LD_PRELOAD=./j2k.so \
SDL_NOMOUSE=1 \
SDL_AUDIO_CHANNELS=2 \
FFREPORT=file=ffplay.log:level=28 \
./ffplay -fs -autoexit -vf scale=640:-2 -i "${VIDEO}"
sync
