Patch by Daniel Verkamp daniel _AT_ drv DOT nu. Originally committed as revision 18764 to svn://svn.ffmpeg.org/ffmpeg/trunk