Signed-off-by: Mans Rullgard <mans@mansr.com>
Patch by Baptiste with some fixes by me. Originally committed as revision 25880 to svn://svn.ffmpeg.org/ffmpeg/trunk