courtesy of Konstantin Shishkov Originally committed as revision 3529 to svn://svn.ffmpeg.org/ffmpeg/trunk