inspired by a patch by Ronald S. Bultje, rbultje ronald.bitfreak net Originally committed as revision 9243 to svn://svn.ffmpeg.org/ffmpeg/trunk