The IFileSourceFilter interface is exposed by source filters to set the file name and media type of the media file that they are to render. It is an abbreviated version of the OLE IPersistFile interface. If the file has a type that can be determined by the algorithm described in Registering a Custom File Type, the recommended file source filter CLSID is used when the filter graph manager attempts to render the filter graph.
When to Implement
If a filter needs the name of a file to open, it should expose this interface to allow an application to set the file name. Note that there is no base class implementation of this interface.
When to Use
An application that inserts file source filters directly must query for this interface and set the file name. Normally, the filter graph manager uses this interface when an application calls IGraphBuilder::RenderFile. The Graphedt.exe tool queries for the IFileSourceFilter interface and prompts for a file name if it finds it.
Methods in Vtable Order
IUnknown methods | Description |
QueryInterface | Returns pointers to supported interfaces. |
AddRef | Increments the reference count. |
Release | Decrements the reference count. |
IFileSourceFilter methods | Description |
Load | Loads the source filter with the file. |
GetCurfile | Retrieves the current file. |
Collects information about the file to open.
HRESULT GetCurfile(
LPOLESTR *ppszFileName,
AM_MEDIA_TYPE *pmt
);
Returns an HRESULT value.
Loads a media file.
HRESULT Load(
LPCOLESTR pszFileName,
const AM_MEDIA_TYPE *pmt
);
Returns an HRESULT value.
This is an initialization method for the interface. It is not designed to load multiple files, and any calls to this method after the first call will fail.
You should implement this method to load the file specified by pszFileName.
Note that the name in pszFileName need not actually be a disk file name (that is, one you could pass to the Microsoft® Win32® CreateFile function, for example). It could also be a URL name. The URL moniker filter uses IFileSourceFilter to retrieve its URL name, and IGraphBuilder::AddSourceFilter (and hence IGraphBuilder::RenderFile) handles this correctly. IGraphBuilder::AddSourceFilter returns a specific error (ERROR_FILE_NOT_FOUND) upon not finding the file, which indicates that the file specified does not exist and not that the filter does not exist.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.