1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/mediaconvert/model/Vp8Settings.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 MediaConvert
17 {
18 namespace Model
19 {
20 
Vp8Settings()21 Vp8Settings::Vp8Settings() :
22     m_bitrate(0),
23     m_bitrateHasBeenSet(false),
24     m_framerateControl(Vp8FramerateControl::NOT_SET),
25     m_framerateControlHasBeenSet(false),
26     m_framerateConversionAlgorithm(Vp8FramerateConversionAlgorithm::NOT_SET),
27     m_framerateConversionAlgorithmHasBeenSet(false),
28     m_framerateDenominator(0),
29     m_framerateDenominatorHasBeenSet(false),
30     m_framerateNumerator(0),
31     m_framerateNumeratorHasBeenSet(false),
32     m_gopSize(0.0),
33     m_gopSizeHasBeenSet(false),
34     m_hrdBufferSize(0),
35     m_hrdBufferSizeHasBeenSet(false),
36     m_maxBitrate(0),
37     m_maxBitrateHasBeenSet(false),
38     m_parControl(Vp8ParControl::NOT_SET),
39     m_parControlHasBeenSet(false),
40     m_parDenominator(0),
41     m_parDenominatorHasBeenSet(false),
42     m_parNumerator(0),
43     m_parNumeratorHasBeenSet(false),
44     m_qualityTuningLevel(Vp8QualityTuningLevel::NOT_SET),
45     m_qualityTuningLevelHasBeenSet(false),
46     m_rateControlMode(Vp8RateControlMode::NOT_SET),
47     m_rateControlModeHasBeenSet(false)
48 {
49 }
50 
Vp8Settings(JsonView jsonValue)51 Vp8Settings::Vp8Settings(JsonView jsonValue) :
52     m_bitrate(0),
53     m_bitrateHasBeenSet(false),
54     m_framerateControl(Vp8FramerateControl::NOT_SET),
55     m_framerateControlHasBeenSet(false),
56     m_framerateConversionAlgorithm(Vp8FramerateConversionAlgorithm::NOT_SET),
57     m_framerateConversionAlgorithmHasBeenSet(false),
58     m_framerateDenominator(0),
59     m_framerateDenominatorHasBeenSet(false),
60     m_framerateNumerator(0),
61     m_framerateNumeratorHasBeenSet(false),
62     m_gopSize(0.0),
63     m_gopSizeHasBeenSet(false),
64     m_hrdBufferSize(0),
65     m_hrdBufferSizeHasBeenSet(false),
66     m_maxBitrate(0),
67     m_maxBitrateHasBeenSet(false),
68     m_parControl(Vp8ParControl::NOT_SET),
69     m_parControlHasBeenSet(false),
70     m_parDenominator(0),
71     m_parDenominatorHasBeenSet(false),
72     m_parNumerator(0),
73     m_parNumeratorHasBeenSet(false),
74     m_qualityTuningLevel(Vp8QualityTuningLevel::NOT_SET),
75     m_qualityTuningLevelHasBeenSet(false),
76     m_rateControlMode(Vp8RateControlMode::NOT_SET),
77     m_rateControlModeHasBeenSet(false)
78 {
79   *this = jsonValue;
80 }
81 
operator =(JsonView jsonValue)82 Vp8Settings& Vp8Settings::operator =(JsonView jsonValue)
83 {
84   if(jsonValue.ValueExists("bitrate"))
85   {
86     m_bitrate = jsonValue.GetInteger("bitrate");
87 
88     m_bitrateHasBeenSet = true;
89   }
90 
91   if(jsonValue.ValueExists("framerateControl"))
92   {
93     m_framerateControl = Vp8FramerateControlMapper::GetVp8FramerateControlForName(jsonValue.GetString("framerateControl"));
94 
95     m_framerateControlHasBeenSet = true;
96   }
97 
98   if(jsonValue.ValueExists("framerateConversionAlgorithm"))
99   {
100     m_framerateConversionAlgorithm = Vp8FramerateConversionAlgorithmMapper::GetVp8FramerateConversionAlgorithmForName(jsonValue.GetString("framerateConversionAlgorithm"));
101 
102     m_framerateConversionAlgorithmHasBeenSet = true;
103   }
104 
105   if(jsonValue.ValueExists("framerateDenominator"))
106   {
107     m_framerateDenominator = jsonValue.GetInteger("framerateDenominator");
108 
109     m_framerateDenominatorHasBeenSet = true;
110   }
111 
112   if(jsonValue.ValueExists("framerateNumerator"))
113   {
114     m_framerateNumerator = jsonValue.GetInteger("framerateNumerator");
115 
116     m_framerateNumeratorHasBeenSet = true;
117   }
118 
119   if(jsonValue.ValueExists("gopSize"))
120   {
121     m_gopSize = jsonValue.GetDouble("gopSize");
122 
123     m_gopSizeHasBeenSet = true;
124   }
125 
126   if(jsonValue.ValueExists("hrdBufferSize"))
127   {
128     m_hrdBufferSize = jsonValue.GetInteger("hrdBufferSize");
129 
130     m_hrdBufferSizeHasBeenSet = true;
131   }
132 
133   if(jsonValue.ValueExists("maxBitrate"))
134   {
135     m_maxBitrate = jsonValue.GetInteger("maxBitrate");
136 
137     m_maxBitrateHasBeenSet = true;
138   }
139 
140   if(jsonValue.ValueExists("parControl"))
141   {
142     m_parControl = Vp8ParControlMapper::GetVp8ParControlForName(jsonValue.GetString("parControl"));
143 
144     m_parControlHasBeenSet = true;
145   }
146 
147   if(jsonValue.ValueExists("parDenominator"))
148   {
149     m_parDenominator = jsonValue.GetInteger("parDenominator");
150 
151     m_parDenominatorHasBeenSet = true;
152   }
153 
154   if(jsonValue.ValueExists("parNumerator"))
155   {
156     m_parNumerator = jsonValue.GetInteger("parNumerator");
157 
158     m_parNumeratorHasBeenSet = true;
159   }
160 
161   if(jsonValue.ValueExists("qualityTuningLevel"))
162   {
163     m_qualityTuningLevel = Vp8QualityTuningLevelMapper::GetVp8QualityTuningLevelForName(jsonValue.GetString("qualityTuningLevel"));
164 
165     m_qualityTuningLevelHasBeenSet = true;
166   }
167 
168   if(jsonValue.ValueExists("rateControlMode"))
169   {
170     m_rateControlMode = Vp8RateControlModeMapper::GetVp8RateControlModeForName(jsonValue.GetString("rateControlMode"));
171 
172     m_rateControlModeHasBeenSet = true;
173   }
174 
175   return *this;
176 }
177 
Jsonize() const178 JsonValue Vp8Settings::Jsonize() const
179 {
180   JsonValue payload;
181 
182   if(m_bitrateHasBeenSet)
183   {
184    payload.WithInteger("bitrate", m_bitrate);
185 
186   }
187 
188   if(m_framerateControlHasBeenSet)
189   {
190    payload.WithString("framerateControl", Vp8FramerateControlMapper::GetNameForVp8FramerateControl(m_framerateControl));
191   }
192 
193   if(m_framerateConversionAlgorithmHasBeenSet)
194   {
195    payload.WithString("framerateConversionAlgorithm", Vp8FramerateConversionAlgorithmMapper::GetNameForVp8FramerateConversionAlgorithm(m_framerateConversionAlgorithm));
196   }
197 
198   if(m_framerateDenominatorHasBeenSet)
199   {
200    payload.WithInteger("framerateDenominator", m_framerateDenominator);
201 
202   }
203 
204   if(m_framerateNumeratorHasBeenSet)
205   {
206    payload.WithInteger("framerateNumerator", m_framerateNumerator);
207 
208   }
209 
210   if(m_gopSizeHasBeenSet)
211   {
212    payload.WithDouble("gopSize", m_gopSize);
213 
214   }
215 
216   if(m_hrdBufferSizeHasBeenSet)
217   {
218    payload.WithInteger("hrdBufferSize", m_hrdBufferSize);
219 
220   }
221 
222   if(m_maxBitrateHasBeenSet)
223   {
224    payload.WithInteger("maxBitrate", m_maxBitrate);
225 
226   }
227 
228   if(m_parControlHasBeenSet)
229   {
230    payload.WithString("parControl", Vp8ParControlMapper::GetNameForVp8ParControl(m_parControl));
231   }
232 
233   if(m_parDenominatorHasBeenSet)
234   {
235    payload.WithInteger("parDenominator", m_parDenominator);
236 
237   }
238 
239   if(m_parNumeratorHasBeenSet)
240   {
241    payload.WithInteger("parNumerator", m_parNumerator);
242 
243   }
244 
245   if(m_qualityTuningLevelHasBeenSet)
246   {
247    payload.WithString("qualityTuningLevel", Vp8QualityTuningLevelMapper::GetNameForVp8QualityTuningLevel(m_qualityTuningLevel));
248   }
249 
250   if(m_rateControlModeHasBeenSet)
251   {
252    payload.WithString("rateControlMode", Vp8RateControlModeMapper::GetNameForVp8RateControlMode(m_rateControlMode));
253   }
254 
255   return payload;
256 }
257 
258 } // namespace Model
259 } // namespace MediaConvert
260 } // namespace Aws
261