Lines Matching refs:out

89 static int start_output_stream(struct alsa_stream_out *out)  in start_output_stream()  argument
91 struct alsa_audio_device *adev = out->dev; in start_output_stream()
93 if (out->unavailable) in start_output_stream()
99 out->write_threshold = PLAYBACK_PERIOD_COUNT * PERIOD_SIZE; in start_output_stream()
100 out->config.start_threshold = PLAYBACK_PERIOD_START_THRESHOLD * PERIOD_SIZE; in start_output_stream()
101 out->config.avail_min = PERIOD_SIZE; in start_output_stream()
103out->pcm = pcm_open(CARD_OUT, PORT_CODEC, PCM_OUT | PCM_MMAP | PCM_NOIRQ | PCM_MONOTONIC, &out->co… in start_output_stream()
105 if (!pcm_is_ready(out->pcm)) { in start_output_stream()
106 ALOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm)); in start_output_stream()
107 pcm_close(out->pcm); in start_output_stream()
109 out->unavailable = true; in start_output_stream()
113 adev->active_output = out; in start_output_stream()
119 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_sample_rate() local
120 return out->config.rate; in out_get_sample_rate()
143 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_channels() local
144 return audio_channel_out_mask_from_count(out->config.channels); in out_get_channels()
150 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_format() local
151 return audio_format_from_pcm_format(out->config.format); in out_get_format()
160 static int do_output_standby(struct alsa_stream_out *out) in do_output_standby() argument
162 struct alsa_audio_device *adev = out->dev; in do_output_standby()
164 if (!out->standby) { in do_output_standby()
165 pcm_close(out->pcm); in do_output_standby()
166 out->pcm = NULL; in do_output_standby()
168 out->standby = 1; in do_output_standby()
176 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_standby() local
179 pthread_mutex_lock(&out->dev->lock); in out_standby()
180 pthread_mutex_lock(&out->lock); in out_standby()
181 status = do_output_standby(out); in out_standby()
182 pthread_mutex_unlock(&out->lock); in out_standby()
183 pthread_mutex_unlock(&out->dev->lock); in out_standby()
196 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_set_parameters() local
197 struct alsa_audio_device *adev = out->dev; in out_set_parameters()
208 pthread_mutex_lock(&out->lock); in out_set_parameters()
213 pthread_mutex_unlock(&out->lock); in out_set_parameters()
230 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_latency() local
231 return (PERIOD_SIZE * PLAYBACK_PERIOD_COUNT * 1000) / out->config.rate; in out_get_latency()
245 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_write() local
246 struct alsa_audio_device *adev = out->dev; in out_write()
255 pthread_mutex_lock(&out->lock); in out_write()
256 if (out->standby) { in out_write()
257 ret = start_output_stream(out); in out_write()
262 out->standby = 0; in out_write()
267 ret = pcm_mmap_write(out->pcm, buffer, out_frames * frame_size); in out_write()
269 out->written += out_frames; in out_write()
272 pthread_mutex_unlock(&out->lock); in out_write()
293 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_presentation_position() local
296 if (out->pcm) { in out_get_presentation_position()
298 if (pcm_get_htimestamp(out->pcm, &avail, timestamp) == 0) { in out_get_presentation_position()
299 size_t kernel_buffer_size = out->config.period_size * out->config.period_count; in out_get_presentation_position()
300 int64_t signed_frames = out->written - kernel_buffer_size + avail; in out_get_presentation_position()
430 struct alsa_stream_out *out; in adev_open_output_stream() local
438 out = (struct alsa_stream_out *)calloc(1, sizeof(struct alsa_stream_out)); in adev_open_output_stream()
439 if (!out) in adev_open_output_stream()
442 out->stream.common.get_sample_rate = out_get_sample_rate; in adev_open_output_stream()
443 out->stream.common.set_sample_rate = out_set_sample_rate; in adev_open_output_stream()
444 out->stream.common.get_buffer_size = out_get_buffer_size; in adev_open_output_stream()
445 out->stream.common.get_channels = out_get_channels; in adev_open_output_stream()
446 out->stream.common.get_format = out_get_format; in adev_open_output_stream()
447 out->stream.common.set_format = out_set_format; in adev_open_output_stream()
448 out->stream.common.standby = out_standby; in adev_open_output_stream()
449 out->stream.common.dump = out_dump; in adev_open_output_stream()
450 out->stream.common.set_parameters = out_set_parameters; in adev_open_output_stream()
451 out->stream.common.get_parameters = out_get_parameters; in adev_open_output_stream()
452 out->stream.common.add_audio_effect = out_add_audio_effect; in adev_open_output_stream()
453 out->stream.common.remove_audio_effect = out_remove_audio_effect; in adev_open_output_stream()
454 out->stream.get_latency = out_get_latency; in adev_open_output_stream()
455 out->stream.set_volume = out_set_volume; in adev_open_output_stream()
456 out->stream.write = out_write; in adev_open_output_stream()
457 out->stream.get_render_position = out_get_render_position; in adev_open_output_stream()
458 out->stream.get_next_write_timestamp = out_get_next_write_timestamp; in adev_open_output_stream()
459 out->stream.get_presentation_position = out_get_presentation_position; in adev_open_output_stream()
461 out->config.channels = CHANNEL_STEREO; in adev_open_output_stream()
462 out->config.rate = CODEC_SAMPLING_RATE; in adev_open_output_stream()
463 out->config.format = PCM_FORMAT_S16_LE; in adev_open_output_stream()
464 out->config.period_size = PERIOD_SIZE; in adev_open_output_stream()
465 out->config.period_count = PLAYBACK_PERIOD_COUNT; in adev_open_output_stream()
467 if (out->config.rate != config->sample_rate || in adev_open_output_stream()
469 out->config.format != pcm_format_from_audio_format(config->format) ) { in adev_open_output_stream()
470 config->sample_rate = out->config.rate; in adev_open_output_stream()
471 config->format = audio_format_from_pcm_format(out->config.format); in adev_open_output_stream()
477 out->config.channels, out->config.rate, out->config.format); in adev_open_output_stream()
479 out->dev = ladev; in adev_open_output_stream()
480 out->standby = 1; in adev_open_output_stream()
481 out->unavailable = false; in adev_open_output_stream()
483 config->format = out_get_format(&out->stream.common); in adev_open_output_stream()
484 config->channel_mask = out_get_channels(&out->stream.common); in adev_open_output_stream()
485 config->sample_rate = out_get_sample_rate(&out->stream.common); in adev_open_output_stream()
487 *stream_out = &out->stream; in adev_open_output_stream()