Patch by Michael Kostylev <mik at it-1 dot ru> Originally committed as revision 16525 to svn://svn.ffmpeg.org/ffmpeg/trunk