Patch by Sebastian Vater <cdgs basty googlemail com>. Originally committed as revision 23113 to svn://svn.ffmpeg.org/ffmpeg/trunk