1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <limits> 20 #include <type_traits> 21 22 #include <system/audio.h> 23 24 #include <android/media/AudioMix.h> 25 #include <android/media/AudioMixerAttributesInternal.h> 26 #include <android/media/AudioMixerBehavior.h> 27 #include <android/media/AudioMixCallbackFlag.h> 28 #include <android/media/AudioMixRouteFlag.h> 29 #include <android/media/AudioMixType.h> 30 #include <android/media/AudioOffloadMode.h> 31 #include <android/media/AudioPolicyForceUse.h> 32 #include <android/media/AudioPolicyForcedConfig.h> 33 #include <android/media/DeviceRole.h> 34 35 #include <media/AidlConversionUtil.h> 36 #include <media/AudioCommonTypes.h> 37 #include <media/AudioPolicy.h> 38 #include <android/media/AudioPolicyDeviceState.h> 39 40 namespace android { 41 42 ConversionResult<product_strategy_t> 43 aidl2legacy_int32_t_product_strategy_t(int32_t aidl); 44 ConversionResult<int32_t> 45 legacy2aidl_product_strategy_t_int32_t(product_strategy_t legacy); 46 47 ConversionResult<uint32_t> 48 aidl2legacy_AudioMixType_uint32_t(media::AudioMixType aidl); 49 ConversionResult<media::AudioMixType> 50 legacy2aidl_uint32_t_AudioMixType(uint32_t legacy); 51 52 ConversionResult<uint32_t> 53 aidl2legacy_AudioMixCallbackFlag_uint32_t(media::AudioMixCallbackFlag aidl); 54 ConversionResult<media::AudioMixCallbackFlag> 55 legacy2aidl_uint32_t_AudioMixCallbackFlag(uint32_t legacy); 56 57 ConversionResult<uint32_t> 58 aidl2legacy_AudioMixCallbackFlag_uint32_t_mask(int32_t aidl); 59 ConversionResult<int32_t> 60 legacy2aidl_uint32_t_AudioMixCallbackFlag_mask(uint32_t legacy); 61 62 ConversionResult<uint32_t> 63 aidl2legacy_AudioMixRouteFlag_uint32_t(media::AudioMixRouteFlag aidl); 64 ConversionResult<media::AudioMixRouteFlag> 65 legacy2aidl_uint32_t_AudioMixRouteFlag(uint32_t legacy); 66 67 ConversionResult<uint32_t> 68 aidl2legacy_AudioMixRouteFlag_uint32_t_mask(int32_t aidl); 69 ConversionResult<int32_t> 70 legacy2aidl_uint32_t_AudioMixRouteFlag_mask(uint32_t legacy); 71 72 ConversionResult<AudioMixMatchCriterion> 73 aidl2legacy_AudioMixMatchCriterion(const media::AudioMixMatchCriterion& aidl); 74 ConversionResult<media::AudioMixMatchCriterion> 75 legacy2aidl_AudioMixMatchCriterion(const AudioMixMatchCriterion& legacy); 76 77 ConversionResult<AudioMix> 78 aidl2legacy_AudioMix(const media::AudioMix& aidl); 79 ConversionResult<media::AudioMix> 80 legacy2aidl_AudioMix(const AudioMix& legacy); 81 82 ConversionResult<audio_policy_dev_state_t> 83 aidl2legacy_AudioPolicyDeviceState_audio_policy_dev_state_t(media::AudioPolicyDeviceState aidl); 84 ConversionResult<media::AudioPolicyDeviceState> 85 legacy2aidl_audio_policy_dev_state_t_AudioPolicyDeviceState(audio_policy_dev_state_t legacy); 86 87 ConversionResult<audio_policy_force_use_t> 88 aidl2legacy_AudioPolicyForceUse_audio_policy_force_use_t(media::AudioPolicyForceUse aidl); 89 ConversionResult<media::AudioPolicyForceUse> 90 legacy2aidl_audio_policy_force_use_t_AudioPolicyForceUse(audio_policy_force_use_t legacy); 91 92 ConversionResult<audio_policy_forced_cfg_t> 93 aidl2legacy_AudioPolicyForcedConfig_audio_policy_forced_cfg_t(media::AudioPolicyForcedConfig aidl); 94 ConversionResult<media::AudioPolicyForcedConfig> 95 legacy2aidl_audio_policy_forced_cfg_t_AudioPolicyForcedConfig(audio_policy_forced_cfg_t legacy); 96 97 ConversionResult<device_role_t> 98 aidl2legacy_DeviceRole_device_role_t(media::DeviceRole aidl); 99 ConversionResult<media::DeviceRole> 100 legacy2aidl_device_role_t_DeviceRole(device_role_t legacy); 101 102 ConversionResult<audio_offload_mode_t> 103 aidl2legacy_AudioOffloadMode_audio_offload_mode_t(media::AudioOffloadMode aidl); 104 ConversionResult<media::AudioOffloadMode> 105 legacy2aidl_audio_offload_mode_t_AudioOffloadMode(audio_offload_mode_t legacy); 106 107 ConversionResult<audio_mixer_behavior_t> 108 aidl2legacy_AudioMixerBehavior_audio_mixer_behavior_t(media::AudioMixerBehavior aidl); 109 ConversionResult<media::AudioMixerBehavior> 110 legacy2aidl_audio_mixer_behavior_t_AudioMixerBehavior(audio_mixer_behavior_t legacy); 111 112 ConversionResult<audio_mixer_attributes_t> 113 aidl2legacy_AudioMixerAttributesInternal_audio_mixer_attributes_t( 114 const media::AudioMixerAttributesInternal& aidl); 115 ConversionResult<media::AudioMixerAttributesInternal> 116 legacy2aidl_audio_mixer_attributes_t_AudioMixerAttributesInternal( 117 const audio_mixer_attributes_t& legacy); 118 119 } // namespace android 120