Lines Matching refs:out
105 static int start_output_stream(struct alsa_stream_out *out) in start_output_stream() argument
107 struct alsa_audio_device *adev = out->dev; in start_output_stream()
112 out->write_threshold = PLAYBACK_PERIOD_COUNT * PLAYBACK_PERIOD_SIZE; in start_output_stream()
113 out->config.start_threshold = PLAYBACK_PERIOD_START_THRESHOLD * PLAYBACK_PERIOD_SIZE; in start_output_stream()
114 out->config.avail_min = PLAYBACK_PERIOD_SIZE; in start_output_stream()
115 out->unavailable = true; in start_output_stream()
117 int out_port = get_audio_output_port(out->devices); in start_output_stream()
120 out->pcm = pcm_open(CARD_OUT, out_port, PCM_OUT | PCM_MONOTONIC, &out->config); in start_output_stream()
121 if ((out->pcm != NULL) && pcm_is_ready(out->pcm)) { in start_output_stream()
124 ALOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm)); in start_output_stream()
125 if (out->pcm != NULL) { in start_output_stream()
126 pcm_close(out->pcm); in start_output_stream()
127 out->pcm = NULL; in start_output_stream()
136 out->unavailable = false; in start_output_stream()
137 adev->active_output = out; in start_output_stream()
143 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_sample_rate() local
144 return out->config.rate; in out_get_sample_rate()
167 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_channels() local
168 return audio_channel_out_mask_from_count(out->config.channels); in out_get_channels()
174 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_format() local
175 return audio_format_from_pcm_format(out->config.format); in out_get_format()
184 static int do_output_standby(struct alsa_stream_out *out) in do_output_standby() argument
186 struct alsa_audio_device *adev = out->dev; in do_output_standby()
188 if (!out->standby) { in do_output_standby()
189 pcm_close(out->pcm); in do_output_standby()
190 out->pcm = NULL; in do_output_standby()
192 out->standby = 1; in do_output_standby()
201 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_standby() local
204 pthread_mutex_lock(&out->dev->lock); in out_standby()
205 pthread_mutex_lock(&out->lock); in out_standby()
206 status = do_output_standby(out); in out_standby()
207 pthread_mutex_unlock(&out->lock); in out_standby()
208 pthread_mutex_unlock(&out->dev->lock); in out_standby()
221 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_set_parameters() local
222 struct alsa_audio_device *adev = out->dev; in out_set_parameters()
233 pthread_mutex_lock(&out->lock); in out_set_parameters()
234 if (((out->devices & AUDIO_DEVICE_OUT_ALL) != val) && (val != 0)) { in out_set_parameters()
235 out->devices &= ~AUDIO_DEVICE_OUT_ALL; in out_set_parameters()
236 out->devices |= val; in out_set_parameters()
238 pthread_mutex_unlock(&out->lock); in out_set_parameters()
255 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_latency() local
256 return (PLAYBACK_PERIOD_SIZE * PLAYBACK_PERIOD_COUNT * 1000) / out->config.rate; in out_get_latency()
270 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_write() local
271 struct alsa_audio_device *adev = out->dev; in out_write()
275 ALOGV("%s: devices: %d, bytes %zu", __func__, out->devices, bytes); in out_write()
282 pthread_mutex_lock(&out->lock); in out_write()
283 if (out->standby) { in out_write()
284 ret = start_output_stream(out); in out_write()
289 out->standby = 0; in out_write()
296 ret = pcm_write(out->pcm, buffer, out_frames * frame_size); in out_write()
298 out->frames_written += out_frames; in out_write()
301 get_pcm_timestamp(out->pcm, out->config.rate, &info, true /*isOutput*/); in out_write()
302 out->timestamp = info.timestamp; in out_write()
311 pthread_mutex_unlock(&out->lock); in out_write()
334 struct alsa_stream_out* out = (struct alsa_stream_out*)stream; in out_get_presentation_position() local
336 *frames = out->frames_written; in out_get_presentation_position()
337 *timestamp = out->timestamp; in out_get_presentation_position()
734 struct alsa_stream_out *out; in adev_open_output_stream() local
744 out = (struct alsa_stream_out *)calloc(1, sizeof(struct alsa_stream_out)); in adev_open_output_stream()
745 if (!out) in adev_open_output_stream()
748 out->stream.common.get_sample_rate = out_get_sample_rate; in adev_open_output_stream()
749 out->stream.common.set_sample_rate = out_set_sample_rate; in adev_open_output_stream()
750 out->stream.common.get_buffer_size = out_get_buffer_size; in adev_open_output_stream()
751 out->stream.common.get_channels = out_get_channels; in adev_open_output_stream()
752 out->stream.common.get_format = out_get_format; in adev_open_output_stream()
753 out->stream.common.set_format = out_set_format; in adev_open_output_stream()
754 out->stream.common.standby = out_standby; in adev_open_output_stream()
755 out->stream.common.dump = out_dump; in adev_open_output_stream()
756 out->stream.common.set_parameters = out_set_parameters; in adev_open_output_stream()
757 out->stream.common.get_parameters = out_get_parameters; in adev_open_output_stream()
758 out->stream.common.add_audio_effect = out_add_audio_effect; in adev_open_output_stream()
759 out->stream.common.remove_audio_effect = out_remove_audio_effect; in adev_open_output_stream()
760 out->stream.get_latency = out_get_latency; in adev_open_output_stream()
761 out->stream.set_volume = out_set_volume; in adev_open_output_stream()
762 out->stream.write = out_write; in adev_open_output_stream()
763 out->stream.get_render_position = out_get_render_position; in adev_open_output_stream()
764 out->stream.get_next_write_timestamp = out_get_next_write_timestamp; in adev_open_output_stream()
765 out->stream.get_presentation_position = out_get_presentation_position; in adev_open_output_stream()
767 out->config.channels = CHANNEL_STEREO; in adev_open_output_stream()
768 out->config.rate = PLAYBACK_CODEC_SAMPLING_RATE; in adev_open_output_stream()
769 out->config.format = PCM_FORMAT_S16_LE; in adev_open_output_stream()
770 out->config.period_size = PLAYBACK_PERIOD_SIZE; in adev_open_output_stream()
771 out->config.period_count = PLAYBACK_PERIOD_COUNT; in adev_open_output_stream()
773 if (out->config.rate != config->sample_rate || in adev_open_output_stream()
775 out->config.format != pcm_format_from_audio_format(config->format) ) { in adev_open_output_stream()
776 config->sample_rate = out->config.rate; in adev_open_output_stream()
777 config->format = audio_format_from_pcm_format(out->config.format); in adev_open_output_stream()
783 out->config.channels, out->config.rate, out->config.format, devices); in adev_open_output_stream()
785 out->dev = ladev; in adev_open_output_stream()
786 out->standby = 1; in adev_open_output_stream()
787 out->unavailable = false; in adev_open_output_stream()
788 out->devices = devices; in adev_open_output_stream()
790 config->format = out_get_format(&out->stream.common); in adev_open_output_stream()
791 config->channel_mask = out_get_channels(&out->stream.common); in adev_open_output_stream()
792 config->sample_rate = out_get_sample_rate(&out->stream.common); in adev_open_output_stream()
794 *stream_out = &out->stream; in adev_open_output_stream()
800 int aec_ret = init_aec_reference_config(ladev->aec, out); in adev_open_output_stream()