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
93 size_t conversion_buffer_size; /* in bytes */
112 /* We may need to read more data from the device in order to data reduce to 16bit, 4chan */
116 size_t conversion_buffer_size; /* in bytes */
125 * num_in_samples size of input buffer in SAMPLES
132 * This conversion is safe to do in-place (in_buff == out_buff).
139 * Move from front to back so that the conversion can be done in-place
142 /* we need 2 bytes in the output for every 3 bytes in the input */
159 * num_in_samples size of input buffer in SAMPLES
166 * This conversion is safe to do in-place (in_buff == out_buff).
172 * Move from front to back so that the conversion can be done in-place
272 * Relies on the framework to provide data in the specified format.
273 * This could change in the future.
562 * and we emulate any channel count discrepancies in out_write(). */
567 /* TODO The retry mechanism isn't implemented in AudioPolicyManager/AudioFlinger. */
610 * IN functions
627 const struct stream_in * in = ((const struct stream_in*)stream);
628 return proxy_get_period_size(&in->proxy) * audio_stream_in_frame_size(&(in->stream));
633 const struct stream_in *in = (const struct stream_in*)stream;
634 return audio_channel_in_mask_from_count(in->hal_channel_count);
660 struct stream_in *in = (struct stream_in *)stream;
662 pthread_mutex_lock(&in->dev->lock);
663 pthread_mutex_lock(&in->lock);
665 if (!in->standby) {
666 proxy_close(&in->proxy);
667 in->standby = true;
670 pthread_mutex_unlock(&in->lock);
671 pthread_mutex_unlock(&in->dev->lock);
683 ALOGV("usb: audio_hw::in in_set_parameters() keys:%s", kvpairs);
685 struct stream_in *in = (struct stream_in *)stream;
696 pthread_mutex_lock(&in->dev->lock);
697 pthread_mutex_lock(&in->lock);
708 if (card >= 0 && device >= 0 && !profile_is_cached_for(in->profile, card, device)) {
710 if (!in->standby)
713 int saved_card = in->profile->card;
714 int saved_device = in->profile->device;
715 in->profile->card = card;
716 in->profile->device = device;
717 ret_value = profile_read_device_info(in->profile) ? 0 : -EINVAL;
719 in->profile->card = saved_card;
720 in->profile->device = saved_device;
725 pthread_mutex_unlock(&in->lock);
726 pthread_mutex_unlock(&in->dev->lock);
735 struct stream_in *in = (struct stream_in *)stream;
737 pthread_mutex_lock(&in->dev->lock);
738 pthread_mutex_lock(&in->lock);
740 char * params_str = device_get_parameters(in->profile, keys);
742 pthread_mutex_unlock(&in->lock);
743 pthread_mutex_unlock(&in->dev->lock);
764 static int start_input_stream(struct stream_in *in)
767 in->profile->card, in->profile->device);
769 return proxy_open(&in->proxy);
780 struct stream_in * in = (struct stream_in *)stream;
782 pthread_mutex_lock(&in->dev->lock);
783 pthread_mutex_lock(&in->lock);
784 if (in->standby) {
785 if (start_input_stream(in) != 0) {
786 pthread_mutex_unlock(&in->dev->lock);
789 in->standby = false;
791 pthread_mutex_unlock(&in->dev->lock);
794 alsa_device_profile * profile = in->profile;
798 * number of bytes in the HAL format (16-bit, stereo).
801 int num_device_channels = proxy_get_channel_count(&in->proxy);
802 int num_req_channels = in->hal_channel_count;
808 enum pcm_format format = proxy_get_format(&in->proxy);
819 if (num_read_buff_bytes > in->conversion_buffer_size) {
822 in->conversion_buffer_size = num_read_buff_bytes;
823 in->conversion_buffer = realloc(in->conversion_buffer, in->conversion_buffer_size);
825 read_buff = in->conversion_buffer;
828 ret = proxy_read(&in->proxy, read_buff, num_read_buff_bytes);
831 * Do any conversions necessary to send the data in the format specified to/by the HAL
857 audio_format_t audio_format = in_get_format(&(in->stream.common));
867 /* no need to acquire in->dev->lock to read mic_muted here as we don't change its state */
868 if (num_read_buff_bytes > 0 && in->dev->mic_muted)
875 pthread_mutex_unlock(&in->lock);
894 ALOGV("usb: in adev_open_input_stream() rate:%" PRIu32 ", chanMask:0x%" PRIX32 ", fmt:%" PRIu8,
897 struct stream_in *in = (struct stream_in *)calloc(1, sizeof(struct stream_in));
900 if (in == NULL)
904 in->stream.common.get_sample_rate = in_get_sample_rate;
905 in->stream.common.set_sample_rate = in_set_sample_rate;
906 in->stream.common.get_buffer_size = in_get_buffer_size;
907 in->stream.common.get_channels = in_get_channels;
908 in->stream.common.get_format = in_get_format;
909 in->stream.common.set_format = in_set_format;
910 in->stream.common.standby = in_standby;
911 in->stream.common.dump = in_dump;
912 in->stream.common.set_parameters = in_set_parameters;
913 in->stream.common.get_parameters = in_get_parameters;
914 in->stream.common.add_audio_effect = in_add_audio_effect;
915 in->stream.common.remove_audio_effect = in_remove_audio_effect;
917 in->stream.set_gain = in_set_gain;
918 in->stream.read = in_read;
919 in->stream.get_input_frames_lost = in_get_input_frames_lost;
921 in->dev = (struct audio_device *)dev;
923 in->profile = &in->dev->in_profile;
930 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile);
931 } else if (profile_is_sample_rate_valid(in->profile, config->sample_rate)) {
934 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile);
958 unsigned proposed_channel_count = profile_get_default_channel_count(in->profile);
967 in->hal_channel_count = proposed_channel_count;
968 proxy_config.channels = profile_get_default_channel_count(in->profile);
969 proxy_prepare(&in->proxy, in->profile, &proxy_config);
971 in->standby = true;
973 in->conversion_buffer = NULL;
974 in->conversion_buffer_size = 0;
976 *stream_in = &in->stream;
983 struct stream_in *in = (struct stream_in *)stream;
988 free(in->conversion_buffer);