patch by Mathieu Malaterre, mathieu.malaterre gmail com Originally committed as revision 14850 to svn://svn.ffmpeg.org/ffmpeg/trunk