1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/medialive/model/AudioType.h> 7 #include <aws/core/utils/HashingUtils.h> 8 #include <aws/core/Globals.h> 9 #include <aws/core/utils/EnumParseOverflowContainer.h> 10 11 using namespace Aws::Utils; 12 13 14 namespace Aws 15 { 16 namespace MediaLive 17 { 18 namespace Model 19 { 20 namespace AudioTypeMapper 21 { 22 23 static const int CLEAN_EFFECTS_HASH = HashingUtils::HashString("CLEAN_EFFECTS"); 24 static const int HEARING_IMPAIRED_HASH = HashingUtils::HashString("HEARING_IMPAIRED"); 25 static const int UNDEFINED_HASH = HashingUtils::HashString("UNDEFINED"); 26 static const int VISUAL_IMPAIRED_COMMENTARY_HASH = HashingUtils::HashString("VISUAL_IMPAIRED_COMMENTARY"); 27 28 GetAudioTypeForName(const Aws::String & name)29 AudioType GetAudioTypeForName(const Aws::String& name) 30 { 31 int hashCode = HashingUtils::HashString(name.c_str()); 32 if (hashCode == CLEAN_EFFECTS_HASH) 33 { 34 return AudioType::CLEAN_EFFECTS; 35 } 36 else if (hashCode == HEARING_IMPAIRED_HASH) 37 { 38 return AudioType::HEARING_IMPAIRED; 39 } 40 else if (hashCode == UNDEFINED_HASH) 41 { 42 return AudioType::UNDEFINED; 43 } 44 else if (hashCode == VISUAL_IMPAIRED_COMMENTARY_HASH) 45 { 46 return AudioType::VISUAL_IMPAIRED_COMMENTARY; 47 } 48 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 49 if(overflowContainer) 50 { 51 overflowContainer->StoreOverflow(hashCode, name); 52 return static_cast<AudioType>(hashCode); 53 } 54 55 return AudioType::NOT_SET; 56 } 57 GetNameForAudioType(AudioType enumValue)58 Aws::String GetNameForAudioType(AudioType enumValue) 59 { 60 switch(enumValue) 61 { 62 case AudioType::CLEAN_EFFECTS: 63 return "CLEAN_EFFECTS"; 64 case AudioType::HEARING_IMPAIRED: 65 return "HEARING_IMPAIRED"; 66 case AudioType::UNDEFINED: 67 return "UNDEFINED"; 68 case AudioType::VISUAL_IMPAIRED_COMMENTARY: 69 return "VISUAL_IMPAIRED_COMMENTARY"; 70 default: 71 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 72 if(overflowContainer) 73 { 74 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 75 } 76 77 return {}; 78 } 79 } 80 81 } // namespace AudioTypeMapper 82 } // namespace Model 83 } // namespace MediaLive 84 } // namespace Aws 85