Patch by Patrik Kullman (patrik A yes D nu). Originally committed as revision 17217 to svn://svn.ffmpeg.org/ffmpeg/trunk