Based on original patch by Kostya Shishkov Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net> (cherry picked from commit e00f41d5742b3a0dc1877b030f4f6f58c19b7bbd)
Originally committed as revision 22337 to svn://svn.ffmpeg.org/ffmpeg/trunk
Originally committed as revision 21937 to svn://svn.ffmpeg.org/ffmpeg/trunk