Patch by Francesco Lavra <francescolavra interfree it>. Originally committed as revision 23362 to svn://svn.ffmpeg.org/ffmpeg/trunk