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