| 322 | } |
| 323 | |
| 324 | static RDResult Structured2XML(const rdcstr &filename, const RDCFile &file, uint64_t version, |
| 325 | const StructuredChunkList &chunks, RENDERDOC_ProgressCallback progress) |
| 326 | { |
| 327 | pugi::xml_document doc; |
| 328 | |
| 329 | pugi::xml_node xRoot = doc.append_child("rdc"); |
| 330 | |
| 331 | { |
| 332 | pugi::xml_node xHeader = xRoot.append_child("header"); |
| 333 | |
| 334 | pugi::xml_node xDriver = xHeader.append_child("driver"); |
| 335 | xDriver.append_attribute("id") = (uint32_t)file.GetDriver(); |
| 336 | xDriver.text() = file.GetDriverName().c_str(); |
| 337 | |
| 338 | pugi::xml_node xIdent = xHeader.append_child("machineIdent"); |
| 339 | |
| 340 | xIdent.text().set(file.GetMachineIdent()); |
| 341 | |
| 342 | pugi::xml_node xThumbnail = xHeader.append_child("thumbnail"); |
| 343 | |
| 344 | const RDCThumb &th = file.GetThumbnail(); |
| 345 | if(!th.pixels.empty() && th.width > 0 && th.height > 0) |
| 346 | { |
| 347 | xThumbnail.append_attribute("width") = th.width; |
| 348 | xThumbnail.append_attribute("height") = th.height; |
| 349 | |
| 350 | if(th.format == FileType::JPG) |
| 351 | xThumbnail.text() = "thumb.jpg"; |
| 352 | else if(th.format == FileType::PNG) |
| 353 | xThumbnail.text() = "thumb.png"; |
| 354 | else if(th.format == FileType::Raw) |
| 355 | xThumbnail.text() = "thumb.raw"; |
| 356 | else |
| 357 | RDCERR("Unexpected thumbnail format %s", ToStr(th.format).c_str()); |
| 358 | } |
| 359 | |
| 360 | pugi::xml_node xTimebase = xHeader.append_child("timebase"); |
| 361 | |
| 362 | xTimebase.append_attribute("base") = file.GetTimestampBase(); |
| 363 | xTimebase.append_attribute("frequency") = file.GetTimestampFrequency(); |
| 364 | } |
| 365 | |
| 366 | if(progress) |
| 367 | progress(StructuredProgress(0.1f)); |
| 368 | |
| 369 | // write all other sections |
| 370 | for(int i = 0; i < file.NumSections(); i++) |
| 371 | { |
| 372 | const SectionProperties &props = file.GetSectionProperties(i); |
| 373 | |
| 374 | if(props.type == SectionType::FrameCapture) |
| 375 | continue; |
| 376 | |
| 377 | StreamReader *reader = file.ReadSection(i); |
| 378 | |
| 379 | if(props.type == SectionType::ExtendedThumbnail) |
| 380 | { |
| 381 | ExtThumbnailHeader thumbHeader = {}; |
no test coverage detected