#!/bin/sh

set -euo pipefail

set -x

# To:
# - build with debug info for stack traces and analysis
# - work around valgrind not supporting avx512, causing an illegal instruction report:
# configure mplayer as follows:
# ./configure --enable-debug=3 --extra-cflags=-mno-avx512f

gcc subtest.c -o subtest

./subtest sub

ffmpeg -y -f lavfi -i color=size=2x2:rate=25:color=black -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -t 1 subtest.mp4

for i in $(seq 0 92); do
	valgrind ~/repos/svn/mplayer/mplayer -vo jpeg -vobsub sub-$i -vobsubid 0 subtest.mp4 
done

