Load Json::Value into this object
| 158 | |
| 159 | // Load Json::Value into this object |
| 160 | void ReaderBase::SetJsonValue(const Json::Value root) { |
| 161 | |
| 162 | // Set data from Json (if key is found) |
| 163 | if (!root["has_video"].isNull()) |
| 164 | info.has_video = root["has_video"].asBool(); |
| 165 | if (!root["has_audio"].isNull()) |
| 166 | info.has_audio = root["has_audio"].asBool(); |
| 167 | if (!root["has_single_image"].isNull()) |
| 168 | info.has_single_image = root["has_single_image"].asBool(); |
| 169 | if (!root["duration"].isNull()) |
| 170 | info.duration = root["duration"].asDouble(); |
| 171 | if (!root["file_size"].isNull()) |
| 172 | info.file_size = std::stoll(root["file_size"].asString()); |
| 173 | if (!root["height"].isNull()) |
| 174 | info.height = root["height"].asInt(); |
| 175 | if (!root["width"].isNull()) |
| 176 | info.width = root["width"].asInt(); |
| 177 | if (!root["pixel_format"].isNull()) |
| 178 | info.pixel_format = root["pixel_format"].asInt(); |
| 179 | if (!root["fps"].isNull() && root["fps"].isObject()) { |
| 180 | if (!root["fps"]["num"].isNull()) |
| 181 | info.fps.num = root["fps"]["num"].asInt(); |
| 182 | if (!root["fps"]["den"].isNull()) |
| 183 | info.fps.den = root["fps"]["den"].asInt(); |
| 184 | } |
| 185 | if (!root["video_bit_rate"].isNull()) |
| 186 | info.video_bit_rate = root["video_bit_rate"].asInt(); |
| 187 | if (!root["pixel_ratio"].isNull() && root["pixel_ratio"].isObject()) { |
| 188 | if (!root["pixel_ratio"]["num"].isNull()) |
| 189 | info.pixel_ratio.num = root["pixel_ratio"]["num"].asInt(); |
| 190 | if (!root["pixel_ratio"]["den"].isNull()) |
| 191 | info.pixel_ratio.den = root["pixel_ratio"]["den"].asInt(); |
| 192 | } |
| 193 | if (!root["display_ratio"].isNull() && root["display_ratio"].isObject()) { |
| 194 | if (!root["display_ratio"]["num"].isNull()) |
| 195 | info.display_ratio.num = root["display_ratio"]["num"].asInt(); |
| 196 | if (!root["display_ratio"]["den"].isNull()) |
| 197 | info.display_ratio.den = root["display_ratio"]["den"].asInt(); |
| 198 | } |
| 199 | if (!root["vcodec"].isNull()) |
| 200 | info.vcodec = root["vcodec"].asString(); |
| 201 | if (!root["video_length"].isNull()) |
| 202 | info.video_length = std::stoll(root["video_length"].asString()); |
| 203 | if (!root["video_stream_index"].isNull()) |
| 204 | info.video_stream_index = root["video_stream_index"].asInt(); |
| 205 | if (!root["video_timebase"].isNull() && root["video_timebase"].isObject()) { |
| 206 | if (!root["video_timebase"]["num"].isNull()) |
| 207 | info.video_timebase.num = root["video_timebase"]["num"].asInt(); |
| 208 | if (!root["video_timebase"]["den"].isNull()) |
| 209 | info.video_timebase.den = root["video_timebase"]["den"].asInt(); |
| 210 | } |
| 211 | if (!root["interlaced_frame"].isNull()) |
| 212 | info.interlaced_frame = root["interlaced_frame"].asBool(); |
| 213 | if (!root["top_field_first"].isNull()) |
| 214 | info.top_field_first = root["top_field_first"].asBool(); |
| 215 | if (!root["acodec"].isNull()) |
| 216 | info.acodec = root["acodec"].asString(); |
| 217 |
nothing calls this directly
no outgoing calls
no test coverage detected