ICaptureGraphBuilder2::SetOutputFileName

 
Microsoft DirectShow 9.0

ICaptureGraphBuilder2::SetOutputFileName

The SetOutputFileName method creates the file writing section of the filter graph.

Syntax

  HRESULT SetOutputFileName(
  const GUID *pType,
  LPCOLESTR lpwstrFile,
  IBaseFilter **ppf,
  IFileSinkFilter **pSink
);

Parameters

pType

[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:

Value Description
MEDIASUBTYPE_Avi Audio-Video Interleaved (AVI)
MEDIASUBTYPE_Asf Advanced Systems Format (ASF)

lpwstrFile

[in] Pointer to a wide-character string that contains the output file name.

ppf

[out] Address of a pointer that receives the multiplexer's IBaseFilter interface.

pSink

[out] Address of a pointer that receives the file writer's IFileSinkFilter interface. Can be NULL.

Return Values

Returns an HRESULT value. Possible values include the following.

Return code Description
S_OK Success.
E_FAIL Failure.
E_POINTER Null pointer argument.

Remarks

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.

Requirements

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

Library: Use Strmiids.lib.

See Also