patch by Alexander Strange, astrange ithinksw com Originally committed as revision 12503 to svn://svn.ffmpeg.org/ffmpeg/trunk