Patch by Sergiy (gmail(piratfm)) Originally committed as revision 21161 to svn://svn.ffmpeg.org/ffmpeg/trunk