// This function does the following: // 1) Sets a closed captioning target file and saves it in SRT format. // 2) Retrieves the file and its flag and makes sure it is properly set. // 3) Sets a closed captioning target file and saves it in TEXT format. // 4) Retrieves the file and its flag and makes sure it is properly set.
void TestSetClosedCaptioningTargetFile(IltmmConvert *pConvert)
{
HRESULT hr = S_OK;
BSTR bstrTargetFileSRT = NULL;
BSTR bstrTargetFileTEXT = NULL;
BSTR bstrTargetFile = NULL;
long Flags = 0;
bstrTargetFileSRT = SysAllocString(MAKE_MEDIA_PATH("ClosedCaptioning.srt"));
bstrTargetFileTEXT = SysAllocString(MAKE_MEDIA_PATH("ClosedCaptioning.txt"));
// Set the closed captioning target file to ClosedCaptioning.srt and save it in SRT format.
hr = pConvert->SetClosedCaptioningTargetFile(bstrTargetFileSRT, 0);
ASSERT( hr == S_OK);
bstrTargetFile = NULL;
hr = pConvert->GetClosedCaptioningTargetFile(&bstrTargetFile, &Flags);
if((hr == S_OK) && (VarBstrCmp(bstrTargetFile, bstrTargetFileSRT, NORM_IGNORECASE | LOCALE_USER_DEFAULT, 0) == static_cast<HRESULT>(VARCMP_EQ)) && (0==Flags) )
MessageBox(NULL, TEXT("The Closed Captioning Target File was set properly!"), TEXT("SUCCESS"), MB_OK);
else
MessageBox(NULL, TEXT("The Closed Captioning Target File was NOT set properly!"), TEXT("FAILURE"), MB_OK);
// free the bstr
SysFreeString(bstrTargetFile);
// Set the closed captioning target file to ClosedCaptioning.txt and save it in TEXT format.
hr = pConvert->SetClosedCaptioningTargetFile(bstrTargetFileTEXT, ltmmClosedCaptioning_Text);
ASSERT( hr == S_OK);
bstrTargetFile = NULL;
hr = pConvert->GetClosedCaptioningTargetFile(&bstrTargetFile, &Flags);
if((hr == S_OK) && (VarBstrCmp(bstrTargetFile, bstrTargetFileTEXT, NORM_IGNORECASE | LOCALE_USER_DEFAULT, 0) == static_cast<HRESULT>(VARCMP_EQ)) && (ltmmClosedCaptioning_Text==Flags) )
MessageBox(NULL, TEXT("The Closed Captioning Target File was set properly!"), TEXT("SUCCESS"), MB_OK);
else
MessageBox(NULL, TEXT("The Closed Captioning Target File was NOT set properly!"), TEXT("FAILURE"), MB_OK);
// free the bstrs
SysFreeString(bstrTargetFile);
SysFreeString(bstrTargetFileSRT);
SysFreeString(bstrTargetFileTEXT);
}
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