1 /* 2 * Copyright (C) 2015 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 #include <media/AudioPolicy.h> 18 19 #include "TypeConverter.h" 20 21 namespace android { 22 23 #define MAKE_STRING_FROM_ENUM(string) { #string, string } 24 #define TERMINATOR { .literal = nullptr } 25 26 template <> 27 const DeviceCategoryConverter::Table DeviceCategoryConverter::mTable[] = { 28 MAKE_STRING_FROM_ENUM(DEVICE_CATEGORY_HEADSET), 29 MAKE_STRING_FROM_ENUM(DEVICE_CATEGORY_SPEAKER), 30 MAKE_STRING_FROM_ENUM(DEVICE_CATEGORY_EARPIECE), 31 MAKE_STRING_FROM_ENUM(DEVICE_CATEGORY_EXT_MEDIA), 32 TERMINATOR 33 }; 34 35 template <> 36 const MixTypeConverter::Table MixTypeConverter::mTable[] = { 37 MAKE_STRING_FROM_ENUM(MIX_TYPE_INVALID), 38 MAKE_STRING_FROM_ENUM(MIX_TYPE_PLAYERS), 39 MAKE_STRING_FROM_ENUM(MIX_TYPE_RECORDERS), 40 TERMINATOR 41 }; 42 43 template <> 44 const RouteFlagTypeConverter::Table RouteFlagTypeConverter::mTable[] = { 45 MAKE_STRING_FROM_ENUM(MIX_ROUTE_FLAG_RENDER), 46 MAKE_STRING_FROM_ENUM(MIX_ROUTE_FLAG_LOOP_BACK), 47 MAKE_STRING_FROM_ENUM(MIX_ROUTE_FLAG_ALL), 48 TERMINATOR 49 }; 50 51 template <> 52 const RuleTypeConverter::Table RuleTypeConverter::mTable[] = { 53 MAKE_STRING_FROM_ENUM(RULE_EXCLUSION_MASK), 54 MAKE_STRING_FROM_ENUM(RULE_MATCH_ATTRIBUTE_USAGE), 55 MAKE_STRING_FROM_ENUM(RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET), 56 MAKE_STRING_FROM_ENUM(RULE_MATCH_UID), 57 MAKE_STRING_FROM_ENUM(RULE_EXCLUDE_ATTRIBUTE_USAGE), 58 MAKE_STRING_FROM_ENUM(RULE_EXCLUDE_ATTRIBUTE_CAPTURE_PRESET), 59 MAKE_STRING_FROM_ENUM(RULE_EXCLUDE_UID), 60 TERMINATOR 61 }; 62 63 template class TypeConverter<DeviceCategoryTraits>; 64 template class TypeConverter<MixTypeTraits>; 65 template class TypeConverter<RouteFlagTraits>; 66 template class TypeConverter<RuleTraits>; 67 68 }; // namespace android 69