Microsoft DirectX 8.1 (C++)

IGraphBuilder::RenderFile

The RenderFile method builds a filter graph that renders the specified file.

Syntax

HRESULT RenderFile(
  LPCWSTR lpwstrFile,
  LPCWSTR lpwstrPlayList
);

Parameters

lpwstrFile

[in] Specifies a wide-character string that contains one of the following:

lpwstrPlayList

[in] Reserved. Must be NULL.

Return Value

Returns an HRESULT. Possible values include the following.

Value Description
S_OK Success.
VFW_S_AUDIO_NOT_RENDERED Partial success; the audio was not rendered.
VFW_S_DUPLICATE_NAME Success; the Filter Graph Manager modified the filter name to avoid duplication.
VFW_S_MEDIA_TYPE_IGNORED The method successfully loaded a graph from a .grf file, but one or more filters connected with a different media type than specified.
VFW_S_PARTIAL_RENDER Some of the streams in this movie are in an unsupported format.
VFW_S_VIDEO_NOT_RENDERED Partial success; some of the streams in this movie are in an unsupported format.
E_ABORT Operation aborted.
E_FAIL Failure.
E_INVALIDARG Argument is invalid.
E_OUTOFMEMORY Insufficient memory.
E_POINTER NULL pointer argument.
VFW_E_CANNOT_CONNECT No combination of intermediate filters could be found to make the connection.
VFW_E_CANNOT_LOAD_SOURCE_FILTER The source filter for this file could not be loaded.
VFW_E_CANNOT_RENDER No combination of filters could be found to render the stream.
VFW_E_INVALID_FILE_FORMAT The file format is invalid.
VFW_E_NOT_FOUND An object or name was not found.
VFW_E_UNKNOWN_FILE_TYPE The media type of this file is not recognized.
VFW_E_UNSUPPORTED_STREAM Cannot play back the file: the format is not supported.

Remarks

If the lpwstrFile parameter specifies a media file, the method builds a filter graph for default playback. First it adds a source filter that can read the file, using the same process as the IGraphBuilder::AddSourceFilter method. Then it renders the output pins on the source filter, adding intermediate filters if necessary. It tries filters in the same order as the IGraphBuilder::Connect method.

During the connection process, the Filter Graph Manager ignores pins on intermediate filters if the pin name begins with a tilde (~). For more information, see PIN_INFO.

If the lpwstrFile parameter specifies a GraphEdit (.grf) file, the Filter Graph Manager loads the filter graph from the GraphEdit file.

If the lpwstrFile parameter specifies the display name of a device moniker for a capture device, the Filter Graph Manager creates a simple preview graph. You can use the ICreateDevEnum interface to find the device moniker. Call the IMoniker::GetDisplayName method to retrieve the display name.

Example Code

The following example renders an AVI file for default playback:

hr = pGraph->RenderFile(L"C:\\Media\\Example.avi", 0);

The following example downloads an AVI file over HTTP, using the File Source (URL) filter:

hr = pGraph->RenderFile(L"http://example.microsoft.com/Example.avi", 0);

The following example creates a preview graph from a device moniker:

LPOLESTR strName = NULL;
hr = pMoniker->GetDisplayName(NULL, NULL, &strName);
if (SUCCEEDED(hr))
{
    hr = g_pGraph->RenderFile(strName, NULL);
    CoTaskMemFree(strName);
}

See Also