Microsoft DirectX 8.1 (C++) |
The Render method completes rendering of the stream originating with this pin. This can involve adding filters to the filter graph and connecting them.
Syntax
HRESULT Render(
IPin *ppinOut,
IGraphBuilder *pGraph
);
Parameters
ppinOut
[in] Pointer to this pin's IPin interface.
pGraph
[in] Pointer to the filter graph manager's IGraphBuilder interface.
Return Value
Returns an HRESULT value. A return code of S_OK indicates that the stream was successfully rendered.
Remarks
The following code illustrates how to implement this method on an output pin:
STDMETHODIMP CMyOutputPin::Render(IPin *pOutputPin, IGraphBuilder *pBuilder)
{
// This filter needs my special renderer connected to it.
IBaseFilter *pMyRenderer = NULL;
IPin *pMyRendererInputPin = NULL;
bool bAddedToGraph = false;
// Create my renderer.
HRESULT hr = CoCreateInstance(CLSID_MyRenderer, NULL, CLSCTX_INPROC, IID_IBaseFilter, (void **)&pMyRenderer);
if (SUCCEEDED(hr)) {
// Add my renderer to the filter graph.
hr = pBuilder->AddFilter(pMyRenderer, L"My Renderer");
}
// Find my renderer's input pin.
if (SUCCEEDED(hr)) {
bAddedToGraph = true;
IEnumPins *pEnumPins;
hr = pMyRenderer->EnumPins(&pEnumPins);
if (SUCCEEDED(hr)) {
DWORD nPins;
if (S_OK != pEnumPins->Next(1, &pMyRendererInputPin, &nPins)) {
hr = E_UNEXPECTED;
}
}
}
if (SUCCEEDED(hr)) {
// Connect my renderer to my output pin.
hr = pBuilder->ConnectDirect(pOutputPin, pMyRendererInputPin);
}
if (FAILED(hr)) {
if (bAddedToGraph) {
pBuilder->RemoveFilter(pMyRenderer);
}
pMyRenderer->Release();
}
if (NULL != pMyRendererOutputPin) {
pMyRendererInputPin->Release();
}
return hr;
}
See Also