Fix wrong sample rate while playback.

* the sample rate in libao is 'per-channel', in libav it's the global
  sample rate.
* replace deprecated function calls in libav.