Lines Matching refs:halPort

236 void HidlUtils::audioPortFromHal(const struct audio_port& halPort, AudioPort* port) {  in audioPortFromHal()  argument
237 port->id = halPort.id; in audioPortFromHal()
238 port->role = AudioPortRole(halPort.role); in audioPortFromHal()
239 port->type = AudioPortType(halPort.type); in audioPortFromHal()
240 port->name.setToExternal(halPort.name, strlen(halPort.name)); in audioPortFromHal()
241 port->sampleRates.resize(halPort.num_sample_rates); in audioPortFromHal()
242 for (size_t i = 0; i < halPort.num_sample_rates; ++i) { in audioPortFromHal()
243 port->sampleRates[i] = halPort.sample_rates[i]; in audioPortFromHal()
245 port->channelMasks.resize(halPort.num_channel_masks); in audioPortFromHal()
246 for (size_t i = 0; i < halPort.num_channel_masks; ++i) { in audioPortFromHal()
247 port->channelMasks[i] = EnumBitfield<AudioChannelMask>(halPort.channel_masks[i]); in audioPortFromHal()
249 port->formats.resize(halPort.num_formats); in audioPortFromHal()
250 for (size_t i = 0; i < halPort.num_formats; ++i) { in audioPortFromHal()
251 port->formats[i] = AudioFormat(halPort.formats[i]); in audioPortFromHal()
253 port->gains.resize(halPort.num_gains); in audioPortFromHal()
254 for (size_t i = 0; i < halPort.num_gains; ++i) { in audioPortFromHal()
255 audioGainFromHal(halPort.gains[i], &port->gains[i]); in audioPortFromHal()
257 audioPortConfigFromHal(halPort.active_config, &port->activeConfig); in audioPortFromHal()
258 switch (halPort.type) { in audioPortFromHal()
262 port->ext.device.hwModule = halPort.ext.device.hw_module; in audioPortFromHal()
263 port->ext.device.type = AudioDevice(halPort.ext.device.type); in audioPortFromHal()
264 memcpy(port->ext.device.address.data(), halPort.ext.device.address, in audioPortFromHal()
269 port->ext.mix.hwModule = halPort.ext.mix.hw_module; in audioPortFromHal()
270 port->ext.mix.ioHandle = halPort.ext.mix.handle; in audioPortFromHal()
271 port->ext.mix.latencyClass = AudioMixLatencyClass(halPort.ext.mix.latency_class); in audioPortFromHal()
275 port->ext.session.session = halPort.ext.session.session; in audioPortFromHal()
281 void HidlUtils::audioPortToHal(const AudioPort& port, struct audio_port* halPort) { in audioPortToHal() argument
282 memset(halPort, 0, sizeof(audio_port)); in audioPortToHal()
283 halPort->id = port.id; in audioPortToHal()
284 halPort->role = static_cast<audio_port_role_t>(port.role); in audioPortToHal()
285 halPort->type = static_cast<audio_port_type_t>(port.type); in audioPortToHal()
286 strncpy(halPort->name, port.name.c_str(), AUDIO_PORT_MAX_NAME_LEN); in audioPortToHal()
287 halPort->name[AUDIO_PORT_MAX_NAME_LEN - 1] = '\0'; in audioPortToHal()
288 halPort->num_sample_rates = in audioPortToHal()
290 for (size_t i = 0; i < halPort->num_sample_rates; ++i) { in audioPortToHal()
291 halPort->sample_rates[i] = port.sampleRates[i]; in audioPortToHal()
293 halPort->num_channel_masks = in audioPortToHal()
295 for (size_t i = 0; i < halPort->num_channel_masks; ++i) { in audioPortToHal()
296 halPort->channel_masks[i] = static_cast<audio_channel_mask_t>(port.channelMasks[i]); in audioPortToHal()
298 halPort->num_formats = in audioPortToHal()
300 for (size_t i = 0; i < halPort->num_formats; ++i) { in audioPortToHal()
301 halPort->formats[i] = static_cast<audio_format_t>(port.formats[i]); in audioPortToHal()
303 halPort->num_gains = std::min(port.gains.size(), static_cast<size_t>(AUDIO_PORT_MAX_GAINS)); in audioPortToHal()
304 for (size_t i = 0; i < halPort->num_gains; ++i) { in audioPortToHal()
305 audioGainToHal(port.gains[i], &halPort->gains[i]); in audioPortToHal()
307 audioPortConfigToHal(port.activeConfig, &halPort->active_config); in audioPortToHal()
312 halPort->ext.device.hw_module = port.ext.device.hwModule; in audioPortToHal()
313 halPort->ext.device.type = static_cast<audio_devices_t>(port.ext.device.type); in audioPortToHal()
314 memcpy(halPort->ext.device.address, port.ext.device.address.data(), in audioPortToHal()
319 halPort->ext.mix.hw_module = port.ext.mix.hwModule; in audioPortToHal()
320 halPort->ext.mix.handle = port.ext.mix.ioHandle; in audioPortToHal()
321 halPort->ext.mix.latency_class = in audioPortToHal()
326 halPort->ext.session.session = static_cast<audio_session_t>(port.ext.session.session); in audioPortToHal()