Lines Matching defs:in
5 * you may not use this file except in compliance with the License.
10 * Unless required by applicable law or agreed to in writing, software
87 alsa_device_profile * profile; /* Points to the alsa_device_profile in the audio_device */
95 audio_channel_mask_t hal_channel_mask; /* USB devices deal in channel counts, not masks
106 size_t conversion_buffer_size; /* in bytes */
118 alsa_device_profile * profile; /* Points to the alsa_device_profile in the audio_device */
126 audio_channel_mask_t hal_channel_mask; /* USB devices deal in channel counts, not masks
134 /* We may need to read more data from the device in order to data reduce to 16bit, 4chan */
138 size_t conversion_buffer_size; /* in bytes */
206 * associated key/value pair is not found in the provided string.
317 * Relies on the framework to provide data in the specified format.
318 * This could change in the future.
637 // Validate the "logical" channel count against support in the "actual" profile.
639 // and store THAT in proxy_config.channels
643 /* TODO The retry mechanism isn't implemented in AudioPolicyManager/AudioFlinger. */
695 * IN functions
712 const struct stream_in * in = ((const struct stream_in*)stream);
713 return proxy_get_period_size(&in->proxy) * audio_stream_in_frame_size(&(in->stream));
718 const struct stream_in *in = (const struct stream_in*)stream;
719 return in->hal_channel_mask;
738 struct stream_in *in = (struct stream_in *)stream;
740 stream_lock(&in->lock);
741 if (!in->standby) {
742 device_lock(in->adev);
743 proxy_close(&in->proxy);
744 device_unlock(in->adev);
745 in->standby = true;
748 stream_unlock(&in->lock);
771 struct stream_in *in = (struct stream_in *)stream;
785 stream_lock(&in->lock);
786 device_lock(in->adev);
788 if (card >= 0 && device >= 0 && !profile_is_cached_for(in->profile, card, device)) {
790 if (!in->standby)
793 int saved_card = in->profile->card;
794 int saved_device = in->profile->device;
795 in->profile->card = card;
796 in->profile->device = device;
797 ret_value = profile_read_device_info(in->profile) ? 0 : -EINVAL;
799 in->profile->card = saved_card;
800 in->profile->device = saved_device;
805 device_unlock(in->adev);
806 stream_unlock(&in->lock);
813 struct stream_in *in = (struct stream_in *)stream;
815 stream_lock(&in->lock);
816 device_lock(in->adev);
818 char * params_str = device_get_parameters(in->profile, keys);
820 device_unlock(in->adev);
821 stream_unlock(&in->lock);
842 static int start_input_stream(struct stream_in *in)
844 ALOGV("start_input_stream(card:%d device:%d)", in->profile->card, in->profile->device);
846 return proxy_open(&in->proxy);
857 struct stream_in * in = (struct stream_in *)stream;
859 stream_lock(&in->lock);
860 if (in->standby) {
861 device_lock(in->adev);
862 ret = start_input_stream(in);
863 device_unlock(in->adev);
867 in->standby = false;
870 alsa_device_profile * profile = in->profile;
874 * number of bytes in the HAL format (16-bit, stereo).
877 int num_device_channels = proxy_get_channel_count(&in->proxy); /* what we told Alsa */
878 int num_req_channels = in->hal_channel_count; /* what we told AudioFlinger */
886 if (num_read_buff_bytes > in->conversion_buffer_size) {
889 in->conversion_buffer_size = num_read_buff_bytes;
890 in->conversion_buffer = realloc(in->conversion_buffer, in->conversion_buffer_size);
892 read_buff = in->conversion_buffer;
895 ret = proxy_read(&in->proxy, read_buff, num_read_buff_bytes);
903 audio_format_t audio_format = in_get_format(&(in->stream.common));
913 /* no need to acquire in->adev->lock to read mic_muted here as we don't change its state */
914 if (num_read_buff_bytes > 0 && in->adev->mic_muted)
921 stream_unlock(&in->lock);
942 struct stream_in *in = (struct stream_in *)calloc(1, sizeof(struct stream_in));
945 if (in == NULL) {
950 in->stream.common.get_sample_rate = in_get_sample_rate;
951 in->stream.common.set_sample_rate = in_set_sample_rate;
952 in->stream.common.get_buffer_size = in_get_buffer_size;
953 in->stream.common.get_channels = in_get_channels;
954 in->stream.common.get_format = in_get_format;
955 in->stream.common.set_format = in_set_format;
956 in->stream.common.standby = in_standby;
957 in->stream.common.dump = in_dump;
958 in->stream.common.set_parameters = in_set_parameters;
959 in->stream.common.get_parameters = in_get_parameters;
960 in->stream.common.add_audio_effect = in_add_audio_effect;
961 in->stream.common.remove_audio_effect = in_remove_audio_effect;
963 in->stream.set_gain = in_set_gain;
964 in->stream.read = in_read;
965 in->stream.get_input_frames_lost = in_get_input_frames_lost;
967 stream_lock_init(&in->lock);
969 in->adev = (struct audio_device *)hw_dev;
970 device_lock(in->adev);
972 in->profile = &in->adev->in_profile;
978 parse_card_device_params(address, &(in->profile->card), &(in->profile->device));
980 profile_read_device_info(in->profile);
984 config->sample_rate = profile_get_default_sample_rate(in->profile);
987 if (in->adev->device_sample_rate != 0 && /* we are playing, so lock the rate */
988 in->adev->device_sample_rate >= RATELOCK_THRESHOLD) {/* but only for high sample rates */
989 ret = config->sample_rate != in->adev->device_sample_rate ? -EINVAL : 0;
990 proxy_config.rate = config->sample_rate = in
991 } else if (profile_is_sample_rate_valid(in->profile, config->sample_rate)) {
992 in->adev->device_sample_rate = proxy_config.rate = config->sample_rate;
994 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile);
997 device_unlock(in->adev);
1001 proxy_config.format = profile_get_default_format(in->profile);
1005 if (profile_is_format_valid(in->profile, fmt)) {
1008 proxy_config.format = profile_get_default_format(in->profile);
1018 in->hal_channel_count = profile_get_default_channel_count(in->profile);
1022 in->hal_channel_count = audio_channel_count_from_in_mask(config->channel_mask);
1026 if (in->hal_channel_count > FCC_8) {
1027 in->hal_channel_count = FCC_8;
1034 in->hal_channel_mask = in->hal_channel_count <= FCC_2
1036 ? audio_channel_in_mask_from_count(in->hal_channel_count)
1038 : audio_channel_mask_for_index_assignment_from_count(in->hal_channel_count);
1041 if (in->hal_channel_mask != config->channel_mask &&
1043 config->channel_mask = in->hal_channel_mask;
1047 in->hal_channel_mask = config->channel_mask;
1051 // Validate the "logical" channel count against support in the "actual" profile.
1053 // and store THAT in proxy_config.channels
1055 profile_get_closest_channel_count(in->profile, in->hal_channel_count);
1056 proxy_prepare(&in->proxy, in->profile, &proxy_config);
1058 in->standby = true;
1060 in->conversion_buffer = NULL;
1061 in->conversion_buffer_size = 0;
1063 *stream_in = &in->stream;
1066 adev_add_stream_to_list(in->adev, &in->adev->input_stream_list, &in->list_node);
1069 // adev_close_input_stream() in this case.
1071 free(in);
1080 struct stream_in *in = (struct stream_in *)stream;
1081 ALOGV("adev_close_input_stream(c:%d d:%d)", in->profile->card, in->profile->device);
1083 adev_remove_stream_from_list(in->adev, &in->list_node);
1088 free(in->conversion_buffer);
1148 // use device_try_lock() in case we dumpsys during a deadlock