MCPcopy Create free account
hub / github.com/OSGeo/gdal / DumpFTYPBox

Function DumpFTYPBox

gcore/gdaljp2structure.cpp:292–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292static void DumpFTYPBox(CPLXMLNode *psBox, GDALJP2Box &oBox,
293 DumpContext *psDumpContext)
294{
295 GIntBig nBoxDataLength = oBox.GetDataLength();
296 GByte *pabyBoxData = oBox.ReadBoxData();
297 if (pabyBoxData)
298 {
299 CPLXMLNode *psDecodedContent =
300 CPLCreateXMLNode(psBox, CXT_Element, "DecodedContent");
301 GIntBig nRemainingLength = nBoxDataLength;
302 GByte *pabyIter = pabyBoxData;
303 CPLXMLNode *psLastChild = nullptr;
304 if (nRemainingLength >= 4)
305 {
306 char szBranding[5];
307 memcpy(szBranding, pabyIter, 4);
308 szBranding[4] = 0;
309 AddField(psDecodedContent, psLastChild, psDumpContext, "BR", 4,
310 szBranding);
311 pabyIter += 4;
312 nRemainingLength -= 4;
313 }
314 if (nRemainingLength >= 4)
315 {
316 GUInt32 nVal;
317 memcpy(&nVal, pabyIter, 4);
318 CPL_MSBPTR32(&nVal);
319 AddField(psDecodedContent, psLastChild, psDumpContext, "MinV",
320 nVal);
321 pabyIter += 4;
322 nRemainingLength -= 4;
323 }
324 int nCLIndex = 0;
325 while (nRemainingLength >= 4)
326 {
327 char szBranding[5];
328 memcpy(szBranding, pabyIter, 4);
329 szBranding[4] = 0;
330 AddField(psDecodedContent, psLastChild, psDumpContext,
331 CPLSPrintf("CL%d", nCLIndex), 4, szBranding);
332 pabyIter += 4;
333 nRemainingLength -= 4;
334 nCLIndex++;
335 }
336 if (nRemainingLength > 0)
337 AddElement(
338 psDecodedContent, psLastChild, psDumpContext,
339 CPLCreateXMLElementAndValue(
340 nullptr, "RemainingBytes",
341 CPLSPrintf("%d", static_cast<int>(nRemainingLength))));
342 }
343 CPLFree(pabyBoxData);
344}
345
346static void DumpIHDRBox(CPLXMLNode *psBox, GDALJP2Box &oBox,
347 DumpContext *psDumpContext)

Callers 1

Calls 7

CPLCreateXMLNodeFunction · 0.85
AddFieldFunction · 0.85
CPLSPrintfFunction · 0.85
AddElementFunction · 0.85
ReadBoxDataMethod · 0.80
GetDataLengthMethod · 0.45

Tested by

no test coverage detected