Fragments specified codestreams within a JPEG 2000 part 2 JPX file.
#include "l_bitmap.h"
L_LTJP2_API L_INT EXT_FUNCTION L_Jp2FragmentJpxFile(hJp2, pInFileName, pOutFileName, pURLs, uNumOfURLs, pFragments, uNumOfFrgm)
JPEG 2000 engine handle that was created by the L_Jp2Create function.
Character string that contains the name of the JPEG 2000 part 2 JPX file to extract frames from it.
Character string that contains the name of the fragmented JPEG 2000 part 2 JPX file.
Array of UUID URL boxes specify the file in which the fragments are contained.
Number of URL boxes, this value specifies the size of the pURLs
.
Pointer to an array of fragments specify for each fragment: the codestream index to be fragmented, the index of URL in which fragment is contained, and the offset of the first byte of the fragment within the URL specified.
Size of pFragments
.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
If a JPX file already has fragments, the function returns: ERROR_INV_PARAMETER.
If the file is not in JPX format the function returns: ERROR_FILE_FORMAT.
You must save the specified codestreams in the URLs provided in pURLs
. The codestream must be saved entirely in that URL.
Fragmentation in JPX works by specifying a table of pointers to the individual fragments. Each pointer specifies three things:
Fragmentation is an important feature of the JPX file format since it allows applications to implement such features as:
Win32, x64.
This example fragments a JPX file.
L_INT Jp2FragmentJpxFileExample(L_VOID)
{
L_HJP2 hEngine;
L_JP2_FILEINFO Jp2FileInfo;
L_TCHAR pUrlString[L_MAXPATH];
lstrcpy(pUrlString, MAKE_IMAGE_PATH("codestream.bin"));
L_JP2_UUID_URL_BOX pURL[1];
L_JP2_FRAGMENT pFragment[1];
L_INT nRet;
// Create JPEG 2000 engine handle
hEngine = L_Jp2Create();
Jp2FileInfo.uStructSize = sizeof(L_JP2_FILEINFO);
nRet = L_Jp2GetFileInfo(hEngine, MAKE_IMAGE_PATH("image1.jpx"), &Jp2FileInfo);
if (nRet != SUCCESS)
return nRet;
if (Jp2FileInfo.MPEG7.uNumOfBoxes == 0)
return 0;
if (Jp2FileInfo.CodeStream.uNumOfBoxes < 2)
return 0;
if (Jp2FileInfo.DataRef.uNumOfBoxes)
return 0;
pURL[0].uStructSize = sizeof(L_JP2_UUID_URL_BOX);
pURL[0].pFLAG[0] = 0;
pURL[0].pFLAG[1] = 0;
pURL[0].pFLAG[2] = 0;
pURL[0].uVERS = 0;
pURL[0].pLOC = (L_UINT8*)pUrlString;
pURL[0].uLOCSize = (lstrlen(pUrlString) + 1) * sizeof(L_TCHAR);
// Fragment the second codestream
pFragment[0].uStructSize = sizeof(L_JP2_FRAGMENT);
pFragment[0].uCodeStreamIndex = 1;
pFragment[0].uOffset = 0;
pFragment[0].uUrlIndex = 0;
nRet = L_Jp2FragmentJpxFile(hEngine, MAKE_IMAGE_PATH("image1.jpx"), MAKE_IMAGE_PATH("Test.jpx"), pURL, 1, pFragment, 1);
if (nRet != SUCCESS)
return nRet;
// Free File Info structure
nRet = L_Jp2FreeFileInfo(hEngine, &Jp2FileInfo);
if (nRet != SUCCESS)
return nRet;
// Destroy engine handle
nRet = L_Jp2Destroy(hEngine);
if (nRet != SUCCESS)
return nRet;
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