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 */
110 /* We may need to read more data from the device in order to data reduce to 16bit, 4chan */
114 size_t conversion_buffer_size; /* in bytes */
123 * num_in_samples size of input buffer in SAMPLES
130 * This conversion is safe to do in-place (in_buff == out_buff).
137 * Move from front to back so that the conversion can be done in-place
140 /* we need 2 bytes in the output for every 3 bytes in the input */
157 * num_in_samples size of input buffer in SAMPLES
164 * This conversion is safe to do in-place (in_buff == out_buff).
170 * Move from front to back so that the conversion can be done in-place
270 * Relies on the framework to provide data in the specified format.
271 * This could change in the future.
560 * and we emulate any channel count discrepancies in out_write(). */
565 /* TODO The retry mechanism isn't implemented in AudioPolicyManager/AudioFlinger. */
608 * IN functions
625 const struct stream_in * in = ((const struct stream_in*)stream);
627 proxy_get_period_size(&in->proxy) * audio_stream_in_frame_size(&(in->stream));
670 struct stream_in *in = (struct stream_in *)stream;
672 pthread_mutex_lock(&in->dev->lock);
673 pthread_mutex_lock(&in->lock);
675 if (!in->standby) {
676 proxy_close(&in->proxy);
677 in->standby = true;
680 pthread_mutex_unlock(&in->lock);
681 pthread_mutex_unlock(&in->dev->lock);
693 ALOGV("usb: audio_hw::in in_set_parameters() keys:%s", kvpairs);
695 struct stream_in *in = (struct stream_in *)stream;
706 pthread_mutex_lock(&in->dev->lock);
707 pthread_mutex_lock(&in->lock);
718 if (card >= 0 && device >= 0 && !profile_is_cached_for(in->profile, card, device)) {
720 if (!in->standby)
723 int saved_card = in->profile->card;
724 int saved_device = in->profile->device;
725 in->profile->card = card;
726 in->profile->device = device;
727 ret_value = profile_read_device_info(in->profile) ? 0 : -EINVAL;
729 in->profile->card = saved_card;
730 in->profile->device = saved_device;
735 pthread_mutex_unlock(&in->lock);
736 pthread_mutex_unlock(&in->dev->lock);
745 struct stream_in *in = (struct stream_in *)stream;
747 pthread_mutex_lock(&in->dev->lock);
748 pthread_mutex_lock(&in->lock);
750 char * params_str = device_get_parameters(in->profile, keys);
752 pthread_mutex_unlock(&in->lock);
753 pthread_mutex_unlock(&in->dev->lock);
774 static int start_input_stream(struct stream_in *in)
777 in->profile->card, in->profile->device);
779 return proxy_open(&in->proxy);
789 struct stream_in * in = (struct stream_in *)stream;
791 pthread_mutex_lock(&in->dev->lock);
792 pthread_mutex_lock(&in->lock);
793 if (in->standby) {
794 if (start_input_stream(in) != 0) {
795 pthread_mutex_unlock(&in->dev->lock);
798 in->standby = false;
800 pthread_mutex_unlock(&in->dev->lock);
803 alsa_device_profile * profile = in->profile;
807 * number of bytes in the HAL format (16-bit, stereo).
810 int num_device_channels = proxy_get_channel_count(&in->proxy);
817 enum pcm_format format = proxy_get_format(&in->proxy);
828 if (num_read_buff_bytes > in->conversion_buffer_size) {
831 in->conversion_buffer_size = num_read_buff_bytes;
832 in->conversion_buffer = realloc(in->conversion_buffer, in->conversion_buffer_size);
834 read_buff = in->conversion_buffer;
837 if (proxy_read(&in->proxy, read_buff, num_read_buff_bytes) == 0) {
839 * Do any conversions necessary to send the data in the format specified to/by the HAL
865 audio_format_t audio_format = in_get_format(&(in->stream.common));
875 /* no need to acquire in->dev->lock to read mic_muted here as we don't change its state */
876 if (num_read_buff_bytes > 0 && in->dev->mic_muted)
881 pthread_mutex_unlock(&in->lock);
900 ALOGV("usb: in adev_open_input_stream() rate:%" PRIu32 ", chanMask:0x%" PRIX32 ", fmt:%" PRIu8,
903 struct stream_in *in = (struct stream_in *)calloc(1, sizeof(struct stream_in));
906 if (in == NULL)
910 in->stream.common.get_sample_rate = in_get_sample_rate;
911 in->stream.common.set_sample_rate = in_set_sample_rate;
912 in->stream.common.get_buffer_size = in_get_buffer_size;
913 in->stream.common.get_channels = in_get_channels;
914 in->stream.common.get_format = in_get_format;
915 in->stream.common.set_format = in_set_format;
916 in->stream.common.standby = in_standby;
917 in->stream.common.dump = in_dump;
918 in->stream.common.set_parameters = in_set_parameters;
919 in->stream.common.get_parameters = in_get_parameters;
920 in->stream.common.add_audio_effect = in_add_audio_effect;
921 in->stream.common.remove_audio_effect = in_remove_audio_effect;
923 in->stream.set_gain = in_set_gain;
924 in->stream.read = in_read;
925 in->stream.get_input_frames_lost = in_get_input_frames_lost;
927 in->dev = (struct audio_device *)dev;
929 in->profile = &in->dev->in_profile;
936 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile);
937 } else if (profile_is_sample_rate_valid(in->profile, config->sample_rate)) {
940 proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile);
974 proxy_config.channels = profile_get_default_channel_count(in->profile);
976 proxy_prepare(&in->proxy, in->profile, &proxy_config);
978 in->standby = true;
980 in->conversion_buffer = NULL;
981 in->conversion_buffer_size = 0;
983 *stream_in = &in->stream;
990 struct stream_in *in = (struct stream_in *)stream;
995 free(in->conversion_buffer);