patch by David Bateman, adb014 gmail com Originally committed as revision 8632 to svn://svn.ffmpeg.org/ffmpeg/trunk