Lines Matching defs:out
235 * following order: hw device > out stream
239 * OUT functions
255 const struct stream_out* out = (const struct stream_out*)stream;
257 proxy_get_period_size(&out->proxy) * audio_stream_out_frame_size(&(out->stream));
263 const struct stream_out *out = (const struct stream_out*)stream;
264 return audio_channel_out_mask_from_count(out->hal_channel_count);
285 struct stream_out *out = (struct stream_out *)stream;
287 pthread_mutex_lock(&out->dev->lock);
288 pthread_mutex_lock(&out->lock);
290 if (!out->standby) {
291 proxy_close(&out->proxy);
292 out->standby = true;
295 pthread_mutex_unlock(&out->lock);
296 pthread_mutex_unlock(&out->dev->lock);
308 ALOGV("usb:audio_hw::out out_set_parameters() keys:%s", kvpairs);
310 struct stream_out *out = (struct stream_out *)stream;
320 pthread_mutex_lock(&out->dev->lock);
321 pthread_mutex_lock(&out->lock);
331 if (card >= 0 && device >= 0 && !profile_is_cached_for(out->profile, card, device)) {
333 if (!out->standby)
336 int saved_card = out->profile->card;
337 int saved_device = out->profile->device;
338 out->profile->card = card;
339 out->profile->device = device;
340 ret_value = profile_read_device_info(out->profile) ? 0 : -EINVAL;
342 out->profile->card = saved_card;
343 out->profile->device = saved_device;
348 pthread_mutex_unlock(&out->lock);
349 pthread_mutex_unlock(&out->dev->lock);
357 struct stream_out *out = (struct stream_out *)stream;
358 pthread_mutex_lock(&out->dev->lock);
359 pthread_mutex_lock(&out->lock);
361 char * params_str = device_get_parameters(out->profile, keys);
363 pthread_mutex_unlock(&out->lock);
364 pthread_mutex_unlock(&out->dev->lock);
381 static int start_output_stream(struct stream_out *out)
383 ALOGV("usb:audio_hw::out start_output_stream(card:%d device:%d)",
384 out->profile->card, out->profile->device);
386 return proxy_open(&out->proxy);
392 struct stream_out *out = (struct stream_out *)stream;
394 pthread_mutex_lock(&out->dev->lock);
395 pthread_mutex_lock(&out->lock);
396 if (out->standby) {
397 ret = start_output_stream(out);
399 pthread_mutex_unlock(&out->dev->lock);
402 out->standby = false;
404 pthread_mutex_unlock(&out->dev->lock);
406 alsa_device_proxy* proxy = &out->proxy;
410 const int num_req_channels = out->hal_channel_count; /* what we told AudioFlinger */
415 if (required_conversion_buffer_size > out->conversion_buffer_size) {
416 out->conversion_buffer_size = required_conversion_buffer_size;
417 out->conversion_buffer = realloc(out->conversion_buffer,
418 out->conversion_buffer_size);
421 const audio_format_t audio_format = out_get_format(&(out->stream.common));
425 out->conversion_buffer, num_device_channels,
427 write_buff = out->conversion_buffer;
431 proxy_write(&out->proxy, write_buff, num_write_buff_bytes);
434 pthread_mutex_unlock(&out->lock);
439 pthread_mutex_unlock(&out->lock);
483 ALOGV("usb:audio_hw::out adev_open_output_stream() handle:0x%X, device:0x%X, flags:0x%X",
488 struct stream_out *out;
490 out = (struct stream_out *)calloc(1, sizeof(struct stream_out));
491 if (!out)
495 out->stream.common.get_sample_rate = out_get_sample_rate;
496 out->stream.common.set_sample_rate = out_set_sample_rate;
497 out->stream.common.get_buffer_size = out_get_buffer_size;
498 out->stream.common.get_channels = out_get_channels;
499 out
500 out->stream.common.set_format = out_set_format;
501 out->stream.common.standby = out_standby;
502 out->stream.common.dump = out_dump;
503 out->stream.common.set_parameters = out_set_parameters;
504 out->stream.common.get_parameters = out_get_parameters;
505 out->stream.common.add_audio_effect = out_add_audio_effect;
506 out->stream.common.remove_audio_effect = out_remove_audio_effect;
507 out->stream.get_latency = out_get_latency;
508 out->stream.set_volume = out_set_volume;
509 out->stream.write = out_write;
510 out->stream.get_render_position = out_get_render_position;
511 out->stream.get_presentation_position = out_get_presentation_position;
512 out->stream.get_next_write_timestamp = out_get_next_write_timestamp;
514 out->dev = adev;
516 out->profile = &adev->out_profile;
526 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(out->profile);
527 } else if (profile_is_sample_rate_valid(out->profile, config->sample_rate)) {
530 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(out->profile);
536 proxy_config.format = profile_get_default_format(out->profile);
540 if (profile_is_format_valid(out->profile, fmt)) {
543 proxy_config.format = profile_get_default_format(out->profile);
550 unsigned proposed_channel_count = profile_get_default_channel_count(out->profile);
558 out->hal_channel_count = proposed_channel_count;
563 proxy_prepare(&out->proxy, out->profile, &proxy_config);
568 out->conversion_buffer = NULL;
569 out->conversion_buffer_size = 0;
571 out->standby = true;
573 *stream_out = &out->stream;
578 free(out);
586 ALOGV("usb:audio_hw::out adev_close_output_stream()");
587 struct stream_out *out = (struct stream_out *)stream;
592 free(out->conversion_buffer);
594 out->conversion_buffer = NULL;
595 out->conversion_buffer_size = 0;
806 * OK, we need to figure out how much data to read to be able to output the requested