IGraphBuilder::RenderFile

 
Microsoft DirectShow 9.0

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 the name of a media file.

lpwstrPlayList

[in] Reserved. Must be NULL.

Return Values

Returns an HRESULT. Possible values include the following.

Return code 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_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.

Note that the RenderFile method does not remove any filters from the graph. If you call RenderFile twice, the second call simply adds more filters to the graph. When you run the graph, both sources will play at the same time.

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);

Requirements

Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also


Show: