HRESULT SaveTimedDVRFragments(ILMDVRSource* pDVR, double dTimeThreshold, LPCWSTR pszFilePrefix)
{
HRESULT hr;
double dStartPos;
double dEndPos;
double dTotal;
double dFragmentStartPos;
double dFragmentEndPos = 0;
WCHAR szPath[MAX_PATH];
for (UINT fragment = 0; ; fragment++)
{
// find available range of bytes
hr = pDVR->GetAvailabilityInfo(&dStartPos, &dEndPos, &dTotal);
if (FAILED(hr))
return hr;
// if this is not the first fragment, then start where we left off
if (fragment > 0)
dStartPos = dFragmentEndPos;
// Get aligned boundaries for next timed fragment
hr = pDVR->GetTimedFragmentAlignment(dStartPos, dEndPos, dTimeThreshold, &dFragmentStartPos, &dFragmentEndPos, NULL);
if (FAILED(hr))
return hr;
// if nothing more is available, then exit the loop
if (hr != S_OK)
break;
// generate an output path for this fragment
swprintf_s(szPath, _countof(szPath), L"%s%u.ts", pszFilePrefix, fragment);
// save the fragments to a file
hr = pDVR->CopyBufferToFile(CComBSTR(szPath), dFragmentStartPos, dFragmentEndPos);
if (FAILED(hr))
return hr;
}
return S_OK;
}
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