Patch by Mohamed Naufal gmailify(naufal11). Originally committed as revision 22724 to svn://svn.ffmpeg.org/ffmpeg/trunk