Lines Matching refs:halPort

258 status_t HidlUtils::audioPortFromHal(const struct audio_port& halPort, AudioPort* port) {  in audioPortFromHal()  argument
259 port->id = halPort.id; in audioPortFromHal()
260 port->role = AudioPortRole(halPort.role); in audioPortFromHal()
261 port->type = AudioPortType(halPort.type); in audioPortFromHal()
262 port->name.setToExternal(halPort.name, strlen(halPort.name)); in audioPortFromHal()
263 port->sampleRates.resize(halPort.num_sample_rates); in audioPortFromHal()
264 for (size_t i = 0; i < halPort.num_sample_rates; ++i) { in audioPortFromHal()
265 port->sampleRates[i] = halPort.sample_rates[i]; in audioPortFromHal()
267 port->channelMasks.resize(halPort.num_channel_masks); in audioPortFromHal()
268 for (size_t i = 0; i < halPort.num_channel_masks; ++i) { in audioPortFromHal()
269 port->channelMasks[i] = EnumBitfield<AudioChannelMask>(halPort.channel_masks[i]); in audioPortFromHal()
271 port->formats.resize(halPort.num_formats); in audioPortFromHal()
272 for (size_t i = 0; i < halPort.num_formats; ++i) { in audioPortFromHal()
273 port->formats[i] = AudioFormat(halPort.formats[i]); in audioPortFromHal()
275 port->gains.resize(halPort.num_gains); in audioPortFromHal()
276 for (size_t i = 0; i < halPort.num_gains; ++i) { in audioPortFromHal()
277 audioGainFromHal(halPort.gains[i], false /*isInput--ignored*/, &port->gains[i]); in audioPortFromHal()
279 audioPortConfigFromHal(halPort.active_config, &port->activeConfig); in audioPortFromHal()
280 switch (halPort.type) { in audioPortFromHal()
284 port->ext.device.hwModule = halPort.ext.device.hw_module; in audioPortFromHal()
285 port->ext.device.type = AudioDevice(halPort.ext.device.type); in audioPortFromHal()
286 memcpy(port->ext.device.address.data(), halPort.ext.device.address, in audioPortFromHal()
291 port->ext.mix.hwModule = halPort.ext.mix.hw_module; in audioPortFromHal()
292 port->ext.mix.ioHandle = halPort.ext.mix.handle; in audioPortFromHal()
293 port->ext.mix.latencyClass = AudioMixLatencyClass(halPort.ext.mix.latency_class); in audioPortFromHal()
297 port->ext.session.session = halPort.ext.session.session; in audioPortFromHal()
304 status_t HidlUtils::audioPortToHal(const AudioPort& port, struct audio_port* halPort) { in audioPortToHal() argument
305 memset(halPort, 0, sizeof(audio_port)); in audioPortToHal()
306 halPort->id = port.id; in audioPortToHal()
307 halPort->role = static_cast<audio_port_role_t>(port.role); in audioPortToHal()
308 halPort->type = static_cast<audio_port_type_t>(port.type); in audioPortToHal()
309 strncpy(halPort->name, port.name.c_str(), AUDIO_PORT_MAX_NAME_LEN); in audioPortToHal()
310 halPort->name[AUDIO_PORT_MAX_NAME_LEN - 1] = '\0'; in audioPortToHal()
311 halPort->num_sample_rates = in audioPortToHal()
313 for (size_t i = 0; i < halPort->num_sample_rates; ++i) { in audioPortToHal()
314 halPort->sample_rates[i] = port.sampleRates[i]; in audioPortToHal()
316 halPort->num_channel_masks = in audioPortToHal()
318 for (size_t i = 0; i < halPort->num_channel_masks; ++i) { in audioPortToHal()
319 halPort->channel_masks[i] = static_cast<audio_channel_mask_t>(port.channelMasks[i]); in audioPortToHal()
321 halPort->num_formats = in audioPortToHal()
323 for (size_t i = 0; i < halPort->num_formats; ++i) { in audioPortToHal()
324 halPort->formats[i] = static_cast<audio_format_t>(port.formats[i]); in audioPortToHal()
326 halPort->num_gains = std::min(port.gains.size(), static_cast<size_t>(AUDIO_PORT_MAX_GAINS)); in audioPortToHal()
327 for (size_t i = 0; i < halPort->num_gains; ++i) { in audioPortToHal()
328 audioGainToHal(port.gains[i], &halPort->gains[i]); in audioPortToHal()
330 audioPortConfigToHal(port.activeConfig, &halPort->active_config); in audioPortToHal()
335 halPort->ext.device.hw_module = port.ext.device.hwModule; in audioPortToHal()
336 halPort->ext.device.type = static_cast<audio_devices_t>(port.ext.device.type); in audioPortToHal()
337 memcpy(halPort->ext.device.address, port.ext.device.address.data(), in audioPortToHal()
342 halPort->ext.mix.hw_module = port.ext.mix.hwModule; in audioPortToHal()
343 halPort->ext.mix.handle = port.ext.mix.ioHandle; in audioPortToHal()
344 halPort->ext.mix.latency_class = in audioPortToHal()
349 halPort->ext.session.session = static_cast<audio_session_t>(port.ext.session.session); in audioPortToHal()