Ability to record both PCM and OPUS in external output.  Sniffs the incoming stream to correctly configure libav.

Also a bunch of general cleanup changes and consolidation.  Shutdown our worker thread before we nuke libav, and change the ordering of closing the file to match libav documentation.