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/H265Settings.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 
H265Settings()21 H265Settings::H265Settings() :
22     m_adaptiveQuantization(H265AdaptiveQuantization::NOT_SET),
23     m_adaptiveQuantizationHasBeenSet(false),
24     m_afdSignaling(AfdSignaling::NOT_SET),
25     m_afdSignalingHasBeenSet(false),
26     m_alternativeTransferFunction(H265AlternativeTransferFunction::NOT_SET),
27     m_alternativeTransferFunctionHasBeenSet(false),
28     m_bitrate(0),
29     m_bitrateHasBeenSet(false),
30     m_bufSize(0),
31     m_bufSizeHasBeenSet(false),
32     m_colorMetadata(H265ColorMetadata::NOT_SET),
33     m_colorMetadataHasBeenSet(false),
34     m_colorSpaceSettingsHasBeenSet(false),
35     m_filterSettingsHasBeenSet(false),
36     m_fixedAfd(FixedAfd::NOT_SET),
37     m_fixedAfdHasBeenSet(false),
38     m_flickerAq(H265FlickerAq::NOT_SET),
39     m_flickerAqHasBeenSet(false),
40     m_framerateDenominator(0),
41     m_framerateDenominatorHasBeenSet(false),
42     m_framerateNumerator(0),
43     m_framerateNumeratorHasBeenSet(false),
44     m_gopClosedCadence(0),
45     m_gopClosedCadenceHasBeenSet(false),
46     m_gopSize(0.0),
47     m_gopSizeHasBeenSet(false),
48     m_gopSizeUnits(H265GopSizeUnits::NOT_SET),
49     m_gopSizeUnitsHasBeenSet(false),
50     m_level(H265Level::NOT_SET),
51     m_levelHasBeenSet(false),
52     m_lookAheadRateControl(H265LookAheadRateControl::NOT_SET),
53     m_lookAheadRateControlHasBeenSet(false),
54     m_maxBitrate(0),
55     m_maxBitrateHasBeenSet(false),
56     m_minIInterval(0),
57     m_minIIntervalHasBeenSet(false),
58     m_parDenominator(0),
59     m_parDenominatorHasBeenSet(false),
60     m_parNumerator(0),
61     m_parNumeratorHasBeenSet(false),
62     m_profile(H265Profile::NOT_SET),
63     m_profileHasBeenSet(false),
64     m_qvbrQualityLevel(0),
65     m_qvbrQualityLevelHasBeenSet(false),
66     m_rateControlMode(H265RateControlMode::NOT_SET),
67     m_rateControlModeHasBeenSet(false),
68     m_scanType(H265ScanType::NOT_SET),
69     m_scanTypeHasBeenSet(false),
70     m_sceneChangeDetect(H265SceneChangeDetect::NOT_SET),
71     m_sceneChangeDetectHasBeenSet(false),
72     m_slices(0),
73     m_slicesHasBeenSet(false),
74     m_tier(H265Tier::NOT_SET),
75     m_tierHasBeenSet(false),
76     m_timecodeInsertion(H265TimecodeInsertionBehavior::NOT_SET),
77     m_timecodeInsertionHasBeenSet(false)
78 {
79 }
80 
H265Settings(JsonView jsonValue)81 H265Settings::H265Settings(JsonView jsonValue) :
82     m_adaptiveQuantization(H265AdaptiveQuantization::NOT_SET),
83     m_adaptiveQuantizationHasBeenSet(false),
84     m_afdSignaling(AfdSignaling::NOT_SET),
85     m_afdSignalingHasBeenSet(false),
86     m_alternativeTransferFunction(H265AlternativeTransferFunction::NOT_SET),
87     m_alternativeTransferFunctionHasBeenSet(false),
88     m_bitrate(0),
89     m_bitrateHasBeenSet(false),
90     m_bufSize(0),
91     m_bufSizeHasBeenSet(false),
92     m_colorMetadata(H265ColorMetadata::NOT_SET),
93     m_colorMetadataHasBeenSet(false),
94     m_colorSpaceSettingsHasBeenSet(false),
95     m_filterSettingsHasBeenSet(false),
96     m_fixedAfd(FixedAfd::NOT_SET),
97     m_fixedAfdHasBeenSet(false),
98     m_flickerAq(H265FlickerAq::NOT_SET),
99     m_flickerAqHasBeenSet(false),
100     m_framerateDenominator(0),
101     m_framerateDenominatorHasBeenSet(false),
102     m_framerateNumerator(0),
103     m_framerateNumeratorHasBeenSet(false),
104     m_gopClosedCadence(0),
105     m_gopClosedCadenceHasBeenSet(false),
106     m_gopSize(0.0),
107     m_gopSizeHasBeenSet(false),
108     m_gopSizeUnits(H265GopSizeUnits::NOT_SET),
109     m_gopSizeUnitsHasBeenSet(false),
110     m_level(H265Level::NOT_SET),
111     m_levelHasBeenSet(false),
112     m_lookAheadRateControl(H265LookAheadRateControl::NOT_SET),
113     m_lookAheadRateControlHasBeenSet(false),
114     m_maxBitrate(0),
115     m_maxBitrateHasBeenSet(false),
116     m_minIInterval(0),
117     m_minIIntervalHasBeenSet(false),
118     m_parDenominator(0),
119     m_parDenominatorHasBeenSet(false),
120     m_parNumerator(0),
121     m_parNumeratorHasBeenSet(false),
122     m_profile(H265Profile::NOT_SET),
123     m_profileHasBeenSet(false),
124     m_qvbrQualityLevel(0),
125     m_qvbrQualityLevelHasBeenSet(false),
126     m_rateControlMode(H265RateControlMode::NOT_SET),
127     m_rateControlModeHasBeenSet(false),
128     m_scanType(H265ScanType::NOT_SET),
129     m_scanTypeHasBeenSet(false),
130     m_sceneChangeDetect(H265SceneChangeDetect::NOT_SET),
131     m_sceneChangeDetectHasBeenSet(false),
132     m_slices(0),
133     m_slicesHasBeenSet(false),
134     m_tier(H265Tier::NOT_SET),
135     m_tierHasBeenSet(false),
136     m_timecodeInsertion(H265TimecodeInsertionBehavior::NOT_SET),
137     m_timecodeInsertionHasBeenSet(false)
138 {
139   *this = jsonValue;
140 }
141 
operator =(JsonView jsonValue)142 H265Settings& H265Settings::operator =(JsonView jsonValue)
143 {
144   if(jsonValue.ValueExists("adaptiveQuantization"))
145   {
146     m_adaptiveQuantization = H265AdaptiveQuantizationMapper::GetH265AdaptiveQuantizationForName(jsonValue.GetString("adaptiveQuantization"));
147 
148     m_adaptiveQuantizationHasBeenSet = true;
149   }
150 
151   if(jsonValue.ValueExists("afdSignaling"))
152   {
153     m_afdSignaling = AfdSignalingMapper::GetAfdSignalingForName(jsonValue.GetString("afdSignaling"));
154 
155     m_afdSignalingHasBeenSet = true;
156   }
157 
158   if(jsonValue.ValueExists("alternativeTransferFunction"))
159   {
160     m_alternativeTransferFunction = H265AlternativeTransferFunctionMapper::GetH265AlternativeTransferFunctionForName(jsonValue.GetString("alternativeTransferFunction"));
161 
162     m_alternativeTransferFunctionHasBeenSet = true;
163   }
164 
165   if(jsonValue.ValueExists("bitrate"))
166   {
167     m_bitrate = jsonValue.GetInteger("bitrate");
168 
169     m_bitrateHasBeenSet = true;
170   }
171 
172   if(jsonValue.ValueExists("bufSize"))
173   {
174     m_bufSize = jsonValue.GetInteger("bufSize");
175 
176     m_bufSizeHasBeenSet = true;
177   }
178 
179   if(jsonValue.ValueExists("colorMetadata"))
180   {
181     m_colorMetadata = H265ColorMetadataMapper::GetH265ColorMetadataForName(jsonValue.GetString("colorMetadata"));
182 
183     m_colorMetadataHasBeenSet = true;
184   }
185 
186   if(jsonValue.ValueExists("colorSpaceSettings"))
187   {
188     m_colorSpaceSettings = jsonValue.GetObject("colorSpaceSettings");
189 
190     m_colorSpaceSettingsHasBeenSet = true;
191   }
192 
193   if(jsonValue.ValueExists("filterSettings"))
194   {
195     m_filterSettings = jsonValue.GetObject("filterSettings");
196 
197     m_filterSettingsHasBeenSet = true;
198   }
199 
200   if(jsonValue.ValueExists("fixedAfd"))
201   {
202     m_fixedAfd = FixedAfdMapper::GetFixedAfdForName(jsonValue.GetString("fixedAfd"));
203 
204     m_fixedAfdHasBeenSet = true;
205   }
206 
207   if(jsonValue.ValueExists("flickerAq"))
208   {
209     m_flickerAq = H265FlickerAqMapper::GetH265FlickerAqForName(jsonValue.GetString("flickerAq"));
210 
211     m_flickerAqHasBeenSet = true;
212   }
213 
214   if(jsonValue.ValueExists("framerateDenominator"))
215   {
216     m_framerateDenominator = jsonValue.GetInteger("framerateDenominator");
217 
218     m_framerateDenominatorHasBeenSet = true;
219   }
220 
221   if(jsonValue.ValueExists("framerateNumerator"))
222   {
223     m_framerateNumerator = jsonValue.GetInteger("framerateNumerator");
224 
225     m_framerateNumeratorHasBeenSet = true;
226   }
227 
228   if(jsonValue.ValueExists("gopClosedCadence"))
229   {
230     m_gopClosedCadence = jsonValue.GetInteger("gopClosedCadence");
231 
232     m_gopClosedCadenceHasBeenSet = true;
233   }
234 
235   if(jsonValue.ValueExists("gopSize"))
236   {
237     m_gopSize = jsonValue.GetDouble("gopSize");
238 
239     m_gopSizeHasBeenSet = true;
240   }
241 
242   if(jsonValue.ValueExists("gopSizeUnits"))
243   {
244     m_gopSizeUnits = H265GopSizeUnitsMapper::GetH265GopSizeUnitsForName(jsonValue.GetString("gopSizeUnits"));
245 
246     m_gopSizeUnitsHasBeenSet = true;
247   }
248 
249   if(jsonValue.ValueExists("level"))
250   {
251     m_level = H265LevelMapper::GetH265LevelForName(jsonValue.GetString("level"));
252 
253     m_levelHasBeenSet = true;
254   }
255 
256   if(jsonValue.ValueExists("lookAheadRateControl"))
257   {
258     m_lookAheadRateControl = H265LookAheadRateControlMapper::GetH265LookAheadRateControlForName(jsonValue.GetString("lookAheadRateControl"));
259 
260     m_lookAheadRateControlHasBeenSet = true;
261   }
262 
263   if(jsonValue.ValueExists("maxBitrate"))
264   {
265     m_maxBitrate = jsonValue.GetInteger("maxBitrate");
266 
267     m_maxBitrateHasBeenSet = true;
268   }
269 
270   if(jsonValue.ValueExists("minIInterval"))
271   {
272     m_minIInterval = jsonValue.GetInteger("minIInterval");
273 
274     m_minIIntervalHasBeenSet = true;
275   }
276 
277   if(jsonValue.ValueExists("parDenominator"))
278   {
279     m_parDenominator = jsonValue.GetInteger("parDenominator");
280 
281     m_parDenominatorHasBeenSet = true;
282   }
283 
284   if(jsonValue.ValueExists("parNumerator"))
285   {
286     m_parNumerator = jsonValue.GetInteger("parNumerator");
287 
288     m_parNumeratorHasBeenSet = true;
289   }
290 
291   if(jsonValue.ValueExists("profile"))
292   {
293     m_profile = H265ProfileMapper::GetH265ProfileForName(jsonValue.GetString("profile"));
294 
295     m_profileHasBeenSet = true;
296   }
297 
298   if(jsonValue.ValueExists("qvbrQualityLevel"))
299   {
300     m_qvbrQualityLevel = jsonValue.GetInteger("qvbrQualityLevel");
301 
302     m_qvbrQualityLevelHasBeenSet = true;
303   }
304 
305   if(jsonValue.ValueExists("rateControlMode"))
306   {
307     m_rateControlMode = H265RateControlModeMapper::GetH265RateControlModeForName(jsonValue.GetString("rateControlMode"));
308 
309     m_rateControlModeHasBeenSet = true;
310   }
311 
312   if(jsonValue.ValueExists("scanType"))
313   {
314     m_scanType = H265ScanTypeMapper::GetH265ScanTypeForName(jsonValue.GetString("scanType"));
315 
316     m_scanTypeHasBeenSet = true;
317   }
318 
319   if(jsonValue.ValueExists("sceneChangeDetect"))
320   {
321     m_sceneChangeDetect = H265SceneChangeDetectMapper::GetH265SceneChangeDetectForName(jsonValue.GetString("sceneChangeDetect"));
322 
323     m_sceneChangeDetectHasBeenSet = true;
324   }
325 
326   if(jsonValue.ValueExists("slices"))
327   {
328     m_slices = jsonValue.GetInteger("slices");
329 
330     m_slicesHasBeenSet = true;
331   }
332 
333   if(jsonValue.ValueExists("tier"))
334   {
335     m_tier = H265TierMapper::GetH265TierForName(jsonValue.GetString("tier"));
336 
337     m_tierHasBeenSet = true;
338   }
339 
340   if(jsonValue.ValueExists("timecodeInsertion"))
341   {
342     m_timecodeInsertion = H265TimecodeInsertionBehaviorMapper::GetH265TimecodeInsertionBehaviorForName(jsonValue.GetString("timecodeInsertion"));
343 
344     m_timecodeInsertionHasBeenSet = true;
345   }
346 
347   return *this;
348 }
349 
Jsonize() const350 JsonValue H265Settings::Jsonize() const
351 {
352   JsonValue payload;
353 
354   if(m_adaptiveQuantizationHasBeenSet)
355   {
356    payload.WithString("adaptiveQuantization", H265AdaptiveQuantizationMapper::GetNameForH265AdaptiveQuantization(m_adaptiveQuantization));
357   }
358 
359   if(m_afdSignalingHasBeenSet)
360   {
361    payload.WithString("afdSignaling", AfdSignalingMapper::GetNameForAfdSignaling(m_afdSignaling));
362   }
363 
364   if(m_alternativeTransferFunctionHasBeenSet)
365   {
366    payload.WithString("alternativeTransferFunction", H265AlternativeTransferFunctionMapper::GetNameForH265AlternativeTransferFunction(m_alternativeTransferFunction));
367   }
368 
369   if(m_bitrateHasBeenSet)
370   {
371    payload.WithInteger("bitrate", m_bitrate);
372 
373   }
374 
375   if(m_bufSizeHasBeenSet)
376   {
377    payload.WithInteger("bufSize", m_bufSize);
378 
379   }
380 
381   if(m_colorMetadataHasBeenSet)
382   {
383    payload.WithString("colorMetadata", H265ColorMetadataMapper::GetNameForH265ColorMetadata(m_colorMetadata));
384   }
385 
386   if(m_colorSpaceSettingsHasBeenSet)
387   {
388    payload.WithObject("colorSpaceSettings", m_colorSpaceSettings.Jsonize());
389 
390   }
391 
392   if(m_filterSettingsHasBeenSet)
393   {
394    payload.WithObject("filterSettings", m_filterSettings.Jsonize());
395 
396   }
397 
398   if(m_fixedAfdHasBeenSet)
399   {
400    payload.WithString("fixedAfd", FixedAfdMapper::GetNameForFixedAfd(m_fixedAfd));
401   }
402 
403   if(m_flickerAqHasBeenSet)
404   {
405    payload.WithString("flickerAq", H265FlickerAqMapper::GetNameForH265FlickerAq(m_flickerAq));
406   }
407 
408   if(m_framerateDenominatorHasBeenSet)
409   {
410    payload.WithInteger("framerateDenominator", m_framerateDenominator);
411 
412   }
413 
414   if(m_framerateNumeratorHasBeenSet)
415   {
416    payload.WithInteger("framerateNumerator", m_framerateNumerator);
417 
418   }
419 
420   if(m_gopClosedCadenceHasBeenSet)
421   {
422    payload.WithInteger("gopClosedCadence", m_gopClosedCadence);
423 
424   }
425 
426   if(m_gopSizeHasBeenSet)
427   {
428    payload.WithDouble("gopSize", m_gopSize);
429 
430   }
431 
432   if(m_gopSizeUnitsHasBeenSet)
433   {
434    payload.WithString("gopSizeUnits", H265GopSizeUnitsMapper::GetNameForH265GopSizeUnits(m_gopSizeUnits));
435   }
436 
437   if(m_levelHasBeenSet)
438   {
439    payload.WithString("level", H265LevelMapper::GetNameForH265Level(m_level));
440   }
441 
442   if(m_lookAheadRateControlHasBeenSet)
443   {
444    payload.WithString("lookAheadRateControl", H265LookAheadRateControlMapper::GetNameForH265LookAheadRateControl(m_lookAheadRateControl));
445   }
446 
447   if(m_maxBitrateHasBeenSet)
448   {
449    payload.WithInteger("maxBitrate", m_maxBitrate);
450 
451   }
452 
453   if(m_minIIntervalHasBeenSet)
454   {
455    payload.WithInteger("minIInterval", m_minIInterval);
456 
457   }
458 
459   if(m_parDenominatorHasBeenSet)
460   {
461    payload.WithInteger("parDenominator", m_parDenominator);
462 
463   }
464 
465   if(m_parNumeratorHasBeenSet)
466   {
467    payload.WithInteger("parNumerator", m_parNumerator);
468 
469   }
470 
471   if(m_profileHasBeenSet)
472   {
473    payload.WithString("profile", H265ProfileMapper::GetNameForH265Profile(m_profile));
474   }
475 
476   if(m_qvbrQualityLevelHasBeenSet)
477   {
478    payload.WithInteger("qvbrQualityLevel", m_qvbrQualityLevel);
479 
480   }
481 
482   if(m_rateControlModeHasBeenSet)
483   {
484    payload.WithString("rateControlMode", H265RateControlModeMapper::GetNameForH265RateControlMode(m_rateControlMode));
485   }
486 
487   if(m_scanTypeHasBeenSet)
488   {
489    payload.WithString("scanType", H265ScanTypeMapper::GetNameForH265ScanType(m_scanType));
490   }
491 
492   if(m_sceneChangeDetectHasBeenSet)
493   {
494    payload.WithString("sceneChangeDetect", H265SceneChangeDetectMapper::GetNameForH265SceneChangeDetect(m_sceneChangeDetect));
495   }
496 
497   if(m_slicesHasBeenSet)
498   {
499    payload.WithInteger("slices", m_slices);
500 
501   }
502 
503   if(m_tierHasBeenSet)
504   {
505    payload.WithString("tier", H265TierMapper::GetNameForH265Tier(m_tier));
506   }
507 
508   if(m_timecodeInsertionHasBeenSet)
509   {
510    payload.WithString("timecodeInsertion", H265TimecodeInsertionBehaviorMapper::GetNameForH265TimecodeInsertionBehavior(m_timecodeInsertion));
511   }
512 
513   return payload;
514 }
515 
516 } // namespace Model
517 } // namespace MediaLive
518 } // namespace Aws
519