IFileSinkFilter::SetFileName 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 SetFileName method sets the name of the file into which media samples will be written.

Syntax

HRESULT SetFileName(
  [in] LPCOLESTR           pszFileName,
  [in] const AM_MEDIA_TYPE *pmt
);

Parameters

[in] pszFileName

Pointer to the name of the file to receive the media samples.

[in] pmt

Pointer to the type of media samples to be written to the file, and the media type of the sink filter's input pin.

Return value

Returns an HRESULT value.

Remarks

If the pszFileName parameter names a nonexistent file, the file will be created. If it names an existing file, the sink filter will overwrite the file without first deleting it.

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

See also

Error and Success Codes

IFileSinkFilter Interface

IFileSinkFilter2