#include "l_bitmap.h"
L_LTJP2_API L_INT EXT_FUNCTION L_Jp2ReadBoxMemory(hJp2, pBuffer, uBufferSize, eBoxType, plBox, uBoxIndex)
Reads a box of type eBoxType
at uBoxIndex
from a JPEG 2000 file in memory.
JPEG 2000 engine handle that was created by the L_Jp2Create function.
Pointer to a JPEG 2000 file in memory.
Size of JPEG 2000 file in bytes.
Box type. It specifies the type of the box to be read from the file.
Pointer to a pointer to be updated with the box data structure.
Zero based box index. It specifies the box the user wants to read.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
L_Jp2ReadBoxMemory reads a box of type eBoxType
at uBoxIndex
from a JPEG 2000 file in memory.
If the uBoxIndex is greater than the number of boxes the function returns: ERROR_INV_PARAMETER.
L_JP2B_RESOLUTION and L_JPXB_RESOLUTION boxes cant be read using this function. All of the engines boxes will be reset and updated with the new loaded boxes only.
Required DLLs and Libraries
Win32, x64.
This example reads an MPEG7 box stored in a JPEG 2000 file.
L_INT Jp2ReadBoxMemoryExample(L_UINT8* pFileBuffer, L_SIZE_T uFileSize, L_UINT8 ** pMPEG7Data, L_SIZE_T* puSize)
{
L_HJP2 hEngine;
L_INT nRet;
pL_JP2_MPEG7_BOX pMPEG7Box;
L_JP2_FILEINFO Jp2FileInfo;
/*Create JPEG 2000 engine handle*/
hEngine = L_Jp2Create();
Jp2FileInfo.uStructSize = sizeof(L_JP2_FILEINFO);
L_Jp2GetFileInfoMemory(hEngine, pFileBuffer, uFileSize,&Jp2FileInfo);
if(Jp2FileInfo.MPEG7.uNumOfBoxes == 0)
return 0;
nRet = L_Jp2ReadBoxMemory(hEngine,pFileBuffer, uFileSize,L_JPXB_MPEG7, (L_VOID**)&pMPEG7Box,0);
if(nRet != SUCCESS)
return nRet;
*pMPEG7Data = (L_UINT8*)malloc(pMPEG7Box->uDataSize);
memcpy(*pMPEG7Data, pMPEG7Box->pData,pMPEG7Box->uDataSize);
*puSize = pMPEG7Box->uDataSize;
/*Free the read box*/
L_Jp2FreeBoxes(hEngine, L_JPXB_MPEG7, pMPEG7Box, 1);
/*Free File Info structure*/
L_Jp2FreeFileInfo(hEngine, &Jp2FileInfo);
/*Destroy engine handle*/
L_Jp2Destroy(hEngine);
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document