Microsoft DirectX 9.0 |
This topic applies to Windows XP Service Pack 1 only.
The Stream Buffer Engine uses multiple filter graphs:
The sink graph can also create permanent recordings, which can be viewed later using the Stream Buffer Source filter. Currently, the Stream Buffer Engine supports MPEG-2 video and digital video (DV) sources.
To build the sink graph:
The profile is automatically unlocked when the graph stops.
For MPEG-2 content, insert the MPEG-2 Video Analyzer filter directly between the MPEG-2 Demultiplexer filter and the Stream Buffer Sink filter. The Video Analyzer filter enables the source graph to use playback rates faster than 4x or less than 0 (reverse playback).
For more information about building the capture portion of the sink graph, see the following topics:
To build the source graph:
The following code shows how to create the source graph. Error checking is omitted for brevity.
// Create the filter graph.
CComPtr<IGraphBuilder> pSourceGraph;
hr = pSourceGraph.CoCreateInstance(CLSID_FilterGraph);
// Add the Stream Buffer Source filter to the graph.
CComPtr<IStreamBufferSource> pSource;
hr = pSource.CoCreateInstance(CLSID_StreamBufferSource);
CComQIPtr<IBaseFilter> pSourceF(pSource);
hr = pSourceGraph->AddFilter(pSourceF, L"SBESource");
// Set the stream sink.
hr = pSource->SetStreamSink(pSink);
// Or, pass in the file name, as follows:
// CComQIPtr<IFileSourceFilter> pFileSource(pSource);
// pFileSource->Load(L"StubFileNameHere", 0);
// Render each output pin.
CComPtr<IPin> pSourcePinOut;
CComPtr<IEnumPins> pPinEnum;
hr = pSourceF->EnumPins(&pPinEnum);
while (hr = pPinEnum->Next(1, &pSourcePinOut, 0), hr == S_OK)
{
hr = pSourceGraph->Render(pSourcePinOut);
pSourcePinOut.Release();
}
To start capturing, run the sink graph. To start playback, run the source graph. The source graph can be run, paused, or stopped independently of the sink graph.
There is normally no reason to stop the source graph until the viewing or recording session is over. The sink graph uses a ring buffer, so the total size of the temporary backing files will not exceed a preset maximum. Stopping the source graph will create holes in the recorded content. For television sources, it is possible to change channels while the source graph is running.
To seek the source graph, use the IStreamBufferMediaSeeking interface directly on the Stream Buffer Source filter. For finished recordings, you can also use the IMediaSeeking or IMediaPosition interfaces on the Filter Graph Manager. Do not use these interfaces for live content, however. For more information, see Stream Buffer Source Filter.