Patch by Yao Peter (peter AT yuvad DOT com) Originally committed as revision 18858 to svn://svn.ffmpeg.org/ffmpeg/trunk