Lines Matching refs:out
90 static int start_output_stream(struct alsa_stream_out *out) in start_output_stream() argument
92 struct alsa_audio_device *adev = out->dev; in start_output_stream()
94 if (out->unavailable) in start_output_stream()
100 out->write_threshold = PLAYBACK_PERIOD_COUNT * PERIOD_SIZE; in start_output_stream()
101 out->config.start_threshold = PLAYBACK_PERIOD_START_THRESHOLD * PERIOD_SIZE; in start_output_stream()
102 out->config.avail_min = PERIOD_SIZE; in start_output_stream()
104 …out->pcm = pcm_open(CARD_OUT, PORT_CODEC, PCM_OUT | PCM_MMAP | PCM_NOIRQ | PCM_MONOTONIC, &out->co… in start_output_stream()
106 if (!pcm_is_ready(out->pcm)) { in start_output_stream()
107 ALOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm)); in start_output_stream()
108 pcm_close(out->pcm); in start_output_stream()
110 out->unavailable = true; in start_output_stream()
114 adev->active_output = out; in start_output_stream()
120 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_sample_rate() local
121 return out->config.rate; in out_get_sample_rate()
144 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_channels() local
145 return audio_channel_out_mask_from_count(out->config.channels); in out_get_channels()
151 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_format() local
152 return audio_format_from_pcm_format(out->config.format); in out_get_format()
161 static int do_output_standby(struct alsa_stream_out *out) in do_output_standby() argument
163 struct alsa_audio_device *adev = out->dev; in do_output_standby()
165 if (!out->standby) { in do_output_standby()
166 pcm_close(out->pcm); in do_output_standby()
167 out->pcm = NULL; in do_output_standby()
169 out->standby = 1; in do_output_standby()
177 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_standby() local
180 pthread_mutex_lock(&out->dev->lock); in out_standby()
181 pthread_mutex_lock(&out->lock); in out_standby()
182 status = do_output_standby(out); in out_standby()
183 pthread_mutex_unlock(&out->lock); in out_standby()
184 pthread_mutex_unlock(&out->dev->lock); in out_standby()
197 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_set_parameters() local
198 struct alsa_audio_device *adev = out->dev; in out_set_parameters()
209 pthread_mutex_lock(&out->lock); in out_set_parameters()
214 pthread_mutex_unlock(&out->lock); in out_set_parameters()
231 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_latency() local
232 return (PERIOD_SIZE * PLAYBACK_PERIOD_COUNT * 1000) / out->config.rate; in out_get_latency()
246 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_write() local
247 struct alsa_audio_device *adev = out->dev; in out_write()
256 pthread_mutex_lock(&out->lock); in out_write()
257 if (out->standby) { in out_write()
258 ret = start_output_stream(out); in out_write()
263 out->standby = 0; in out_write()
268 ret = pcm_mmap_write(out->pcm, buffer, out_frames * frame_size); in out_write()
270 out->written += out_frames; in out_write()
273 pthread_mutex_unlock(&out->lock); in out_write()
294 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_presentation_position() local
297 if (out->pcm) { in out_get_presentation_position()
299 if (pcm_get_htimestamp(out->pcm, &avail, timestamp) == 0) { in out_get_presentation_position()
300 size_t kernel_buffer_size = out->config.period_size * out->config.period_count; in out_get_presentation_position()
301 int64_t signed_frames = out->written - kernel_buffer_size + avail; in out_get_presentation_position()
431 struct alsa_stream_out *out; in adev_open_output_stream() local
439 out = (struct alsa_stream_out *)calloc(1, sizeof(struct alsa_stream_out)); in adev_open_output_stream()
440 if (!out) in adev_open_output_stream()
443 out->stream.common.get_sample_rate = out_get_sample_rate; in adev_open_output_stream()
444 out->stream.common.set_sample_rate = out_set_sample_rate; in adev_open_output_stream()
445 out->stream.common.get_buffer_size = out_get_buffer_size; in adev_open_output_stream()
446 out->stream.common.get_channels = out_get_channels; in adev_open_output_stream()
447 out->stream.common.get_format = out_get_format; in adev_open_output_stream()
448 out->stream.common.set_format = out_set_format; in adev_open_output_stream()
449 out->stream.common.standby = out_standby; in adev_open_output_stream()
450 out->stream.common.dump = out_dump; in adev_open_output_stream()
451 out->stream.common.set_parameters = out_set_parameters; in adev_open_output_stream()
452 out->stream.common.get_parameters = out_get_parameters; in adev_open_output_stream()
453 out->stream.common.add_audio_effect = out_add_audio_effect; in adev_open_output_stream()
454 out->stream.common.remove_audio_effect = out_remove_audio_effect; in adev_open_output_stream()
455 out->stream.get_latency = out_get_latency; in adev_open_output_stream()
456 out->stream.set_volume = out_set_volume; in adev_open_output_stream()
457 out->stream.write = out_write; in adev_open_output_stream()
458 out->stream.get_render_position = out_get_render_position; in adev_open_output_stream()
459 out->stream.get_next_write_timestamp = out_get_next_write_timestamp; in adev_open_output_stream()
460 out->stream.get_presentation_position = out_get_presentation_position; in adev_open_output_stream()
462 out->config.channels = CHANNEL_STEREO; in adev_open_output_stream()
463 out->config.rate = CODEC_SAMPLING_RATE; in adev_open_output_stream()
464 out->config.format = PCM_FORMAT_S16_LE; in adev_open_output_stream()
465 out->config.period_size = PERIOD_SIZE; in adev_open_output_stream()
466 out->config.period_count = PLAYBACK_PERIOD_COUNT; in adev_open_output_stream()
468 if (out->config.rate != config->sample_rate || in adev_open_output_stream()
470 out->config.format != pcm_format_from_audio_format(config->format) ) { in adev_open_output_stream()
471 config->sample_rate = out->config.rate; in adev_open_output_stream()
472 config->format = audio_format_from_pcm_format(out->config.format); in adev_open_output_stream()
478 out->config.channels, out->config.rate, out->config.format); in adev_open_output_stream()
480 out->dev = ladev; in adev_open_output_stream()
481 out->standby = 1; in adev_open_output_stream()
482 out->unavailable = false; in adev_open_output_stream()
484 config->format = out_get_format(&out->stream.common); in adev_open_output_stream()
485 config->channel_mask = out_get_channels(&out->stream.common); in adev_open_output_stream()
486 config->sample_rate = out_get_sample_rate(&out->stream.common); in adev_open_output_stream()
488 *stream_out = &out->stream; in adev_open_output_stream()