• Home
  • Raw
  • Download

Lines Matching refs:pcm

154 	snd_pcm_t *pcm = file->gen.slave;  in snd_pcm_file_replace_fname()  local
174 pcm->rate); in snd_pcm_file_replace_fname()
183 pcm->channels); in snd_pcm_file_replace_fname()
192 pcm->frame_bits/pcm->channels); in snd_pcm_file_replace_fname()
202 snd_pcm_format_name(pcm->format)); in snd_pcm_file_replace_fname()
290 static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm, in snd_pcm_file_areas_read_infile() argument
295 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_areas_read_infile()
296 snd_pcm_channel_area_t areas_if[pcm->channels]; in snd_pcm_file_areas_read_infile()
310 bytes = snd_pcm_frames_to_bytes(pcm, frames); in snd_pcm_file_areas_read_infile()
319 snd_pcm_areas_from_buf(pcm, areas_if, file->rbuf); in snd_pcm_file_areas_read_infile()
320 …snd_pcm_areas_copy(areas, offset, areas_if, 0, pcm->channels, snd_pcm_bytes_to_frames(pcm, bytes),… in snd_pcm_file_areas_read_infile()
325 static void setup_wav_header(snd_pcm_t *pcm, struct wav_fmt *fmt) in setup_wav_header() argument
328 fmt->chan = TO_LE16(pcm->channels); in setup_wav_header()
329 fmt->rate = TO_LE32(pcm->rate); in setup_wav_header()
330 fmt->bwidth = pcm->frame_bits / 8; in setup_wav_header()
331 fmt->bps = fmt->bwidth * pcm->rate; in setup_wav_header()
332 fmt->bits = snd_pcm_format_width(pcm->format); in setup_wav_header()
338 static int write_wav_header(snd_pcm_t *pcm) in write_wav_header() argument
340 snd_pcm_file_t *file = pcm->private_data; in write_wav_header()
355 setup_wav_header(pcm, &file->wav_header); in write_wav_header()
389 static void fixup_wav_header(snd_pcm_t *pcm) in fixup_wav_header() argument
391 snd_pcm_file_t *file = pcm->private_data; in fixup_wav_header()
418 static int snd_pcm_file_write_bytes(snd_pcm_t *pcm, size_t bytes) in snd_pcm_file_write_bytes() argument
420 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_write_bytes()
426 err = write_wav_header(pcm); in snd_pcm_file_write_bytes()
458 static int snd_pcm_file_add_frames(snd_pcm_t *pcm, in snd_pcm_file_add_frames() argument
463 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_add_frames()
468 snd_pcm_uframes_t avail = file->wbuf_size - snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes); in snd_pcm_file_add_frames()
475 pcm->channels, n, pcm->format); in snd_pcm_file_add_frames()
481 file->wbuf_used_bytes += snd_pcm_frames_to_bytes(pcm, n); in snd_pcm_file_add_frames()
483 err = snd_pcm_file_write_bytes(pcm, file->wbuf_used_bytes - file->buffer_bytes); in snd_pcm_file_add_frames()
492 static int snd_pcm_file_close(snd_pcm_t *pcm) in snd_pcm_file_close() argument
494 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_close()
497 fixup_wav_header(pcm); in snd_pcm_file_close()
509 return snd_pcm_generic_close(pcm); in snd_pcm_file_close()
512 static int snd_pcm_file_reset(snd_pcm_t *pcm) in snd_pcm_file_reset() argument
514 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_reset()
518 snd_pcm_file_write_bytes(pcm, file->wbuf_used_bytes); in snd_pcm_file_reset()
524 static int snd_pcm_file_drop(snd_pcm_t *pcm) in snd_pcm_file_drop() argument
526 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_drop()
530 snd_pcm_file_write_bytes(pcm, file->wbuf_used_bytes); in snd_pcm_file_drop()
537 static int snd_pcm_file_drain(snd_pcm_t *pcm) in snd_pcm_file_drain() argument
539 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_drain()
542 __snd_pcm_lock(pcm); in snd_pcm_file_drain()
543 snd_pcm_file_write_bytes(pcm, file->wbuf_used_bytes); in snd_pcm_file_drain()
545 __snd_pcm_unlock(pcm); in snd_pcm_file_drain()
550 static snd_pcm_sframes_t snd_pcm_file_rewindable(snd_pcm_t *pcm) in snd_pcm_file_rewindable() argument
552 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_rewindable()
554 snd_pcm_sframes_t n = snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes); in snd_pcm_file_rewindable()
560 static snd_pcm_sframes_t snd_pcm_file_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) in snd_pcm_file_rewind() argument
562 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_rewind()
566 n = snd_pcm_frames_to_bytes(pcm, frames); in snd_pcm_file_rewind()
568 frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes); in snd_pcm_file_rewind()
572 n = snd_pcm_frames_to_bytes(pcm, err); in snd_pcm_file_rewind()
578 static snd_pcm_sframes_t snd_pcm_file_forwardable(snd_pcm_t *pcm) in snd_pcm_file_forwardable() argument
580 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_forwardable()
582 snd_pcm_sframes_t n = snd_pcm_bytes_to_frames(pcm, file->wbuf_size_bytes - file->wbuf_used_bytes); in snd_pcm_file_forwardable()
588 static snd_pcm_sframes_t snd_pcm_file_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames) in snd_pcm_file_forward() argument
590 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_forward()
594 n = snd_pcm_frames_to_bytes(pcm, frames); in snd_pcm_file_forward()
596 frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_size_bytes - file->wbuf_used_bytes); in snd_pcm_file_forward()
600 n = snd_pcm_frames_to_bytes(pcm, err); in snd_pcm_file_forward()
607 static snd_pcm_sframes_t snd_pcm_file_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t … in snd_pcm_file_writei() argument
609 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_writei()
610 snd_pcm_channel_area_t areas[pcm->channels]; in snd_pcm_file_writei()
613 snd_pcm_areas_from_buf(pcm, areas, (void*) buffer); in snd_pcm_file_writei()
614 __snd_pcm_lock(pcm); in snd_pcm_file_writei()
615 if (snd_pcm_file_add_frames(pcm, areas, 0, n) < 0) { in snd_pcm_file_writei()
616 __snd_pcm_unlock(pcm); in snd_pcm_file_writei()
619 __snd_pcm_unlock(pcm); in snd_pcm_file_writei()
625 static snd_pcm_sframes_t snd_pcm_file_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size) in snd_pcm_file_writen() argument
627 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_writen()
628 snd_pcm_channel_area_t areas[pcm->channels]; in snd_pcm_file_writen()
631 snd_pcm_areas_from_bufs(pcm, areas, bufs); in snd_pcm_file_writen()
632 __snd_pcm_lock(pcm); in snd_pcm_file_writen()
633 if (snd_pcm_file_add_frames(pcm, areas, 0, n) < 0) { in snd_pcm_file_writen()
634 __snd_pcm_unlock(pcm); in snd_pcm_file_writen()
637 __snd_pcm_unlock(pcm); in snd_pcm_file_writen()
643 static snd_pcm_sframes_t snd_pcm_file_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size) in snd_pcm_file_readi() argument
645 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_readi()
646 snd_pcm_channel_area_t areas[pcm->channels]; in snd_pcm_file_readi()
653 snd_pcm_areas_from_buf(pcm, areas, buffer); in snd_pcm_file_readi()
654 snd_pcm_file_areas_read_infile(pcm, areas, 0, frames); in snd_pcm_file_readi()
655 __snd_pcm_lock(pcm); in snd_pcm_file_readi()
656 if (snd_pcm_file_add_frames(pcm, areas, 0, frames) < 0) { in snd_pcm_file_readi()
657 __snd_pcm_unlock(pcm); in snd_pcm_file_readi()
661 __snd_pcm_unlock(pcm); in snd_pcm_file_readi()
667 static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size) in snd_pcm_file_readn() argument
669 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_readn()
670 snd_pcm_channel_area_t areas[pcm->channels]; in snd_pcm_file_readn()
677 snd_pcm_areas_from_bufs(pcm, areas, bufs); in snd_pcm_file_readn()
678 snd_pcm_file_areas_read_infile(pcm, areas, 0, frames); in snd_pcm_file_readn()
679 __snd_pcm_lock(pcm); in snd_pcm_file_readn()
680 if (snd_pcm_file_add_frames(pcm, areas, 0, frames) < 0) { in snd_pcm_file_readn()
681 __snd_pcm_unlock(pcm); in snd_pcm_file_readn()
685 __snd_pcm_unlock(pcm); in snd_pcm_file_readn()
690 static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm, in snd_pcm_file_mmap_commit() argument
694 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_mmap_commit()
707 if (snd_pcm_file_add_frames(pcm, areas, ofs, result) < 0) in snd_pcm_file_mmap_commit()
714 static int snd_pcm_file_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, in snd_pcm_file_mmap_begin() argument
717 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_mmap_begin()
724 if (pcm->stream != SND_PCM_STREAM_CAPTURE) in snd_pcm_file_mmap_begin()
732 snd_pcm_file_areas_read_infile(pcm, *areas, *offset, *frames); in snd_pcm_file_mmap_begin()
737 static int snd_pcm_file_hw_free(snd_pcm_t *pcm) in snd_pcm_file_hw_free() argument
739 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_hw_free()
751 static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) in snd_pcm_file_hw_params() argument
753 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_hw_params()
767 snd_pcm_file_hw_free(pcm); in snd_pcm_file_hw_params()
772 snd_pcm_file_hw_free(pcm); in snd_pcm_file_hw_params()
781 snd_pcm_file_hw_free(pcm); in snd_pcm_file_hw_params()
800 snd_pcm_unlink_hw_ptr(pcm, file->gen.slave); in snd_pcm_file_hw_params()
801 snd_pcm_unlink_appl_ptr(pcm, file->gen.slave); in snd_pcm_file_hw_params()
803 snd_pcm_link_hw_ptr(pcm, file->gen.slave); in snd_pcm_file_hw_params()
804 snd_pcm_link_appl_ptr(pcm, file->gen.slave); in snd_pcm_file_hw_params()
809 static void snd_pcm_file_dump(snd_pcm_t *pcm, snd_output_t *out) in snd_pcm_file_dump() argument
811 snd_pcm_file_t *file = pcm->private_data; in snd_pcm_file_dump()
820 if (pcm->setup) { in snd_pcm_file_dump()
822 snd_pcm_dump_setup(pcm, out); in snd_pcm_file_dump()
904 snd_pcm_t *pcm; in snd_pcm_file_open() local
948 err = snd_pcm_new(&pcm, SND_PCM_TYPE_FILE, name, slave->stream, slave->mode); in snd_pcm_file_open()
955 pcm->ops = &snd_pcm_file_ops; in snd_pcm_file_open()
956 pcm->fast_ops = &snd_pcm_file_fast_ops; in snd_pcm_file_open()
957 pcm->private_data = file; in snd_pcm_file_open()
958 pcm->poll_fd = slave->poll_fd; in snd_pcm_file_open()
959 pcm->poll_events = slave->poll_events; in snd_pcm_file_open()
960 pcm->mmap_shadow = 1; in snd_pcm_file_open()
961 pcm->tstamp_type = SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY; in snd_pcm_file_open()
964 pcm->tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC; in snd_pcm_file_open()
966 pcm->stream = stream; in snd_pcm_file_open()
967 snd_pcm_link_hw_ptr(pcm, slave); in snd_pcm_file_open()
968 snd_pcm_link_appl_ptr(pcm, slave); in snd_pcm_file_open()
969 *pcmp = pcm; in snd_pcm_file_open()