Patch based on pull-request by Joseph Benden <joe@benden.us> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>