patch by Martin Storsjö, martin martin st Originally committed as revision 19441 to svn://svn.ffmpeg.org/ffmpeg/trunk