patch by Igor Mozolevsky, igor hybrid-lab.co uk Originally committed as revision 11538 to svn://svn.ffmpeg.org/ffmpeg/trunk