• Home
  • Raw
  • Download

Lines Matching refs:pcm

311 static void snd_pcm_dmix_sync_area(snd_pcm_t *pcm)  in snd_pcm_dmix_sync_area()  argument
313 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_sync_area()
322 size = pcm_frame_diff2(dmix->appl_ptr, dmix->last_appl_ptr, pcm->boundary); in snd_pcm_dmix_sync_area()
334 dmix->last_appl_ptr %= pcm->boundary; in snd_pcm_dmix_sync_area()
337 size = pcm_frame_diff2(dmix->appl_ptr, dmix->last_appl_ptr, pcm->boundary); in snd_pcm_dmix_sync_area()
358 src_areas = snd_pcm_mmap_areas(pcm); in snd_pcm_dmix_sync_area()
360 appl_ptr = dmix->last_appl_ptr % pcm->buffer_size; in snd_pcm_dmix_sync_area()
362 dmix->last_appl_ptr %= pcm->boundary; in snd_pcm_dmix_sync_area()
369 if (appl_ptr + transfer > pcm->buffer_size) in snd_pcm_dmix_sync_area()
370 transfer = pcm->buffer_size - appl_ptr; in snd_pcm_dmix_sync_area()
380 appl_ptr %= pcm->buffer_size; in snd_pcm_dmix_sync_area()
388 static int snd_pcm_dmix_sync_ptr0(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr) in snd_pcm_dmix_sync_ptr0() argument
390 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_sync_ptr0()
404 dmix->hw_ptr %= pcm->boundary; in snd_pcm_dmix_sync_ptr0()
405 if (pcm->stop_threshold >= pcm->boundary) /* don't care */ in snd_pcm_dmix_sync_ptr0()
407 avail = snd_pcm_mmap_playback_avail(pcm); in snd_pcm_dmix_sync_ptr0()
410 if (avail >= pcm->stop_threshold) { in snd_pcm_dmix_sync_ptr0()
412 gettimestamp(&dmix->trigger_tstamp, pcm->tstamp_type); in snd_pcm_dmix_sync_ptr0()
424 static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm) in snd_pcm_dmix_sync_ptr() argument
426 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_sync_ptr()
440 if (snd_pcm_direct_client_chk_xrun(dmix, pcm)) in snd_pcm_dmix_sync_ptr()
445 return snd_pcm_dmix_sync_ptr0(pcm, *dmix->spcm->hw.ptr); in snd_pcm_dmix_sync_ptr()
452 static snd_pcm_state_t snd_pcm_dmix_state(snd_pcm_t *pcm) in snd_pcm_dmix_state() argument
454 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_state()
470 snd_pcm_direct_client_chk_xrun(dmix, pcm); in snd_pcm_dmix_state()
476 static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status) in snd_pcm_dmix_status() argument
478 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_status()
486 snd_pcm_dmix_sync_ptr0(pcm, status->hw_ptr); in snd_pcm_dmix_status()
487 status->delay = snd_pcm_mmap_playback_delay(pcm); in snd_pcm_dmix_status()
493 status->state = snd_pcm_dmix_state(pcm); in snd_pcm_dmix_status()
494 status->hw_ptr = *pcm->hw.ptr; /* boundary may be different */ in snd_pcm_dmix_status()
495 status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */ in snd_pcm_dmix_status()
497 status->avail = snd_pcm_mmap_playback_avail(pcm); in snd_pcm_dmix_status()
503 static int snd_pcm_dmix_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) in snd_pcm_dmix_delay() argument
505 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_delay()
511 err = snd_pcm_dmix_sync_ptr(pcm); in snd_pcm_dmix_delay()
518 *delayp = snd_pcm_mmap_playback_delay(pcm); in snd_pcm_dmix_delay()
529 static int snd_pcm_dmix_hwsync(snd_pcm_t *pcm) in snd_pcm_dmix_hwsync() argument
531 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_hwsync()
537 return snd_pcm_dmix_sync_ptr(pcm); in snd_pcm_dmix_hwsync()
551 static int snd_pcm_dmix_reset(snd_pcm_t *pcm) in snd_pcm_dmix_reset() argument
553 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_reset()
554 dmix->hw_ptr %= pcm->period_size; in snd_pcm_dmix_reset()
557 snd_pcm_direct_reset_slave_ptr(pcm, dmix); in snd_pcm_dmix_reset()
561 static int snd_pcm_dmix_start_timer(snd_pcm_t *pcm, snd_pcm_direct_t *dmix) in snd_pcm_dmix_start_timer() argument
567 snd_pcm_direct_reset_slave_ptr(pcm, dmix); in snd_pcm_dmix_start_timer()
575 static int snd_pcm_dmix_start(snd_pcm_t *pcm) in snd_pcm_dmix_start() argument
577 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_start()
583 avail = snd_pcm_mmap_playback_hw_avail(pcm); in snd_pcm_dmix_start()
589 if ((err = snd_pcm_dmix_start_timer(pcm, dmix)) < 0) in snd_pcm_dmix_start()
591 snd_pcm_dmix_sync_area(pcm); in snd_pcm_dmix_start()
593 gettimestamp(&dmix->trigger_tstamp, pcm->tstamp_type); in snd_pcm_dmix_start()
597 static int snd_pcm_dmix_drop(snd_pcm_t *pcm) in snd_pcm_dmix_drop() argument
599 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_drop()
608 static int __snd_pcm_dmix_drain(snd_pcm_t *pcm) in __snd_pcm_dmix_drain() argument
610 snd_pcm_direct_t *dmix = pcm->private_data; in __snd_pcm_dmix_drain()
624 if (snd_pcm_mmap_playback_hw_avail(pcm) > 0) in __snd_pcm_dmix_drain()
625 snd_pcm_dmix_start(pcm); in __snd_pcm_dmix_drain()
627 snd_pcm_dmix_drop(pcm); in __snd_pcm_dmix_drain()
633 snd_pcm_dmix_drop(pcm); in __snd_pcm_dmix_drain()
637 stop_threshold = pcm->stop_threshold; in __snd_pcm_dmix_drain()
638 if (pcm->stop_threshold > pcm->buffer_size) in __snd_pcm_dmix_drain()
639 pcm->stop_threshold = pcm->buffer_size; in __snd_pcm_dmix_drain()
642 err = snd_pcm_dmix_sync_ptr(pcm); in __snd_pcm_dmix_drain()
644 snd_pcm_dmix_drop(pcm); in __snd_pcm_dmix_drain()
648 snd_pcm_dmix_sync_area(pcm); in __snd_pcm_dmix_drain()
649 if ((pcm->mode & SND_PCM_NONBLOCK) == 0) { in __snd_pcm_dmix_drain()
650 snd_pcm_wait_nocheck(pcm, -1); in __snd_pcm_dmix_drain()
662 if (pcm->mode & SND_PCM_NONBLOCK) { in __snd_pcm_dmix_drain()
670 pcm->stop_threshold = stop_threshold; in __snd_pcm_dmix_drain()
674 static int snd_pcm_dmix_drain(snd_pcm_t *pcm) in snd_pcm_dmix_drain() argument
678 snd_pcm_lock(pcm); in snd_pcm_dmix_drain()
679 err = __snd_pcm_dmix_drain(pcm); in snd_pcm_dmix_drain()
680 snd_pcm_unlock(pcm); in snd_pcm_dmix_drain()
684 static int snd_pcm_dmix_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTRIBUTE_UNUSED) in snd_pcm_dmix_pause()
689 static snd_pcm_sframes_t snd_pcm_dmix_rewindable(snd_pcm_t *pcm) in snd_pcm_dmix_rewindable() argument
691 return snd_pcm_mmap_playback_hw_rewindable(pcm); in snd_pcm_dmix_rewindable()
694 static snd_pcm_sframes_t snd_pcm_dmix_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) in snd_pcm_dmix_rewind() argument
696 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_rewind()
704 err = snd_pcm_dmix_hwsync(pcm); in snd_pcm_dmix_rewind()
716 size = pcm_frame_diff(dmix->last_appl_ptr, dmix->appl_ptr, pcm->boundary); in snd_pcm_dmix_rewind()
719 snd_pcm_mmap_appl_backward(pcm, size); in snd_pcm_dmix_rewind()
728 size = pcm_frame_diff(dmix->appl_ptr, dmix->hw_ptr, pcm->boundary); in snd_pcm_dmix_rewind()
731 slave_size = pcm_frame_diff(dmix->slave_appl_ptr, dmix->slave_hw_ptr, pcm->boundary); in snd_pcm_dmix_rewind()
741 src_areas = snd_pcm_mmap_areas(pcm); in snd_pcm_dmix_rewind()
744 dmix->last_appl_ptr %= pcm->boundary; in snd_pcm_dmix_rewind()
745 appl_ptr = dmix->last_appl_ptr % pcm->buffer_size; in snd_pcm_dmix_rewind()
752 if (appl_ptr + transfer > pcm->buffer_size) in snd_pcm_dmix_rewind()
753 transfer = pcm->buffer_size - appl_ptr; in snd_pcm_dmix_rewind()
763 appl_ptr %= pcm->buffer_size; in snd_pcm_dmix_rewind()
767 snd_pcm_mmap_appl_backward(pcm, frames_to_remix); in snd_pcm_dmix_rewind()
776 static snd_pcm_sframes_t snd_pcm_dmix_forwardable(snd_pcm_t *pcm) in snd_pcm_dmix_forwardable() argument
778 return snd_pcm_mmap_avail(pcm); in snd_pcm_dmix_forwardable()
781 static snd_pcm_sframes_t snd_pcm_dmix_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames) in snd_pcm_dmix_forward() argument
785 avail = snd_pcm_dmix_forwardable(pcm); in snd_pcm_dmix_forward()
788 snd_pcm_mmap_appl_forward(pcm, frames); in snd_pcm_dmix_forward()
792 static snd_pcm_sframes_t snd_pcm_dmix_readi(snd_pcm_t *pcm ATTRIBUTE_UNUSED, void *buffer ATTRIBUTE… in snd_pcm_dmix_readi()
797 static snd_pcm_sframes_t snd_pcm_dmix_readn(snd_pcm_t *pcm ATTRIBUTE_UNUSED, void **bufs ATTRIBUTE_… in snd_pcm_dmix_readn()
802 static int snd_pcm_dmix_close(snd_pcm_t *pcm) in snd_pcm_dmix_close() argument
804 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_close()
821 pcm->private_data = NULL; in snd_pcm_dmix_close()
826 static snd_pcm_sframes_t snd_pcm_dmix_mmap_commit(snd_pcm_t *pcm, in snd_pcm_dmix_mmap_commit() argument
830 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_mmap_commit()
843 if (snd_pcm_direct_client_chk_xrun(dmix, pcm)) in snd_pcm_dmix_mmap_commit()
847 snd_pcm_mmap_appl_forward(pcm, size); in snd_pcm_dmix_mmap_commit()
849 if ((err = snd_pcm_dmix_start_timer(pcm, dmix)) < 0) in snd_pcm_dmix_mmap_commit()
853 if ((err = snd_pcm_dmix_sync_ptr(pcm)) < 0) in snd_pcm_dmix_mmap_commit()
860 snd_pcm_dmix_sync_area(pcm); in snd_pcm_dmix_mmap_commit()
862 if (snd_pcm_mmap_playback_avail(pcm) < pcm->avail_min) in snd_pcm_dmix_mmap_commit()
868 static snd_pcm_sframes_t snd_pcm_dmix_avail_update(snd_pcm_t *pcm) in snd_pcm_dmix_avail_update() argument
870 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_avail_update()
875 if ((err = snd_pcm_dmix_sync_ptr(pcm)) < 0) in snd_pcm_dmix_avail_update()
881 return snd_pcm_mmap_playback_avail(pcm); in snd_pcm_dmix_avail_update()
884 static int snd_pcm_dmix_htimestamp(snd_pcm_t *pcm, in snd_pcm_dmix_htimestamp() argument
888 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_htimestamp()
895 snd_pcm_dmix_sync_ptr(pcm); in snd_pcm_dmix_htimestamp()
896 avail1 = snd_pcm_mmap_playback_avail(pcm); in snd_pcm_dmix_htimestamp()
906 static int snd_pcm_dmix_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsign… in snd_pcm_dmix_poll_revents() argument
908 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_poll_revents()
910 snd_pcm_dmix_sync_area(pcm); in snd_pcm_dmix_poll_revents()
911 return snd_pcm_direct_poll_revents(pcm, pfds, nfds, revents); in snd_pcm_dmix_poll_revents()
915 static void snd_pcm_dmix_dump(snd_pcm_t *pcm, snd_output_t *out) in snd_pcm_dmix_dump() argument
917 snd_pcm_direct_t *dmix = pcm->private_data; in snd_pcm_dmix_dump()
920 if (pcm->setup) { in snd_pcm_dmix_dump()
922 snd_pcm_dump_setup(pcm, out); in snd_pcm_dmix_dump()
998 snd_pcm_t *pcm, *spcm = NULL; in snd_pcm_dmix_open() local
1009 ret = _snd_pcm_direct_new(&pcm, &dmix, SND_PCM_TYPE_DMIX, name, opts, params, stream, mode); in snd_pcm_dmix_open()
1014 pcm->ops = &snd_pcm_dmix_ops; in snd_pcm_dmix_open()
1015 pcm->fast_ops = &snd_pcm_dmix_fast_ops; in snd_pcm_dmix_open()
1016 pcm->private_data = dmix; in snd_pcm_dmix_open()
1122 pcm->poll_fd = dmix->poll_fd; in snd_pcm_dmix_open()
1123 pcm->poll_events = POLLIN; /* it's different than other plugins */ in snd_pcm_dmix_open()
1124 pcm->tstamp_type = spcm->tstamp_type; in snd_pcm_dmix_open()
1125 pcm->mmap_rw = 1; in snd_pcm_dmix_open()
1126 snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0); in snd_pcm_dmix_open()
1127 snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0); in snd_pcm_dmix_open()
1134 *pcmp = pcm; in snd_pcm_dmix_open()
1156 snd_pcm_free(pcm); in snd_pcm_dmix_open()