Lines Matching refs:out
181 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in xa_device_run() local
182 struct alsa_audio_device *adev = out->dev; in xa_device_run()
195 out->written += out_frames; in xa_device_run()
210 ret = pcm_mmap_write(out->pcm, p_buf, size); in xa_device_run()
212 out->written += out_frames; in xa_device_run()
251 static int start_output_stream(struct alsa_stream_out *out) in start_output_stream() argument
253 struct alsa_audio_device *adev = out->dev; in start_output_stream()
255 if (out->unavailable) in start_output_stream()
261 out->write_threshold = PLAYBACK_PERIOD_COUNT * PERIOD_SIZE; in start_output_stream()
262 out->config.start_threshold = PLAYBACK_PERIOD_START_THRESHOLD * PERIOD_SIZE; in start_output_stream()
263 out->config.avail_min = PERIOD_SIZE; in start_output_stream()
265 …out->pcm = pcm_open(CARD_OUT, PORT_CODEC, PCM_OUT | PCM_MMAP | PCM_NOIRQ | PCM_MONOTONIC, &out->co… in start_output_stream()
267 if (!pcm_is_ready(out->pcm)) { in start_output_stream()
268 ALOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm)); in start_output_stream()
269 pcm_close(out->pcm); in start_output_stream()
271 out->unavailable = true; in start_output_stream()
275 adev->active_output = out; in start_output_stream()
281 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_sample_rate() local
282 return out->config.rate; in out_get_sample_rate()
305 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_channels() local
306 return audio_channel_out_mask_from_count(out->config.channels); in out_get_channels()
312 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_format() local
313 return audio_format_from_pcm_format(out->config.format); in out_get_format()
322 static int do_output_standby(struct alsa_stream_out *out) in do_output_standby() argument
324 struct alsa_audio_device *adev = out->dev; in do_output_standby()
326 if (!out->standby) { in do_output_standby()
327 pcm_close(out->pcm); in do_output_standby()
328 out->pcm = NULL; in do_output_standby()
330 out->standby = 1; in do_output_standby()
338 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_standby() local
341 pthread_mutex_lock(&out->dev->lock); in out_standby()
342 pthread_mutex_lock(&out->lock); in out_standby()
344 xa_device_close(out->dev); in out_standby()
346 status = do_output_standby(out); in out_standby()
347 pthread_mutex_unlock(&out->lock); in out_standby()
348 pthread_mutex_unlock(&out->dev->lock); in out_standby()
361 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_set_parameters() local
362 struct alsa_audio_device *adev = out->dev; in out_set_parameters()
377 pthread_mutex_lock(&out->lock); in out_set_parameters()
382 pthread_mutex_unlock(&out->lock); in out_set_parameters()
400 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_latency() local
401 return (PERIOD_SIZE * PLAYBACK_PERIOD_COUNT * 1000) / out->config.rate; in out_get_latency()
415 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_write() local
416 struct alsa_audio_device *adev = out->dev; in out_write()
425 pthread_mutex_lock(&out->lock); in out_write()
426 if (out->standby) { in out_write()
432 ret = start_output_stream(out); in out_write()
437 out->standby = 0; in out_write()
448 ret = pcm_mmap_write(out->pcm, buffer, out_frames * frame_size); in out_write()
450 out->written += out_frames; in out_write()
456 pthread_mutex_unlock(&out->lock); in out_write()
477 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_presentation_position() local
480 if (out->pcm) { in out_get_presentation_position()
482 if (pcm_get_htimestamp(out->pcm, &avail, timestamp) == 0) { in out_get_presentation_position()
483 size_t kernel_buffer_size = out->config.period_size * out->config.period_count; in out_get_presentation_position()
484 int64_t signed_frames = out->written - kernel_buffer_size + avail; in out_get_presentation_position()
614 struct alsa_stream_out *out; in adev_open_output_stream() local
622 out = (struct alsa_stream_out *)calloc(1, sizeof(struct alsa_stream_out)); in adev_open_output_stream()
623 if (!out) in adev_open_output_stream()
626 out->stream.common.get_sample_rate = out_get_sample_rate; in adev_open_output_stream()
627 out->stream.common.set_sample_rate = out_set_sample_rate; in adev_open_output_stream()
628 out->stream.common.get_buffer_size = out_get_buffer_size; in adev_open_output_stream()
629 out->stream.common.get_channels = out_get_channels; in adev_open_output_stream()
630 out->stream.common.get_format = out_get_format; in adev_open_output_stream()
631 out->stream.common.set_format = out_set_format; in adev_open_output_stream()
632 out->stream.common.standby = out_standby; in adev_open_output_stream()
633 out->stream.common.dump = out_dump; in adev_open_output_stream()
634 out->stream.common.set_parameters = out_set_parameters; in adev_open_output_stream()
635 out->stream.common.get_parameters = out_get_parameters; in adev_open_output_stream()
636 out->stream.common.add_audio_effect = out_add_audio_effect; in adev_open_output_stream()
637 out->stream.common.remove_audio_effect = out_remove_audio_effect; in adev_open_output_stream()
638 out->stream.get_latency = out_get_latency; in adev_open_output_stream()
639 out->stream.set_volume = out_set_volume; in adev_open_output_stream()
640 out->stream.write = out_write; in adev_open_output_stream()
641 out->stream.get_render_position = out_get_render_position; in adev_open_output_stream()
642 out->stream.get_next_write_timestamp = out_get_next_write_timestamp; in adev_open_output_stream()
643 out->stream.get_presentation_position = out_get_presentation_position; in adev_open_output_stream()
645 out->config.channels = CHANNEL_STEREO; in adev_open_output_stream()
646 out->config.rate = CODEC_SAMPLING_RATE; in adev_open_output_stream()
647 out->config.format = PCM_FORMAT_S16_LE; in adev_open_output_stream()
648 out->config.period_size = PERIOD_SIZE; in adev_open_output_stream()
649 out->config.period_count = PLAYBACK_PERIOD_COUNT; in adev_open_output_stream()
651 if (out->config.rate != config->sample_rate || in adev_open_output_stream()
653 out->config.format != pcm_format_from_audio_format(config->format) ) { in adev_open_output_stream()
654 config->sample_rate = out->config.rate; in adev_open_output_stream()
655 config->format = audio_format_from_pcm_format(out->config.format); in adev_open_output_stream()
661 out->config.channels, out->config.rate, out->config.format); in adev_open_output_stream()
663 out->dev = ladev; in adev_open_output_stream()
664 out->standby = 1; in adev_open_output_stream()
665 out->unavailable = false; in adev_open_output_stream()
667 config->format = out_get_format(&out->stream.common); in adev_open_output_stream()
668 config->channel_mask = out_get_channels(&out->stream.common); in adev_open_output_stream()
669 config->sample_rate = out_get_sample_rate(&out->stream.common); in adev_open_output_stream()
671 *stream_out = &out->stream; in adev_open_output_stream()