ILMDVRSink::GetTimedFragmentAlignment Example for C++

HRESULT SaveTimedDVRFragments(ILMDVRSink* pDVR, double dTimeThreshold, LPCWSTR pszFilePrefix) 
	double dStartPos; 
	double dEndPos; 
	double dTotal; 
	double dFragmentStartPos; 
	double dFragmentEndPos = 0; 
	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) 
		// 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 Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Multimedia C API Help