patch by Eli Friedman <eli dot friedman at gmail dot com> Originally committed as revision 23547 to svn://svn.ffmpeg.org/ffmpeg/trunk