#include "l_bitmap.h"
L_LTFIL_API L_INT L_GetExtensionAudio(pExtensionList, nStream, ppBuffer, puSize)
pEXTENSIONLIST pExtensionList; |
pointer to a structure |
L_INT nStream; |
audio stream index |
L_UCHAR** ppBuffer; |
pointer to a buffer |
L_SIZE_T* puSize; |
pointer to a variable to be updated |
Gets the embedded audio data from the specified extension list.
Parameter |
Description |
pExtensionList |
Pointer to the EXTENSIONLIST structure that contains the audio data to get. |
nStream |
Index of the audio stream to retrieve. The extensions may have more than one audio stream. This index is 0-based. Therefore, the first stream is stream 0, the second stream is stream 1, etc. To retrieve all the audio streams, retrieve the streams one by one until an error is returned. |
ppBuffer |
Pointer to be updated with a pointer to the retrieved audio data. This pointer will point into the pExtensionList. Therefore, this pointer will be valid as long as pExtensionList is valid. The memory will be freed when L_FreeExtensions is called, so do not try to free this memory. |
puSize |
Pointer to a variable to be updated with the size of the audio data. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
The audio data is stored inside extensions in the WAVE format. The audio data can be played directly from memory, or the data can be written to a disk file and played from the disk. When writing the audio data to a disk file, give the file a .WAV extension.
Required DLLs and Libraries
LTFIL For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64, Linux.
Functions: |
L_ReadFileExtensions, L_LoadExtensionStamp, L_FreeExtensions, L_ReadFileStamp |
Topics: |
Raster Image Functions: Getting and Setting File Information |
|
|
|
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT GetExtensionAudioExample(HWND hWnd,
L_TCHAR * pszName,
pBITMAPHANDLE pBitmap)
{
UNREFERENCED_PARAMETER(pBitmap);
pEXTENSIONLIST pExtensionList;
L_INT nRet;
L_TCHAR s[300];
nRet = L_ReadFileExtensions(pszName, &pExtensionList, NULL);
if(nRet != SUCCESS)
{
wsprintf(s, TEXT("Error %d getting extensions!"), nRet);
MessageBox(hWnd, s, TEXT("ERROR"), MB_OK);
return nRet;
}
if(pExtensionList->uFlags & EXTENSION_AUDIO)
{
L_UCHAR *pAudioData;
L_SIZE_T uSize;
FILE *fd;
nRet = L_GetExtensionAudio(pExtensionList, 0, &pAudioData, &uSize);
if(nRet != SUCCESS)
{
wsprintf(s, TEXT("Error %d getting the audio data"), nRet);
MessageBox(hWnd, s, TEXT("ERROR"), MB_OK);
}
else
{
_tfopen_s(&fd, MAKE_IMAGE_PATH(TEXT("exif.wav")), TEXT("wb"));
if(fd)
{
fwrite(pAudioData, uSize, 1, fd);
fclose(fd);
}
}
}
L_FreeExtensions(pExtensionList);
return SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET