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/Mp2Settings.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8
9 #include <utility>
10
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13
14 namespace Aws
15 {
16 namespace MediaLive
17 {
18 namespace Model
19 {
20
Mp2Settings()21 Mp2Settings::Mp2Settings() :
22 m_bitrate(0.0),
23 m_bitrateHasBeenSet(false),
24 m_codingMode(Mp2CodingMode::NOT_SET),
25 m_codingModeHasBeenSet(false),
26 m_sampleRate(0.0),
27 m_sampleRateHasBeenSet(false)
28 {
29 }
30
Mp2Settings(JsonView jsonValue)31 Mp2Settings::Mp2Settings(JsonView jsonValue) :
32 m_bitrate(0.0),
33 m_bitrateHasBeenSet(false),
34 m_codingMode(Mp2CodingMode::NOT_SET),
35 m_codingModeHasBeenSet(false),
36 m_sampleRate(0.0),
37 m_sampleRateHasBeenSet(false)
38 {
39 *this = jsonValue;
40 }
41
operator =(JsonView jsonValue)42 Mp2Settings& Mp2Settings::operator =(JsonView jsonValue)
43 {
44 if(jsonValue.ValueExists("bitrate"))
45 {
46 m_bitrate = jsonValue.GetDouble("bitrate");
47
48 m_bitrateHasBeenSet = true;
49 }
50
51 if(jsonValue.ValueExists("codingMode"))
52 {
53 m_codingMode = Mp2CodingModeMapper::GetMp2CodingModeForName(jsonValue.GetString("codingMode"));
54
55 m_codingModeHasBeenSet = true;
56 }
57
58 if(jsonValue.ValueExists("sampleRate"))
59 {
60 m_sampleRate = jsonValue.GetDouble("sampleRate");
61
62 m_sampleRateHasBeenSet = true;
63 }
64
65 return *this;
66 }
67
Jsonize() const68 JsonValue Mp2Settings::Jsonize() const
69 {
70 JsonValue payload;
71
72 if(m_bitrateHasBeenSet)
73 {
74 payload.WithDouble("bitrate", m_bitrate);
75
76 }
77
78 if(m_codingModeHasBeenSet)
79 {
80 payload.WithString("codingMode", Mp2CodingModeMapper::GetNameForMp2CodingMode(m_codingMode));
81 }
82
83 if(m_sampleRateHasBeenSet)
84 {
85 payload.WithDouble("sampleRate", m_sampleRate);
86
87 }
88
89 return payload;
90 }
91
92 } // namespace Model
93 } // namespace MediaLive
94 } // namespace Aws
95