|Microsoft DirectX 9.0|
The SetOutputFileName method creates the file writing section of the filter graph.
HRESULT SetOutputFileName( const GUID *pType, LPCOLESTR lpwstrFile, IBaseFilter **ppf, IFileSinkFilter **pSink );
[in] Pointer to a GUID that represents either the media subtype of the output or the class identifier (CLSID) of a multiplexer filter or file writer filter. If you specify a media subtype, it must be one of the following:
|MEDIASUBTYPE_Avi||Audio-Video Interleaved (AVI)|
|MEDIASUBTYPE_Asf||Advanced Systems Format (ASF)|
[in] Pointer to a wide-character string that contains the output file name.
[out] Address of a pointer that receives the multiplexer's IBaseFilter interface.
[out] Address of a pointer that receives the file writer's IFileSinkFilter interface. Can be NULL.
Returns an HRESULT value. Possible values include the following.
|E_POINTER||Null pointer argument.|
This method creates a multiplexer filter based on the value of the pType parameter. For AVI, it creates the AVI Mux Filter. For ASF, it creates the WM ASF Writer. For other values, it creates the filter identified by the CLSID. It adds the multiplexer to the filter graph, and returns a pointer to its IBaseFilter interface in the ppf parameter.
If the multiplexer supports the IFileSinkFilter interface, the method calls IFileSinkFilter::SetFileName to set the output file name, using the value given in the lpwstrFile parameter. If the multiplexer does not support IFileSinkFilter interface, the method adds the File Writer Filter to the filter graph, connects the multiplexer to the file writer, and uses the file writer's IFileSinkFilter interface to call SetFileName. If the pSink parameter is not NULL, it receives a pointer to the IFileSinkFilter interface.
You can use the pointer to the multiplexer filter, returned in the ppf parameter, as the pSink parameter in the ICaptureGraphBuilder2::RenderStream method.
For custom multiplexer filters, the method fails if the filter does not support a connection on its output pin before its input pins are connected. For example, the WavDest Filter Sample included with the SDK has this limitation.
If the method succeeds, the IBaseFilter interface returned in the ppf parameter has an outstanding reference count. If the method succeeds and pSink is not NULL, the IFileSinkFilter interface also has an outstanding reference count. Be sure to release both interfaces when you are done using them.