Patch by wallak, wallak free fr Originally committed as revision 20160 to svn://svn.ffmpeg.org/ffmpeg/trunk