Originally committed as revision 21233 to svn://svn.ffmpeg.org/ffmpeg/trunk
Patch by Vladimir Voroshilov and myself. Originally committed as revision 21125 to svn://svn.ffmpeg.org/ffmpeg/trunk