Patch by Daniel Verkamp [daniel drv nu]. Originally committed as revision 26088 to svn://svn.ffmpeg.org/ffmpeg/trunk