## IFileSinkFilter Interface

The IFileSinkFilter interface is implemented on filters that write media streams to a file. A file sink filter in a video capture filter graph, for instance, writes the output of the video compression filter to a file. Typically, the application running this filter graph will want to allow the user to enter the name of the file to be written to. This interface enables the communication of this information.

IFileSinkFilter2 replaces this interface unless you need to maintain backward compatibility with ActiveMovie 1.0.

When to Implement

If a filter needs the name of an output file, it should expose this interface to allow an application to set the file name. Note that there is currently no base class implementation of this interface.

When to Use

Any application that must set the name of the file into which the file sink filter will write should use this interface to get and set the file name.

Methods in Vtable Order

IUnknown methods | Description
QueryInterface | Returns pointers to supported interfaces.
AddRef | Increments the reference count.
Release | Decrements the reference count.

IFileSinkFilter methods | Description
SetFileName | Sets the name of the file into which media samples will be written.
GetCurFile | Retrieves the name of the current file into which media samples will be written (the sink file).

###

IFileSinkFilter::GetCurFile

IFileSinkFilter Interface

Retrieves the name of the current file into which media samples will be written (the sink file).

HRESULT GetCurFile(
LPOLESTR *ppszFileName,
AM_MEDIA_TYPE *pmt
);

##### Parameters

ppszFileName
  [out] Name of the file set to receive media samples.
pmt
  Type of media samples to be written to the file.

##### Return Values

Returns an HRESULT value that depends on the implementation. HRESULT can be one of the following standard constants, or other values not listed:

Value | Meaning
E_FAIL | Failure.
E_POINTER | Null pointer argument.
E_INVALIDARG | Invalid argument.
E_NOTIMPL | Method isn't supported.
S_OK or NOERROR | Success.

##### Remarks

If a file name is not assigned, this method returns E_FAIL.

###

IFileSinkFilter::SetFileName

IFileSinkFilter Interface

Sets the name of the file into which media samples will be written.

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

##### Parameters

pszFileName
  [in] Name of the file to receive the media samples.
pmt
  [in] Type of media samples to be written to the file, and the media type of the sink filter's input pin.

##### Return Values

Returns an HRESULT value that depends on the implementation. HRESULT can be one of the following standard constants, or other values not listed:

Value | Meaning
E_FAIL | Failure.
E_POINTER | Null pointer argument.
E_INVALIDARG | Invalid argument.
E_NOTIMPL | Method isn't supported.
S_OK or NOERROR | Success.

##### 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.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.