rebased to ffmpeg master head, rev b691bc4, 2013-04-29