cherry picked from commit f7843356253459e6010320292dbbc1e888a5249b Signed-off-by: Michael Niedermayer <michaelni@gmx.at>