Lines Matching refs:in

703     const struct stream_in * in = ((const struct stream_in*)stream);  in in_get_buffer_size()  local
704 return proxy_get_period_size(&in->proxy) * audio_stream_in_frame_size(&(in->stream)); in in_get_buffer_size()
709 const struct stream_in *in = (const struct stream_in*)stream; in in_get_channels() local
710 return in->hal_channel_mask; in in_get_channels()
729 struct stream_in *in = (struct stream_in *)stream; in in_standby() local
731 stream_lock(&in->lock); in in_standby()
732 if (!in->standby) { in in_standby()
733 proxy_close(&in->proxy); in in_standby()
734 in->standby = true; in in_standby()
736 stream_unlock(&in->lock); in in_standby()
759 struct stream_in *in = (struct stream_in *)stream; in in_set_parameters() local
770 stream_lock(&in->lock); in in_set_parameters()
771 device_lock(in->adev); in in_set_parameters()
773 if (card >= 0 && device >= 0 && !profile_is_cached_for(&in->profile, card, device)) { in in_set_parameters()
775 if (!in->standby || in->adev->inputs_open > 1) in in_set_parameters()
778 int saved_card = in->profile.card; in in_set_parameters()
779 int saved_device = in->profile.device; in in_set_parameters()
780 in->profile.card = card; in in_set_parameters()
781 in->profile.device = device; in in_set_parameters()
782 ret_value = profile_read_device_info(&in->profile) ? 0 : -EINVAL; in in_set_parameters()
785 in->profile.card = saved_card; in in_set_parameters()
786 in->profile.device = saved_device; in in_set_parameters()
791 device_unlock(in->adev); in in_set_parameters()
792 stream_unlock(&in->lock); in in_set_parameters()
799 struct stream_in *in = (struct stream_in *)stream; in in_get_parameters() local
801 stream_lock(&in->lock); in in_get_parameters()
802 char * params_str = device_get_parameters(&in->profile, keys); in in_get_parameters()
803 stream_unlock(&in->lock); in in_get_parameters()
824 static int start_input_stream(struct stream_in *in) in start_input_stream() argument
826 ALOGV("start_input_stream(card:%d device:%d)", in->profile.card, in->profile.device); in start_input_stream()
828 return proxy_open(&in->proxy); in start_input_stream()
839 struct stream_in * in = (struct stream_in *)stream; in in_read() local
841 stream_lock(&in->lock); in in_read()
842 if (in->standby) { in in_read()
843 ret = start_input_stream(in); in in_read()
847 in->standby = false; in in_read()
855 int num_device_channels = proxy_get_channel_count(&in->proxy); /* what we told Alsa */ in in_read()
856 int num_req_channels = in->hal_channel_count; /* what we told AudioFlinger */ in in_read()
864 if (num_read_buff_bytes > in->conversion_buffer_size) { in in_read()
867 in->conversion_buffer_size = num_read_buff_bytes; in in_read()
868 in->conversion_buffer = realloc(in->conversion_buffer, in->conversion_buffer_size); in in_read()
870 read_buff = in->conversion_buffer; in in_read()
873 ret = proxy_read(&in->proxy, read_buff, num_read_buff_bytes); in in_read()
881 audio_format_t audio_format = in_get_format(&(in->stream.common)); in in_read()
892 if (num_read_buff_bytes > 0 && in->adev->mic_muted) in in_read()
899 stream_unlock(&in->lock); in in_read()
911 struct stream_in *in = (struct stream_in *)stream; // discard const qualifier in in_get_capture_position() local
912 stream_lock(&in->lock); in in_get_capture_position()
914 const alsa_device_proxy *proxy = &in->proxy; in in_get_capture_position()
917 stream_unlock(&in->lock); in in_get_capture_position()
965 struct stream_in * const in = (struct stream_in *)calloc(1, sizeof(struct stream_in)); in adev_open_input_stream() local
966 if (in == NULL) { in adev_open_input_stream()
972 in->stream.common.get_sample_rate = in_get_sample_rate; in adev_open_input_stream()
973 in->stream.common.set_sample_rate = in_set_sample_rate; in adev_open_input_stream()
974 in->stream.common.get_buffer_size = in_get_buffer_size; in adev_open_input_stream()
975 in->stream.common.get_channels = in_get_channels; in adev_open_input_stream()
976 in->stream.common.get_format = in_get_format; in adev_open_input_stream()
977 in->stream.common.set_format = in_set_format; in adev_open_input_stream()
978 in->stream.common.standby = in_standby; in adev_open_input_stream()
979 in->stream.common.dump = in_dump; in adev_open_input_stream()
980 in->stream.common.set_parameters = in_set_parameters; in adev_open_input_stream()
981 in->stream.common.get_parameters = in_get_parameters; in adev_open_input_stream()
982 in->stream.common.add_audio_effect = in_add_audio_effect; in adev_open_input_stream()
983 in->stream.common.remove_audio_effect = in_remove_audio_effect; in adev_open_input_stream()
985 in->stream.set_gain = in_set_gain; in adev_open_input_stream()
986 in->stream.read = in_read; in adev_open_input_stream()
987 in->stream.get_input_frames_lost = in_get_input_frames_lost; in adev_open_input_stream()
988 in->stream.get_capture_position = in_get_capture_position; in adev_open_input_stream()
990 in->stream.get_active_microphones = in_get_active_microphones; in adev_open_input_stream()
991 in->stream.set_microphone_direction = in_set_microphone_direction; in adev_open_input_stream()
992 in->stream.set_microphone_field_dimension = in_set_microphone_field_dimension; in adev_open_input_stream()
994 stream_lock_init(&in->lock); in adev_open_input_stream()
996 in->adev = (struct audio_device *)hw_dev; in adev_open_input_stream()
998 profile_init(&in->profile, PCM_IN); in adev_open_input_stream()
1004 device_lock(in->adev); in adev_open_input_stream()
1005 int num_open_inputs = in->adev->inputs_open; in adev_open_input_stream()
1006 device_unlock(in->adev); in adev_open_input_stream()
1010 if (!profile_is_cached_for(&in->profile, card, device)) { in adev_open_input_stream()
1017 in->profile.card = card; in adev_open_input_stream()
1018 in->profile.device = device; in adev_open_input_stream()
1019 if (!profile_read_device_info(&in->profile)) { in adev_open_input_stream()
1025 free(in); in adev_open_input_stream()
1033 config->sample_rate = profile_get_default_sample_rate(&in->profile); in adev_open_input_stream()
1036 if (in->adev->device_sample_rate != 0 && /* we are playing, so lock the rate if possible */ in adev_open_input_stream()
1037 in->adev->device_sample_rate >= RATELOCK_THRESHOLD) {/* but only for high sample rates */ in adev_open_input_stream()
1038 if (config->sample_rate != in->adev->device_sample_rate) { in adev_open_input_stream()
1039 unsigned highest_rate = profile_get_highest_sample_rate(&in->profile); in adev_open_input_stream()
1044 min(highest_rate, in->adev->device_sample_rate); in adev_open_input_stream()
1054 } else if (profile_is_sample_rate_valid(&in->profile, config->sample_rate)) { in adev_open_input_stream()
1057 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(&in->profile); in adev_open_input_stream()
1063 proxy_config.format = profile_get_default_format(&in->profile); in adev_open_input_stream()
1067 if (profile_is_format_valid(&in->profile, fmt)) { in adev_open_input_stream()
1070 proxy_config.format = profile_get_default_format(&in->profile); in adev_open_input_stream()
1080 in->hal_channel_count = profile_get_default_channel_count(&in->profile); in adev_open_input_stream()
1084 in->hal_channel_count = audio_channel_count_from_in_mask(config->channel_mask); in adev_open_input_stream()
1088 if (in->hal_channel_count > FCC_8) { in adev_open_input_stream()
1089 in->hal_channel_count = FCC_8; in adev_open_input_stream()
1096 in->hal_channel_mask = in->hal_channel_count <= FCC_2 in adev_open_input_stream()
1098 ? audio_channel_in_mask_from_count(in->hal_channel_count) in adev_open_input_stream()
1100 : audio_channel_mask_for_index_assignment_from_count(in->hal_channel_count); in adev_open_input_stream()
1103 if (in->hal_channel_mask != config->channel_mask && in adev_open_input_stream()
1105 config->channel_mask = in->hal_channel_mask; in adev_open_input_stream()
1109 in->hal_channel_mask = config->channel_mask; in adev_open_input_stream()
1117 profile_get_closest_channel_count(&in->profile, in->hal_channel_count); in adev_open_input_stream()
1118 ret = proxy_prepare(&in->proxy, &in->profile, &proxy_config); in adev_open_input_stream()
1120 in->standby = true; in adev_open_input_stream()
1122 in->conversion_buffer = NULL; in adev_open_input_stream()
1123 in->conversion_buffer_size = 0; in adev_open_input_stream()
1125 *stream_in = &in->stream; in adev_open_input_stream()
1128 adev_add_stream_to_list(in->adev, &in->adev->input_stream_list, &in->list_node); in adev_open_input_stream()
1131 unsigned channel_count = proxy_get_channel_count(&in->proxy); in adev_open_input_stream()
1135 config->format = audio_format_from_pcm_format(proxy_get_format(&in->proxy)); in adev_open_input_stream()
1136 config->sample_rate = proxy_get_sample_rate(&in->proxy); in adev_open_input_stream()
1144 free(in); in adev_open_input_stream()
1147 device_lock(in->adev); in adev_open_input_stream()
1148 ++in->adev->inputs_open; in adev_open_input_stream()
1149 device_unlock(in->adev); in adev_open_input_stream()
1157 struct stream_in *in = (struct stream_in *)stream; in adev_close_input_stream() local
1158 ALOGV("adev_close_input_stream(c:%d d:%d)", in->profile.card, in->profile.device); in adev_close_input_stream()
1160 adev_remove_stream_from_list(in->adev, &in->list_node); in adev_close_input_stream()
1162 device_lock(in->adev); in adev_close_input_stream()
1163 --in->adev->inputs_open; in adev_close_input_stream()
1164 LOG_ALWAYS_FATAL_IF(in->adev->inputs_open < 0, in adev_close_input_stream()
1165 "invalid inputs_open: %d", in->adev->inputs_open); in adev_close_input_stream()
1166 device_unlock(in->adev); in adev_close_input_stream()
1171 free(in->conversion_buffer); in adev_close_input_stream()