Lines Matching refs:in

712     const struct stream_in * in = ((const struct stream_in*)stream);  in in_get_buffer_size()  local
713 return proxy_get_period_size(&in->proxy) * audio_stream_in_frame_size(&(in->stream)); in in_get_buffer_size()
718 const struct stream_in *in = (const struct stream_in*)stream; in in_get_channels() local
719 return in->hal_channel_mask; in in_get_channels()
738 struct stream_in *in = (struct stream_in *)stream; in in_standby() local
740 stream_lock(&in->lock); in in_standby()
741 if (!in->standby) { in in_standby()
742 device_lock(in->adev); in in_standby()
743 proxy_close(&in->proxy); in in_standby()
744 device_unlock(in->adev); in in_standby()
745 in->standby = true; in in_standby()
748 stream_unlock(&in->lock); in in_standby()
771 struct stream_in *in = (struct stream_in *)stream; in in_set_parameters() local
785 stream_lock(&in->lock); in in_set_parameters()
786 device_lock(in->adev); in in_set_parameters()
788 if (card >= 0 && device >= 0 && !profile_is_cached_for(in->profile, card, device)) { in in_set_parameters()
790 if (!in->standby) in in_set_parameters()
793 int saved_card = in->profile->card; in in_set_parameters()
794 int saved_device = in->profile->device; in in_set_parameters()
795 in->profile->card = card; in in_set_parameters()
796 in->profile->device = device; in in_set_parameters()
797 ret_value = profile_read_device_info(in->profile) ? 0 : -EINVAL; in in_set_parameters()
799 in->profile->card = saved_card; in in_set_parameters()
800 in->profile->device = saved_device; in in_set_parameters()
805 device_unlock(in->adev); in in_set_parameters()
806 stream_unlock(&in->lock); in in_set_parameters()
813 struct stream_in *in = (struct stream_in *)stream; in in_get_parameters() local
815 stream_lock(&in->lock); in in_get_parameters()
816 device_lock(in->adev); in in_get_parameters()
818 char * params_str = device_get_parameters(in->profile, keys); in in_get_parameters()
820 device_unlock(in->adev); in in_get_parameters()
821 stream_unlock(&in->lock); in in_get_parameters()
842 static int start_input_stream(struct stream_in *in) in start_input_stream() argument
844 ALOGV("start_input_stream(card:%d device:%d)", in->profile->card, in->profile->device); in start_input_stream()
846 return proxy_open(&in->proxy); in start_input_stream()
857 struct stream_in * in = (struct stream_in *)stream; in in_read() local
859 stream_lock(&in->lock); in in_read()
860 if (in->standby) { in in_read()
861 device_lock(in->adev); in in_read()
862 ret = start_input_stream(in); in in_read()
863 device_unlock(in->adev); in in_read()
867 in->standby = false; in in_read()
870 alsa_device_profile * profile = in->profile; in in_read()
877 int num_device_channels = proxy_get_channel_count(&in->proxy); /* what we told Alsa */ in in_read()
878 int num_req_channels = in->hal_channel_count; /* what we told AudioFlinger */ in in_read()
886 if (num_read_buff_bytes > in->conversion_buffer_size) { in in_read()
889 in->conversion_buffer_size = num_read_buff_bytes; in in_read()
890 in->conversion_buffer = realloc(in->conversion_buffer, in->conversion_buffer_size); in in_read()
892 read_buff = in->conversion_buffer; in in_read()
895 ret = proxy_read(&in->proxy, read_buff, num_read_buff_bytes); in in_read()
903 audio_format_t audio_format = in_get_format(&(in->stream.common)); in in_read()
914 if (num_read_buff_bytes > 0 && in->adev->mic_muted) in in_read()
921 stream_unlock(&in->lock); in in_read()
942 struct stream_in *in = (struct stream_in *)calloc(1, sizeof(struct stream_in)); in adev_open_input_stream() local
945 if (in == NULL) { in adev_open_input_stream()
950 in->stream.common.get_sample_rate = in_get_sample_rate; in adev_open_input_stream()
951 in->stream.common.set_sample_rate = in_set_sample_rate; in adev_open_input_stream()
952 in->stream.common.get_buffer_size = in_get_buffer_size; in adev_open_input_stream()
953 in->stream.common.get_channels = in_get_channels; in adev_open_input_stream()
954 in->stream.common.get_format = in_get_format; in adev_open_input_stream()
955 in->stream.common.set_format = in_set_format; in adev_open_input_stream()
956 in->stream.common.standby = in_standby; in adev_open_input_stream()
957 in->stream.common.dump = in_dump; in adev_open_input_stream()
958 in->stream.common.set_parameters = in_set_parameters; in adev_open_input_stream()
959 in->stream.common.get_parameters = in_get_parameters; in adev_open_input_stream()
960 in->stream.common.add_audio_effect = in_add_audio_effect; in adev_open_input_stream()
961 in->stream.common.remove_audio_effect = in_remove_audio_effect; in adev_open_input_stream()
963 in->stream.set_gain = in_set_gain; in adev_open_input_stream()
964 in->stream.read = in_read; in adev_open_input_stream()
965 in->stream.get_input_frames_lost = in_get_input_frames_lost; in adev_open_input_stream()
967 stream_lock_init(&in->lock); in adev_open_input_stream()
969 in->adev = (struct audio_device *)hw_dev; in adev_open_input_stream()
970 device_lock(in->adev); in adev_open_input_stream()
972 in->profile = &in->adev->in_profile; in adev_open_input_stream()
978 parse_card_device_params(address, &(in->profile->card), &(in->profile->device)); in adev_open_input_stream()
980 profile_read_device_info(in->profile); in adev_open_input_stream()
984 config->sample_rate = profile_get_default_sample_rate(in->profile); in adev_open_input_stream()
987 if (in->adev->device_sample_rate != 0 && /* we are playing, so lock the rate */ in adev_open_input_stream()
988 in->adev->device_sample_rate >= RATELOCK_THRESHOLD) {/* but only for high sample rates */ in adev_open_input_stream()
989 ret = config->sample_rate != in->adev->device_sample_rate ? -EINVAL : 0; in adev_open_input_stream()
990 proxy_config.rate = config->sample_rate = in->adev->device_sample_rate; in adev_open_input_stream()
991 } else if (profile_is_sample_rate_valid(in->profile, config->sample_rate)) { in adev_open_input_stream()
994 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile); in adev_open_input_stream()
997 device_unlock(in->adev); in adev_open_input_stream()
1001 proxy_config.format = profile_get_default_format(in->profile); in adev_open_input_stream()
1005 if (profile_is_format_valid(in->profile, fmt)) { in adev_open_input_stream()
1008 proxy_config.format = profile_get_default_format(in->profile); in adev_open_input_stream()
1018 in->hal_channel_count = profile_get_default_channel_count(in->profile); in adev_open_input_stream()
1022 in->hal_channel_count = audio_channel_count_from_in_mask(config->channel_mask); in adev_open_input_stream()
1026 if (in->hal_channel_count > FCC_8) { in adev_open_input_stream()
1027 in->hal_channel_count = FCC_8; in adev_open_input_stream()
1034 in->hal_channel_mask = in->hal_channel_count <= FCC_2 in adev_open_input_stream()
1036 ? audio_channel_in_mask_from_count(in->hal_channel_count) in adev_open_input_stream()
1038 : audio_channel_mask_for_index_assignment_from_count(in->hal_channel_count); in adev_open_input_stream()
1041 if (in->hal_channel_mask != config->channel_mask && in adev_open_input_stream()
1043 config->channel_mask = in->hal_channel_mask; in adev_open_input_stream()
1047 in->hal_channel_mask = config->channel_mask; in adev_open_input_stream()
1055 profile_get_closest_channel_count(in->profile, in->hal_channel_count); in adev_open_input_stream()
1056 ret = proxy_prepare(&in->proxy, in->profile, &proxy_config); in adev_open_input_stream()
1058 in->standby = true; in adev_open_input_stream()
1060 in->conversion_buffer = NULL; in adev_open_input_stream()
1061 in->conversion_buffer_size = 0; in adev_open_input_stream()
1063 *stream_in = &in->stream; in adev_open_input_stream()
1066 adev_add_stream_to_list(in->adev, &in->adev->input_stream_list, &in->list_node); in adev_open_input_stream()
1069 unsigned channel_count = proxy_get_channel_count(&in->proxy); in adev_open_input_stream()
1073 config->format = audio_format_from_pcm_format(proxy_get_format(&in->proxy)); in adev_open_input_stream()
1074 config->sample_rate = proxy_get_sample_rate(&in->proxy); in adev_open_input_stream()
1082 free(in); in adev_open_input_stream()
1091 struct stream_in *in = (struct stream_in *)stream; in adev_close_input_stream() local
1092 ALOGV("adev_close_input_stream(c:%d d:%d)", in->profile->card, in->profile->device); in adev_close_input_stream()
1094 adev_remove_stream_from_list(in->adev, &in->list_node); in adev_close_input_stream()
1099 free(in->conversion_buffer); in adev_close_input_stream()