patch by Anssi Hannula, anssi.hannula gmail com Originally committed as revision 8643 to svn://svn.ffmpeg.org/ffmpeg/trunk