The following method for C++ shows how to get the DVR Sink object from the ltmmPlayControl object, using it to set DVR settings.
void StartDVRCapture(IltmmCapture *pCapture, LPTSTR szBufferFile, long fileCount, double bufferSize)
{
USES_CONVERSION;
HRESULT hr = S_OK;
pCapture->EnterEdit();
BSTR bstrBufferFile = SysAllocString(T2OLE(szBufferFile));
// Tell the capture control where to store the captured data
pCapture->put_TargetFile(bstrBufferFile);
SysFreeString(bstrBufferFile);
// Get the graph ready to capture video and audio, but don't start capturing yet
hr = pCapture->ReadyCapture(ltmmCapture_Mode_VideoAndAudio | ltmmCapture_Mode_InhibitRun);
if(SUCCEEDED(hr))
{
IUnknown *punk = NULL;
// Get the sink object unknown interface
hr = pCapture->GetSubObject(ltmmCapture_Object_Sink, &punk);
if(SUCCEEDED(hr) && NULL != punk)
{
ILMDVRSink *pDvrSink = NULL;
// Get the sink interface from the unknown object
HRESULT hr = punk->QueryInterface(IID_ILMDVRSink, (LPVOID*)&pDvrSink);
if (SUCCEEDED(hr))
{
// Tell the sink that settings are going to change
pDvrSink->StartChangingAttributes();
// Set the folder count (one buffer folder) and number of buffer files and their maximum size
pDvrSink->put_FolderCount(1);
pDvrSink->SetBufferSize(0, fileCount, bufferSize);
// Apply the DVR settings
pDvrSink->StopChangingAttributes(FALSE);
// Release the sink interface
pDvrSink->Release();
}
// Release the unknown interface
punk->Release();
}
// Start the graph capturing data
hr = pCapture->RunCapture();
}
pCapture->LeaveEdit();
}
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