IGraphBuilder::RenderFile method (strmif.h)
[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
The RenderFile
method builds a filter graph that renders the specified file.
Syntax
HRESULT RenderFile(
[in] LPCWSTR lpcwstrFile,
[in] LPCWSTR lpcwstrPlayList
);
Parameters
[in] lpcwstrFile
Specifies a wide-character string that contains the name of a media file.
[in] lpcwstrPlayList
Reserved. Must be NULL.
Return value
Returns an HRESULT. Possible values include the following.
Return code | Description |
---|---|
|
Success. |
|
Partial success; the audio was not rendered. |
|
Success; the Filter Graph Manager modified the filter name to avoid duplication. |
|
Some of the streams in this movie are in an unsupported format. |
|
Partial success; some of the streams in this movie are in an unsupported format. |
|
Operation aborted. |
|
Failure. |
|
Argument is invalid. |
|
Insufficient memory. |
|
NULL pointer argument. |
|
No combination of intermediate filters could be found to make the connection. |
|
The source filter for this file could not be loaded. |
|
No combination of filters could be found to render the stream. |
|
The file format is invalid. |
|
An object or name was not found. |
|
The media type of this file is not recognized. |
|
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.
Examples
The following example renders an AVI file for default playback:
C++ |
---|
hr = pGraph->RenderFile(L"C:\\Media\\Example.avi", 0); |
C++ |
---|
hr = pGraph->RenderFile(L"http://example.microsoft.com/Example.avi", 0); |
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | strmif.h (include Dshow.h) |
Library | Strmiids.lib |