Patch from Anton Khirnov wyskas gmail com Originally committed as revision 22049 to svn://svn.ffmpeg.org/ffmpeg/trunk