IFileSinkFilter2 Interface


The IFileSinkFilter2 interface derives from the IFileSinkFilter interface and replaces it unless you need backward compatibility with ActiveMovie™ 1.0. Like IFileSinkFilter, filters that write media streams to a file implement this interface. A file sink filter in a video capture filter graph, for instance, saves the output of the video compression filter to a file. Typically, the application running this filter graph should allow the user to enter the name of the file to which to save the data. This interface enables you to communicate this information. IFileSinkFilter2 adds the option to determine whether the file it writes should destroy an existing file of the same name. In the video capture case, do not destroy a file you've already created, because preallocating file space takes valuable time. By default, the new file does not destroy the old one. Otherwise, destroy the original file to make sure the file you author doesn't contain garbage.

When to Implement

A filter should implement this interface when it needs the name of an output file or needs to set options for that file. Implement the older IFileSinkFilter interface if you need to make your filter compatible with ActiveMovie 1.0. Note that there is currently no base class implementation of this interface.

When to Use

When an application must set the name of the file into which the file sink filter will write, it should use this interface to get and set the file name or change options. Use the older IFileSinkFilter interface if you need to make your application compatible with ActiveMovie 1.0.

Methods in Vtable Order
IUnknown methods Description
QueryInterface Retrieves 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).
IFileSinkFilter2 methods Description
SetMode Determines whether the file writer destroys the file when it creates the new one.
GetMode Retrieves whether the file writer destroys the file when it creates the new one.


IFileSinkFilter2::SetMode

IFileSinkFilter2 Interface

Determines whether the file writer destroys the file when it creates the new one.

HRESULT SetMode(
  DWORD dwFlags
  );

Parameters
dwFlags
[in] Currently, the only defined flag is AM_FILE_OVERWRITE, which indicates that the file writer should destroy the file. Specify zero for dwFlags to leave the file alone.
Return Values

Returns an HRESULT value that depends on the implementation of the interface.


IFileSinkFilter2::GetMode

IFileSinkFilter2 Interface

Retrieves whether the file writer destroys the file when it creates the new one.

HRESULT GetMode(
  DWORD *dwFlags
  );

Parameters
dwFlags
[out] Pointer to the retrieved flags. Currently, the only defined flag is AM_FILE_OVERWRITE, which indicates that the file should be destroyed; zero indicates that the file will be left alone.
Return Values

Returns an HRESULT value that depends on the implementation of the interface.

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