Fix build on SunOS.
Apply upstream fixes to build correctly against newer ffmpeg.
Merge branch 'master' into joyent