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 should enable 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 Microsoft® ActiveMovie™ 1.0.

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.

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 methodsDescription
QueryInterface Retrieves pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.
IFileSinkFilter methodsDescription
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).

Syntax

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

Parameters

ppszFileName
[out] Address of a pointer to the name of the file set to receive media samples.
pmt
[out] Pointer to the type of media samples to be written to the file.

Return Value

Returns an HRESULT value that depends on the implementation. HRESULT can be one of the following standard constants, or other values not listed.
E_FAIL Failure.
E_POINTER Null pointer argument.
E_INVALIDARG Invalid argument.
E_NOTIMPL Method isn't supported.
S_OK or NOERROR Success.

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.

Syntax

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

Parameters

pszFileName
[in] Pointer to the name of the file to receive the media samples.
pmt
[in] 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 that depends on the implementation. HRESULT can be one of the following standard constants, or other values not listed.
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.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.