Loads extensions from an Exif file. Please note that not all Exif files have extensions.
#include "ltwrappr.h"
virtual L_INT LFile::ReadFileExtensions(ppExtensionList, pLoadOptions=NULL)
Pointer to a pointer to an EXTENSIONLIST structure to be updated with the extensions read from the specified Exif file.
Pointer to optional extended load options. Pass NULL to use the default load options.
Value | Meaning |
---|---|
>=0 | Length of the comment field. |
< 0 | An error occurred. Refer to Return Codes. |
Currently, this function works only with Exif files. Exif files can contain extra data stored as "FlashPix extensions". This function can be used to access this extra data. LEADTOOLS refers to this extra data as "extensions".
The LFile::LoadExtensionStampfunction can be used to load a stamp from the extension and LFile::GetExtensionAudio can be used to get embedded audio data.
When the memory allocated by this function is no longer needed, call LFile::FreeExtensions to free the memory.
Win32, x64.
#include <stdio.h>
L_INT LFile__ReadFileExtensionsExample(L_TCHAR * pszFile, L_TCHAR * pszInfoFile)
{
L_INT nRet;
LFile File;
pEXTENSIONLIST pExtensionList;
L_TCHAR szBuffer[512];
L_TCHAR szText[1024];
L_TCHAR szName[1024];
L_TCHAR szCLSID[64];
HANDLE fd;
DWORD dwSizeWrite;
File.SetFileName(pszFile);
nRet = File.ReadFileExtensions(&pExtensionList);
if(nRet != SUCCESS)
{
MessageBox(NULL, TEXT("Error getting extensions!"),
TEXT("Getting Extensions"), MB_OK);
return nRet;
}
// Open the info .txt file
fd = CreateFile(pszInfoFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if(!fd)
{
MessageBox(NULL, TEXT("Error opening info file!"),
TEXT("Getting Extensions"), MB_OK);
return FAILURE;
}
// Do we have a stamp, audio, or both?
switch(pExtensionList->uFlags & (EXTENSION_STAMP | EXTENSION_AUDIO))
{
case 0:
lstrcpy(szBuffer, TEXT("")); break;
case EXTENSION_STAMP:
lstrcpy(szBuffer, TEXT(", EXTENSION_STAMP")); break;
case EXTENSION_AUDIO:
lstrcpy(szBuffer, TEXT(", EXTENSION_AUDIO")); break;
case EXTENSION_STAMP | EXTENSION_AUDIO:
lstrcpy(szBuffer, TEXT(", EXTENSION_STAMP | EXTENSION_AUDIO")); break;
}
wsprintf(szText, TEXT("Extension count: %d%s\n"), pExtensionList->uCount, szBuffer);
WriteFile(fd, szText, 1024, &dwSizeWrite, NULL);
for (L_UINT u = 0; u < pExtensionList->uCount; u++)
{
lstrcpy(szName, pExtensionList->aList[u].pName);
if (pExtensionList->aList[u].pClsid)
StringFromGUID2((REFGUID) pExtensionList->aList[u].pClsid,(LPWSTR) szCLSID, sizeof(szCLSID));
else
lstrcpy(szCLSID, TEXT("NULL"));
// Write information about stream 'u'
wsprintf(szText, TEXT("[%d]: Name = %s, DataSize = %d, CLSID = %s\n"), u, szName, pExtensionList->aList[u].uDataSize, szCLSID);
WriteFile(fd, szText, 1024, &dwSizeWrite, NULL);
}
CloseHandle(fd);
// Run notepad to show the info file
wsprintf(szBuffer, TEXT("notepad %s"), pszInfoFile);
WinExec((LPCSTR)szBuffer, SW_SHOW);
nRet = File.FreeExtensions(pExtensionList);
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