diff --git a/TinyEXIF.cpp b/TinyEXIF.cpp index 73c0086..2fadd6a 100644 --- a/TinyEXIF.cpp +++ b/TinyEXIF.cpp @@ -1104,6 +1104,17 @@ int EXIFInfo::parseFromXMPSegmentXML(const char* szXML, unsigned len) { } return false; } + // same as previous function but with unsigned int results + static bool Value(const tinyxml2::XMLElement* document, const char* name, uint32_t& value) { + const char* szAttribute = document->Attribute(name); + if (szAttribute == NULL) { + const tinyxml2::XMLElement* const element(document->FirstChildElement(name)); + if (element == NULL || (szAttribute = element->GetText()) == NULL) + return false; + } + value = strtoul(szAttribute, NULL, 0); return true; + return false; + } }; const char* szAbout(document->Attribute("rdf:about")); if (0 == strcasecmp(Make.c_str(), "DJI") || (szAbout != NULL && 0 == strcasecmp(szAbout, "DJI Meta Data"))) { @@ -1141,6 +1152,12 @@ int EXIFInfo::parseFromXMPSegmentXML(const char* szXML, unsigned len) { ParseXMP::Value(document, "GPano:PosePitchDegrees", GPano.PosePitchDegrees); ParseXMP::Value(document, "GPano:PoseRollDegrees", GPano.PoseRollDegrees); + // parse GCamera:MicroVideo + if (document->Attribute("GCamera:MicroVideo")) { + ParseXMP::Value(document, "GCamera:MicroVideo", MicroVideo.HasMicroVideo); + ParseXMP::Value(document, "GCamera:MicroVideoVersion", MicroVideo.MicroVideoVersion); + ParseXMP::Value(document, "GCamera:MicroVideoOffset", MicroVideo.MicroVideoOffset); + } return PARSE_SUCCESS; } @@ -1290,6 +1307,11 @@ void EXIFInfo::clear() { // GPano GPano.PosePitchDegrees = DBL_MAX; GPano.PoseRollDegrees = DBL_MAX; + + // Video metadata + MicroVideo.HasMicroVideo = 0; + MicroVideo.MicroVideoVersion = 0; + MicroVideo.MicroVideoOffset = 0; } } // namespace TinyEXIF diff --git a/TinyEXIF.h b/TinyEXIF.h index 4f66590..56354aa 100644 --- a/TinyEXIF.h +++ b/TinyEXIF.h @@ -308,6 +308,11 @@ public: bool hasPosePitchDegrees() const; // Return true if PosePitchDegrees is available bool hasPoseRollDegrees() const; // Return true if PoseRollDegrees is available } GPano; + struct TINYEXIF_LIB MicroVideo_t { // Google camera video file in metadata + uint32_t HasMicroVideo; // not zero if exists + uint32_t MicroVideoVersion; // just regularinfo + uint32_t MicroVideoOffset; // offset from end of file + } MicroVideo; }; } // namespace TinyEXIF