static assoc_t readys[] = { READY(FRAGMENT), READY(ASAP), END };
static assoc_t xfers[] = { XFER(INTERLEAVED), XFER(NONINTERLEAVED), END };
static assoc_t mmaps[] = { MMAP(INTERLEAVED), MMAP(NONINTERLEAVED), END };
-static assoc_t xrun_acts[] = { XRUN_ACT(DRAIN), XRUN_ACT(DROP), END };
static assoc_t onoff[] = { {0, "OFF", NULL}, {1, "ON", NULL}, {-1, "ON", NULL}, END };
int snd_pcm_dump_setup(snd_pcm_t *pcm, FILE *fp)
fprintf(fp, "xfer_min : %ld\n", (long)setup->xfer_min);
fprintf(fp, "xfer_align : %ld\n", (long)setup->xfer_align);
fprintf(fp, "xrun_mode : %s\n", assoc(setup->xrun_mode, xruns));
- fprintf(fp, "xrun_act : %s\n", assoc(setup->xrun_act, xrun_acts));
fprintf(fp, "xrun_max : %ld\n", (long)setup->xrun_max);
fprintf(fp, "mmap_shape : %s\n", assoc(setup->mmap_shape, mmaps));
fprintf(fp, "buffer_size: %ld\n", (long)setup->buffer_size);
return 0;
}
-static int snd_pcm_mmap_playback_ready(snd_pcm_t *pcm)
-{
- if (pcm->mmap_status->state == SND_PCM_STATE_XRUN)
- return -EPIPE;
- return snd_pcm_mmap_playback_avail(pcm) >= pcm->setup.avail_min;
-}
-
-static int snd_pcm_mmap_capture_ready(snd_pcm_t *pcm)
-{
- int ret = 0;
- if (pcm->mmap_status->state == SND_PCM_STATE_XRUN) {
- ret = -EPIPE;
- if (pcm->setup.xrun_act == SND_PCM_XRUN_ACT_DROP)
- return -EPIPE;
- }
- if (snd_pcm_mmap_capture_avail(pcm) >= pcm->setup.avail_min)
- return 1;
- return ret;
-}
-
-int snd_pcm_mmap_ready(snd_pcm_t *pcm)
-{
- assert(pcm);
- assert(pcm->mmap_status && pcm->mmap_control);
- assert(pcm->mmap_status->state >= SND_PCM_STATE_PREPARED);
- if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
- return snd_pcm_mmap_playback_ready(pcm);
- } else {
- return snd_pcm_mmap_capture_ready(pcm);
- }
-}
-
size_t snd_pcm_mmap_playback_xfer(snd_pcm_t *pcm, size_t frames)
{
snd_pcm_mmap_control_t *control = pcm->mmap_control;