Lines Matching refs:port

249 void HidlUtils::audioPortFromHal(const struct audio_port& halPort, AudioPort* port) {
250 port->id = halPort.id;
251 port->role = AudioPortRole(halPort.role);
252 port->type = AudioPortType(halPort.type);
253 port->name.setToExternal(halPort.name, strlen(halPort.name));
254 port->sampleRates.resize(halPort.num_sample_rates);
256 port->sampleRates[i] = halPort.sample_rates[i];
258 port->channelMasks.resize(halPort.num_channel_masks);
260 port->channelMasks[i] = mkEnumConverter<AudioChannelMask>(halPort.channel_masks[i]);
262 port->formats.resize(halPort.num_formats);
264 port->formats[i] = AudioFormat(halPort.formats[i]);
266 port->gains.resize(halPort.num_gains);
268 audioGainFromHal(halPort.gains[i], &port->gains[i]);
270 audioPortConfigFromHal(halPort.active_config, &port->activeConfig);
275 port->ext.device.hwModule = halPort.ext.device.hw_module;
276 port->ext.device.type = AudioDevice(halPort.ext.device.type);
277 memcpy(port->ext.device.address.data(), halPort.ext.device.address,
282 port->ext.mix.hwModule = halPort.ext.mix.hw_module;
283 port->ext.mix.ioHandle = halPort.ext.mix.handle;
284 port->ext.mix.latencyClass = AudioMixLatencyClass(halPort.ext.mix.latency_class);
288 port->ext.session.session = halPort.ext.session.session;
294 void HidlUtils::audioPortToHal(const AudioPort& port, struct audio_port* halPort) {
296 halPort->id = port.id;
297 halPort->role = static_cast<audio_port_role_t>(port.role);
298 halPort->type = static_cast<audio_port_type_t>(port.type);
299 strncpy(halPort->name, port.name.c_str(), AUDIO_PORT_MAX_NAME_LEN);
302 std::min(port.sampleRates.size(), static_cast<size_t>(AUDIO_PORT_MAX_SAMPLING_RATES));
304 halPort->sample_rates[i] = port.sampleRates[i];
307 std::min(port.channelMasks.size(), static_cast<size_t>(AUDIO_PORT_MAX_CHANNEL_MASKS));
309 halPort->channel_masks[i] = static_cast<audio_channel_mask_t>(port.channelMasks[i]);
312 std::min(port.formats.size(), static_cast<size_t>(AUDIO_PORT_MAX_FORMATS));
314 halPort->formats[i] = static_cast<audio_format_t>(port.formats[i]);
316 halPort->num_gains = std::min(port.gains.size(), static_cast<size_t>(AUDIO_PORT_MAX_GAINS));
318 audioGainToHal(port.gains[i], &halPort->gains[i]);
320 audioPortConfigToHal(port.activeConfig, &halPort->active_config);
321 switch (port.type) {
325 halPort->ext.device.hw_module = port.ext.device.hwModule;
326 halPort->ext.device.type = static_cast<audio_devices_t>(port.ext.device.type);
327 memcpy(halPort->ext.device.address, port.ext.device.address.data(),
332 halPort->ext.mix.hw_module = port.ext.mix.hwModule;
333 halPort->ext.mix.handle = port.ext.mix.ioHandle;
335 static_cast<audio_mix_latency_class_t>(port.ext.mix.latencyClass);
339 halPort->ext.session.session = static_cast<audio_session_t>(port.ext.session.session);