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/VideoCodecSettings.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 
VideoCodecSettings()21 VideoCodecSettings::VideoCodecSettings() :
22     m_av1SettingsHasBeenSet(false),
23     m_avcIntraSettingsHasBeenSet(false),
24     m_codec(VideoCodec::NOT_SET),
25     m_codecHasBeenSet(false),
26     m_frameCaptureSettingsHasBeenSet(false),
27     m_h264SettingsHasBeenSet(false),
28     m_h265SettingsHasBeenSet(false),
29     m_mpeg2SettingsHasBeenSet(false),
30     m_proresSettingsHasBeenSet(false),
31     m_vc3SettingsHasBeenSet(false),
32     m_vp8SettingsHasBeenSet(false),
33     m_vp9SettingsHasBeenSet(false),
34     m_xavcSettingsHasBeenSet(false)
35 {
36 }
37 
VideoCodecSettings(JsonView jsonValue)38 VideoCodecSettings::VideoCodecSettings(JsonView jsonValue) :
39     m_av1SettingsHasBeenSet(false),
40     m_avcIntraSettingsHasBeenSet(false),
41     m_codec(VideoCodec::NOT_SET),
42     m_codecHasBeenSet(false),
43     m_frameCaptureSettingsHasBeenSet(false),
44     m_h264SettingsHasBeenSet(false),
45     m_h265SettingsHasBeenSet(false),
46     m_mpeg2SettingsHasBeenSet(false),
47     m_proresSettingsHasBeenSet(false),
48     m_vc3SettingsHasBeenSet(false),
49     m_vp8SettingsHasBeenSet(false),
50     m_vp9SettingsHasBeenSet(false),
51     m_xavcSettingsHasBeenSet(false)
52 {
53   *this = jsonValue;
54 }
55 
operator =(JsonView jsonValue)56 VideoCodecSettings& VideoCodecSettings::operator =(JsonView jsonValue)
57 {
58   if(jsonValue.ValueExists("av1Settings"))
59   {
60     m_av1Settings = jsonValue.GetObject("av1Settings");
61 
62     m_av1SettingsHasBeenSet = true;
63   }
64 
65   if(jsonValue.ValueExists("avcIntraSettings"))
66   {
67     m_avcIntraSettings = jsonValue.GetObject("avcIntraSettings");
68 
69     m_avcIntraSettingsHasBeenSet = true;
70   }
71 
72   if(jsonValue.ValueExists("codec"))
73   {
74     m_codec = VideoCodecMapper::GetVideoCodecForName(jsonValue.GetString("codec"));
75 
76     m_codecHasBeenSet = true;
77   }
78 
79   if(jsonValue.ValueExists("frameCaptureSettings"))
80   {
81     m_frameCaptureSettings = jsonValue.GetObject("frameCaptureSettings");
82 
83     m_frameCaptureSettingsHasBeenSet = true;
84   }
85 
86   if(jsonValue.ValueExists("h264Settings"))
87   {
88     m_h264Settings = jsonValue.GetObject("h264Settings");
89 
90     m_h264SettingsHasBeenSet = true;
91   }
92 
93   if(jsonValue.ValueExists("h265Settings"))
94   {
95     m_h265Settings = jsonValue.GetObject("h265Settings");
96 
97     m_h265SettingsHasBeenSet = true;
98   }
99 
100   if(jsonValue.ValueExists("mpeg2Settings"))
101   {
102     m_mpeg2Settings = jsonValue.GetObject("mpeg2Settings");
103 
104     m_mpeg2SettingsHasBeenSet = true;
105   }
106 
107   if(jsonValue.ValueExists("proresSettings"))
108   {
109     m_proresSettings = jsonValue.GetObject("proresSettings");
110 
111     m_proresSettingsHasBeenSet = true;
112   }
113 
114   if(jsonValue.ValueExists("vc3Settings"))
115   {
116     m_vc3Settings = jsonValue.GetObject("vc3Settings");
117 
118     m_vc3SettingsHasBeenSet = true;
119   }
120 
121   if(jsonValue.ValueExists("vp8Settings"))
122   {
123     m_vp8Settings = jsonValue.GetObject("vp8Settings");
124 
125     m_vp8SettingsHasBeenSet = true;
126   }
127 
128   if(jsonValue.ValueExists("vp9Settings"))
129   {
130     m_vp9Settings = jsonValue.GetObject("vp9Settings");
131 
132     m_vp9SettingsHasBeenSet = true;
133   }
134 
135   if(jsonValue.ValueExists("xavcSettings"))
136   {
137     m_xavcSettings = jsonValue.GetObject("xavcSettings");
138 
139     m_xavcSettingsHasBeenSet = true;
140   }
141 
142   return *this;
143 }
144 
Jsonize() const145 JsonValue VideoCodecSettings::Jsonize() const
146 {
147   JsonValue payload;
148 
149   if(m_av1SettingsHasBeenSet)
150   {
151    payload.WithObject("av1Settings", m_av1Settings.Jsonize());
152 
153   }
154 
155   if(m_avcIntraSettingsHasBeenSet)
156   {
157    payload.WithObject("avcIntraSettings", m_avcIntraSettings.Jsonize());
158 
159   }
160 
161   if(m_codecHasBeenSet)
162   {
163    payload.WithString("codec", VideoCodecMapper::GetNameForVideoCodec(m_codec));
164   }
165 
166   if(m_frameCaptureSettingsHasBeenSet)
167   {
168    payload.WithObject("frameCaptureSettings", m_frameCaptureSettings.Jsonize());
169 
170   }
171 
172   if(m_h264SettingsHasBeenSet)
173   {
174    payload.WithObject("h264Settings", m_h264Settings.Jsonize());
175 
176   }
177 
178   if(m_h265SettingsHasBeenSet)
179   {
180    payload.WithObject("h265Settings", m_h265Settings.Jsonize());
181 
182   }
183 
184   if(m_mpeg2SettingsHasBeenSet)
185   {
186    payload.WithObject("mpeg2Settings", m_mpeg2Settings.Jsonize());
187 
188   }
189 
190   if(m_proresSettingsHasBeenSet)
191   {
192    payload.WithObject("proresSettings", m_proresSettings.Jsonize());
193 
194   }
195 
196   if(m_vc3SettingsHasBeenSet)
197   {
198    payload.WithObject("vc3Settings", m_vc3Settings.Jsonize());
199 
200   }
201 
202   if(m_vp8SettingsHasBeenSet)
203   {
204    payload.WithObject("vp8Settings", m_vp8Settings.Jsonize());
205 
206   }
207 
208   if(m_vp9SettingsHasBeenSet)
209   {
210    payload.WithObject("vp9Settings", m_vp9Settings.Jsonize());
211 
212   }
213 
214   if(m_xavcSettingsHasBeenSet)
215   {
216    payload.WithObject("xavcSettings", m_xavcSettings.Jsonize());
217 
218   }
219 
220   return payload;
221 }
222 
223 } // namespace Model
224 } // namespace MediaConvert
225 } // namespace Aws
226