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/AacCodingMode.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 AacCodingModeMapper
21       {
22 
23         static const int AD_RECEIVER_MIX_HASH = HashingUtils::HashString("AD_RECEIVER_MIX");
24         static const int CODING_MODE_1_0_HASH = HashingUtils::HashString("CODING_MODE_1_0");
25         static const int CODING_MODE_1_1_HASH = HashingUtils::HashString("CODING_MODE_1_1");
26         static const int CODING_MODE_2_0_HASH = HashingUtils::HashString("CODING_MODE_2_0");
27         static const int CODING_MODE_5_1_HASH = HashingUtils::HashString("CODING_MODE_5_1");
28 
29 
GetAacCodingModeForName(const Aws::String & name)30         AacCodingMode GetAacCodingModeForName(const Aws::String& name)
31         {
32           int hashCode = HashingUtils::HashString(name.c_str());
33           if (hashCode == AD_RECEIVER_MIX_HASH)
34           {
35             return AacCodingMode::AD_RECEIVER_MIX;
36           }
37           else if (hashCode == CODING_MODE_1_0_HASH)
38           {
39             return AacCodingMode::CODING_MODE_1_0;
40           }
41           else if (hashCode == CODING_MODE_1_1_HASH)
42           {
43             return AacCodingMode::CODING_MODE_1_1;
44           }
45           else if (hashCode == CODING_MODE_2_0_HASH)
46           {
47             return AacCodingMode::CODING_MODE_2_0;
48           }
49           else if (hashCode == CODING_MODE_5_1_HASH)
50           {
51             return AacCodingMode::CODING_MODE_5_1;
52           }
53           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
54           if(overflowContainer)
55           {
56             overflowContainer->StoreOverflow(hashCode, name);
57             return static_cast<AacCodingMode>(hashCode);
58           }
59 
60           return AacCodingMode::NOT_SET;
61         }
62 
GetNameForAacCodingMode(AacCodingMode enumValue)63         Aws::String GetNameForAacCodingMode(AacCodingMode enumValue)
64         {
65           switch(enumValue)
66           {
67           case AacCodingMode::AD_RECEIVER_MIX:
68             return "AD_RECEIVER_MIX";
69           case AacCodingMode::CODING_MODE_1_0:
70             return "CODING_MODE_1_0";
71           case AacCodingMode::CODING_MODE_1_1:
72             return "CODING_MODE_1_1";
73           case AacCodingMode::CODING_MODE_2_0:
74             return "CODING_MODE_2_0";
75           case AacCodingMode::CODING_MODE_5_1:
76             return "CODING_MODE_5_1";
77           default:
78             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
79             if(overflowContainer)
80             {
81               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
82             }
83 
84             return {};
85           }
86         }
87 
88       } // namespace AacCodingModeMapper
89     } // namespace Model
90   } // namespace MediaLive
91 } // namespace Aws
92