MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / SetJsonValue

Method SetJsonValue

src/WriterBase.cpp:205–279  ·  view source on GitHub ↗

Load Json::Value into this object

Source from the content-addressed store, hash-verified

203
204// Load Json::Value into this object
205void WriterBase::SetJsonValue(const Json::Value root) {
206
207 // Set data from Json (if key is found)
208 if (!root["has_video"].isNull())
209 info.has_video = root["has_video"].asBool();
210 if (!root["has_audio"].isNull())
211 info.has_audio = root["has_audio"].asBool();
212 if (!root["has_single_image"].isNull())
213 info.has_single_image = root["has_single_image"].asBool();
214 if (!root["duration"].isNull())
215 info.duration = root["duration"].asDouble();
216 if (!root["file_size"].isNull())
217 info.file_size = (int64_t) root["file_size"].asUInt();
218 if (!root["height"].isNull())
219 info.height = root["height"].asInt();
220 if (!root["width"].isNull())
221 info.width = root["width"].asInt();
222 if (!root["pixel_format"].isNull())
223 info.pixel_format = root["pixel_format"].asInt();
224 if (!root["fps"].isNull() && root["fps"].isObject()) {
225 if (!root["fps"]["num"].isNull())
226 info.fps.num = root["fps"]["num"].asInt();
227 if (!root["fps"]["den"].isNull())
228 info.fps.den = root["fps"]["den"].asInt();
229 }
230 if (!root["video_bit_rate"].isNull())
231 info.video_bit_rate = root["video_bit_rate"].asInt();
232 if (!root["pixel_ratio"].isNull() && root["pixel_ratio"].isObject()) {
233 if (!root["pixel_ratio"]["num"].isNull())
234 info.pixel_ratio.num = root["pixel_ratio"]["num"].asInt();
235 if (!root["pixel_ratio"]["den"].isNull())
236 info.pixel_ratio.den = root["pixel_ratio"]["den"].asInt();
237 }
238 if (!root["display_ratio"].isNull() && root["display_ratio"].isObject()) {
239 if (!root["display_ratio"]["num"].isNull())
240 info.display_ratio.num = root["display_ratio"]["num"].asInt();
241 if (!root["display_ratio"]["den"].isNull())
242 info.display_ratio.den = root["display_ratio"]["den"].asInt();
243 }
244 if (!root["vcodec"].isNull())
245 info.vcodec = root["vcodec"].asString();
246 if (!root["video_length"].isNull())
247 info.video_length = (int64_t) root["video_length"].asUInt();
248 if (!root["video_stream_index"].isNull())
249 info.video_stream_index = root["video_stream_index"].asInt();
250 if (!root["video_timebase"].isNull() && root["video_timebase"].isObject()) {
251 if (!root["video_timebase"]["num"].isNull())
252 info.video_timebase.num = root["video_timebase"]["num"].asInt();
253 if (!root["video_timebase"]["den"].isNull())
254 info.video_timebase.den = root["video_timebase"]["den"].asInt();
255 }
256 if (!root["interlaced_frame"].isNull())
257 info.interlaced_frame = root["interlaced_frame"].asBool();
258 if (!root["top_field_first"].isNull())
259 info.top_field_first = root["top_field_first"].asBool();
260 if (!root["acodec"].isNull())
261 info.acodec = root["acodec"].asString();
262

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected