Home | History | Annotate | Download | only in generic

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
103 alsa_device_profile * profile; /* Points to the alsa_device_profile in the audio_device */
116 size_t conversion_buffer_size; /* in bytes */
128 alsa_device_profile * profile; /* Points to the alsa_device_profile in the audio_device */
138 /* We may need to read more data from the device in order to data reduce to 16bit, 4chan */
142 size_t conversion_buffer_size; /* in bytes */
232 ALOGW("No usb-card found in /dev/snd");
325 void lock_input_stream(struct stream_in *in)
327 pthread_mutex_lock(&in->pre_lock);
328 pthread_mutex_lock(&in->lock);
329 pthread_mutex_unlock(&in->pre_lock);
379 * Relies on the framework to provide data in the specified format.
380 * This could change in the future.
690 * and we emulate any channel count discrepancies in out_write(). */
695 /* TODO The retry mechanism isn't implemented in AudioPolicyManager/AudioFlinger. */
737 * IN functions
754 const struct stream_in * in = ((const struct stream_in*)stream);
755 return proxy_get_period_size(&in->proxy) * audio_stream_in_frame_size(&(in->stream));
760 const struct stream_in *in = (const struct stream_in*)stream;
761 return in->hal_channel_mask;
780 struct stream_in *in = (struct stream_in *)stream;
782 lock_input_stream(in);
783 if (!in->standby) {
784 pthread_mutex_lock(&in->dev->lock);
785 proxy_close(&in->proxy);
786 pthread_mutex_unlock(&in->dev->lock);
787 in->standby = true;
790 pthread_mutex_unlock(&in->lock);
804 struct stream_in *in = (struct stream_in *)stream;
818 lock_input_stream(in);
819 pthread_mutex_lock(&in->dev->lock);
821 if (card >= 0 && device >= 0 && !profile_is_cached_for(in->profile, card, device)) {
823 if (!in->standby)
826 int saved_card = in->profile->card;
827 int saved_device = in->profile->device;
828 in->profile->card = card;
829 in->profile->device = device;
830 ret_value = profile_read_device_info(in->profile) ? 0 : -EINVAL;
832 in->profile->card = saved_card;
833 in->profile->device = saved_device;
838 pthread_mutex_unlock(&in->dev->lock);
839 pthread_mutex_unlock(&in->lock);
846 struct stream_in *in = (struct stream_in *)stream;
848 lock_input_stream(in);
849 pthread_mutex_lock(&in->dev->lock);
851 char * params_str = device_get_parameters(in->profile, keys);
853 pthread_mutex_unlock(&in->dev->lock);
854 pthread_mutex_unlock(&in->lock);
875 static int start_input_stream(struct stream_in *in)
877 ALOGV("ustart_input_stream(card:%d device:%d)", in->profile->card, in->profile->device);
879 return proxy_open(&in->proxy);
890 struct stream_in * in = (struct stream_in *)stream;
892 lock_input_stream(in);
893 if (in->standby) {
894 pthread_mutex_lock(&in->dev->lock);
895 ret = start_input_stream(in);
896 pthread_mutex_unlock(&in->dev->lock);
900 in->standby = false;
903 alsa_device_profile * profile = in->profile;
907 * number of bytes in the HAL format (16-bit, stereo).
910 int num_device_channels = proxy_get_channel_count(&in->proxy); /* what we told Alsa */
911 int num_req_channels = in->hal_channel_count; /* what we told AudioFlinger */
919 if (num_read_buff_bytes > in->conversion_buffer_size) {
922 in->conversion_buffer_size = num_read_buff_bytes;
923 in->conversion_buffer = realloc(in->conversion_buffer, in->conversion_buffer_size);
925 read_buff = in->conversion_buffer;
928 ret = proxy_read(&in->proxy, read_buff, num_read_buff_bytes);
936 audio_format_t audio_format = in_get_format(&(in->stream.common));
946 /* no need to acquire in->dev->lock to read mic_muted here as we don't change its state */
947 if (num_read_buff_bytes > 0 && in->dev->mic_muted)
954 pthread_mutex_unlock(&in->lock);
973 ALOGV("in adev_open_input_stream() rate:%" PRIu32 ", chanMask:0x%" PRIX32 ", fmt:%" PRIu8,
976 struct stream_in *in = (struct stream_in *)calloc(1, sizeof(struct stream_in));
979 if (in == NULL)
983 in->stream.common.get_sample_rate = in_get_sample_rate;
984 in->stream.common.set_sample_rate = in_set_sample_rate;
985 in->stream.common.get_buffer_size = in_get_buffer_size;
986 in->stream.common.get_channels = in_get_channels;
987 in->stream.common.get_format = in_get_format;
988 in->stream.common.set_format = in_set_format;
989 in->stream.common.standby = in_standby;
990 in->stream.common.dump = in_dump;
991 in->stream.common.set_parameters = in_set_parameters;
992 in->stream.common.get_parameters = in_get_parameters;
993 in->stream.common.add_audio_effect = in_add_audio_effect;
994 in->stream.common.remove_audio_effect = in_remove_audio_effect;
996 in->stream.set_gain = in_set_gain;
997 in->stream.read = in_read;
998 in->stream.get_input_frames_lost = in_get_input_frames_lost;
1000 pthread_mutex_init(&in->lock, (const pthread_mutexattr_t *) NULL);
1001 pthread_mutex_init(&in->pre_lock, (const pthread_mutexattr_t *) NULL);
1003 in->dev = (struct audio_device *)dev;
1004 pthread_mutex_lock(&in->dev->lock);
1006 in->profile = &in->dev->in_profile;
1012 parse_card_device_params(false, &(in->profile->card), &(in
1014 profile_read_device_info(in->profile);
1015 pthread_mutex_unlock(&in->dev->lock);
1019 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile);
1020 } else if (profile_is_sample_rate_valid(in->profile, config->sample_rate)) {
1024 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile);
1030 proxy_config.format = profile_get_default_format(in->profile);
1034 if (profile_is_format_valid(in->profile, fmt)) {
1038 proxy_config.format = profile_get_default_format(in->profile);
1049 proposed_channel_count = profile_get_default_channel_count(in->profile);
1056 in->hal_channel_count = proposed_channel_count;
1058 in->hal_channel_count = audio_channel_count_from_in_mask(config->channel_mask);
1061 in->hal_channel_mask = config->channel_mask;
1063 proxy_config.channels = profile_get_default_channel_count(in->profile);
1064 proxy_prepare(&in->proxy, in->profile, &proxy_config);
1066 in->standby = true;
1068 in->conversion_buffer = NULL;
1069 in->conversion_buffer_size = 0;
1071 *stream_in = &in->stream;
1078 struct stream_in *in = (struct stream_in *)stream;
1083 free(in->conversion_buffer);