#include "media/audio/alsa/alsa_util.h"
#include <stddef.h>
#include <functional>
#include <memory>
#include "base/logging.h"
#include "base/time/time.h"
#include "media/audio/alsa/alsa_wrapper.h"
namespace alsa_util {
namespace {
int ConfigureHwParams(media::AlsaWrapper* wrapper,
snd_pcm_t* handle,
snd_pcm_format_t format,
snd_pcm_access_t access,
unsigned int channels,
unsigned int sample_rate,
int soft_resample,
snd_pcm_uframes_t frames_per_buffer,
snd_pcm_uframes_t frames_per_period) { … }
int ConfigureSwParams(media::AlsaWrapper* wrapper,
snd_pcm_t* handle,
snd_pcm_uframes_t frames_per_buffer,
snd_pcm_uframes_t frames_per_period) { … }
int SetParams(media::AlsaWrapper* wrapper,
snd_pcm_t* handle,
snd_pcm_format_t format,
unsigned int channels,
unsigned int rate,
unsigned int frames_per_buffer,
unsigned int frames_per_period) { … }
}
static snd_pcm_t* OpenDevice(media::AlsaWrapper* wrapper,
const char* device_name,
snd_pcm_stream_t type,
int channels,
int sample_rate,
snd_pcm_format_t pcm_format,
int buffer_us,
int period_us = 0) { … }
static std::string DeviceNameToControlName(const std::string& device_name) { … }
int CloseDevice(media::AlsaWrapper* wrapper, snd_pcm_t* handle) { … }
snd_pcm_t* OpenCaptureDevice(media::AlsaWrapper* wrapper,
const char* device_name,
int channels,
int sample_rate,
snd_pcm_format_t pcm_format,
int buffer_us,
int period_us) { … }
snd_pcm_t* OpenPlaybackDevice(media::AlsaWrapper* wrapper,
const char* device_name,
int channels,
int sample_rate,
snd_pcm_format_t pcm_format,
int buffer_us) { … }
snd_mixer_t* OpenMixer(media::AlsaWrapper* wrapper,
const std::string& device_name) { … }
void CloseMixer(media::AlsaWrapper* wrapper, snd_mixer_t* mixer,
const std::string& device_name) { … }
snd_mixer_elem_t* LoadCaptureMixerElement(media::AlsaWrapper* wrapper,
snd_mixer_t* mixer) { … }
}