Patch by James Zern, Google, Inc. Originally committed as revision 23449 to svn://svn.ffmpeg.org/ffmpeg/trunk