libcras: Add capture structures and functions

`CaptureBufferStream` which can be create from `CrasClient` for audio capture.

`CaptureBuffers` which contain audio samples are obtained by calling
next_capture_buffer from `CrasStream`.

Users get captured audio samples from the provided buffers. When a
`CaptureBuffer` is dropped, the number of read samples will be committed
to the `CrasStream` it came from.

Abstract `CrasStreamData` from structure to trait and implement
`CrasCaptureData` and `CrasPlaybackData`.

BUG=chromium:907520
BUG=chromium:932268
TEST=Unit tests
TEST=Apply full patch set and test by running
     $ cras_tests capture -f /tmp/res.raw

Change-Id: Ib9c43a0d7285839567f77c59999b335f0aa97f1f
Reviewed-on: https://chromium-review.googlesource.com/1521087
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
4 files changed