Home | History | Annotate | Download | only in usbaudio

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
88 alsa_device_profile * profile; /* Points to the alsa_device_profile in the audio_device */
96 audio_channel_mask_t hal_channel_mask; /* USB devices deal in channel counts, not masks
107 size_t conversion_buffer_size; /* in bytes */
119 alsa_device_profile * profile; /* Points to the alsa_device_profile in the audio_device */
127 audio_channel_mask_t hal_channel_mask; /* USB devices deal in channel counts, not masks
135 /* We may need to read more data from the device in order to data reduce to 16bit, 4chan */
139 size_t conversion_buffer_size; /* in bytes */
207 * associated key/value pair is not found in the provided string.
318 * Relies on the framework to provide data in the specified format.
319 * This could change in the future.
638 // Validate the "logical" channel count against support in the "actual" profile.
640 // and store THAT in proxy_config.channels
644 /* TODO The retry mechanism isn't implemented in AudioPolicyManager/AudioFlinger. */
696 * IN functions
713 const struct stream_in * in = ((const struct stream_in*)stream);
714 return proxy_get_period_size(&in->proxy) * audio_stream_in_frame_size(&(in->stream));
719 const struct stream_in *in = (const struct stream_in*)stream;
720 return in->hal_channel_mask;
739 struct stream_in *in = (struct stream_in *)stream;
741 stream_lock(&in->lock);
742 if (!in->standby) {
743 device_lock(in->adev);
744 proxy_close(&in->proxy);
745 device_unlock(in->adev);
746 in->standby = true;
749 stream_unlock(&in->lock);
772 struct stream_in *in = (struct stream_in *)stream;
786 stream_lock(&in->lock);
787 device_lock(in->adev);
789 if (card >= 0 && device >= 0 && !profile_is_cached_for(in->profile, card, device)) {
791 if (!in->standby)
794 int saved_card = in->profile->card;
795 int saved_device = in->profile->device;
796 in->profile->card = card;
797 in->profile->device = device;
798 ret_value = profile_read_device_info(in->profile) ? 0 : -EINVAL;
800 in->profile->card = saved_card;
801 in->profile->device = saved_device;
806 device_unlock(in->adev);
807 stream_unlock(&in->lock);
814 struct stream_in *in = (struct stream_in *)stream;
816 stream_lock(&in->lock);
817 device_lock(in->adev);
819 char * params_str = device_get_parameters(in->profile, keys);
821 device_unlock(in->adev);
822 stream_unlock(&in->lock);
843 static int start_input_stream(struct stream_in *in)
845 ALOGV("start_input_stream(card:%d device:%d)", in->profile->card, in->profile->device);
847 return proxy_open(&in->proxy);
858 struct stream_in * in = (struct stream_in *)stream;
860 stream_lock(&in->lock);
861 if (in->standby) {
862 device_lock(in->adev);
863 ret = start_input_stream(in);
864 device_unlock(in->adev);
868 in->standby = false;
871 alsa_device_profile * profile = in->profile;
875 * number of bytes in the HAL format (16-bit, stereo).
878 int num_device_channels = proxy_get_channel_count(&in->proxy); /* what we told Alsa */
879 int num_req_channels = in->hal_channel_count; /* what we told AudioFlinger */
887 if (num_read_buff_bytes > in->conversion_buffer_size) {
890 in->conversion_buffer_size = num_read_buff_bytes;
891 in->conversion_buffer = realloc(in->conversion_buffer, in->conversion_buffer_size);
893 read_buff = in->conversion_buffer;
896 ret = proxy_read(&in->proxy, read_buff, num_read_buff_bytes);
904 audio_format_t audio_format = in_get_format(&(in->stream.common));
914 /* no need to acquire in->adev->lock to read mic_muted here as we don't change its state */
915 if (num_read_buff_bytes > 0 && in->adev->mic_muted)
922 stream_unlock(&in->lock);
943 struct stream_in *in = (struct stream_in *)calloc(1, sizeof(struct stream_in));
946 if (in == NULL) {
951 in->stream.common.get_sample_rate = in_get_sample_rate;
952 in->stream.common.set_sample_rate = in_set_sample_rate;
953 in->stream.common.get_buffer_size = in_get_buffer_size;
954 in->stream.common.get_channels = in_get_channels;
955 in->stream.common.get_format = in_get_format;
956 in->stream.common.set_format = in_set_format;
957 in->stream.common.standby = in_standby;
958 in->stream.common.dump = in_dump;
959 in->stream.common.set_parameters = in_set_parameters;
960 in->stream.common.get_parameters = in_get_parameters;
961 in->stream.common.add_audio_effect = in_add_audio_effect;
962 in->stream.common.remove_audio_effect = in_remove_audio_effect;
964 in->stream.set_gain = in_set_gain;
965 in->stream.read = in_read;
966 in->stream.get_input_frames_lost = in_get_input_frames_lost;
968 stream_lock_init(&in->lock);
970 in->adev = (struct audio_device *)hw_dev;
971 device_lock(in->adev);
973 in->profile = &in->adev->in_profile;
979 parse_card_device_params(address, &(in->profile->card), &(in->profile->device));
981 profile_read_device_info(in->profile);
985 config->sample_rate = profile_get_default_sample_rate(in->profile);
988 if (in->adev->device_sample_rate != 0 && /* we are playing, so lock the rate */
989 in->adev->device_sample_rate >= RATELOCK_THRESHOLD) {/* but only for high sample rates */
990 ret = config->sample_rate != in->adev->device_sample_rate ? -EINVAL : 0;
991 proxy_config.rate = config->sample_rate = in
992 } else if (profile_is_sample_rate_valid(in->profile, config->sample_rate)) {
995 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile);
998 device_unlock(in->adev);
1002 proxy_config.format = profile_get_default_format(in->profile);
1006 if (profile_is_format_valid(in->profile, fmt)) {
1009 proxy_config.format = profile_get_default_format(in->profile);
1019 in->hal_channel_count = profile_get_default_channel_count(in->profile);
1023 in->hal_channel_count = audio_channel_count_from_in_mask(config->channel_mask);
1027 if (in->hal_channel_count > FCC_8) {
1028 in->hal_channel_count = FCC_8;
1035 in->hal_channel_mask = in->hal_channel_count <= FCC_2
1037 ? audio_channel_in_mask_from_count(in->hal_channel_count)
1039 : audio_channel_mask_for_index_assignment_from_count(in->hal_channel_count);
1042 if (in->hal_channel_mask != config->channel_mask &&
1044 config->channel_mask = in->hal_channel_mask;
1048 in->hal_channel_mask = config->channel_mask;
1052 // Validate the "logical" channel count against support in the "actual" profile.
1054 // and store THAT in proxy_config.channels
1056 profile_get_closest_channel_count(in->profile, in->hal_channel_count);
1057 ret = proxy_prepare(&in->proxy, in->profile, &proxy_config);
1059 in->standby = true;
1061 in->conversion_buffer = NULL;
1062 in->conversion_buffer_size = 0;
1064 *stream_in = &in->stream;
1067 adev_add_stream_to_list(in->adev, &in->adev->input_stream_list, &in->list_node);
1070 unsigned channel_count = proxy_get_channel_count(&in->proxy);
1074 config->format = audio_format_from_pcm_format(proxy_get_format(&in->proxy));
1075 config->sample_rate = proxy_get_sample_rate(&in->proxy);
1081 // adev_close_input_stream() in this case.
1083 free(in);
1092 struct stream_in *in = (struct stream_in *)stream;
1093 ALOGV("adev_close_input_stream(c:%d d:%d)", in->profile->card, in->profile->device);
1095 adev_remove_stream_from_list(in->adev, &in->list_node);
1100 free(in->conversion_buffer);
1160 // use device_try_lock() in case we dumpsys during a deadlock