IMFSinkWriter::GetServiceForStream method (mfreadwrite.h)

Queries the underlying media sink or encoder for an interface.

Syntax

HRESULT GetServiceForStream(
  [in]  DWORD   dwStreamIndex,
  [in]  REFGUID guidService,
  [in]  REFIID  riid,
  [out] LPVOID  *ppvObject
);

Parameters

[in] dwStreamIndex

The zero-based index of a stream to query, or MF_SINK_WRITER_MEDIASINK to query the media sink itself.

[in] guidService

A service identifier GUID, or GUID_NULL. If the value is GUID_NULL, the method calls QueryInterface to get the requested interface. Otherwise, the method calls IMFGetService::GetService. For a list of service identifiers, see Service Interfaces.

[in] riid

The interface identifier (IID) of the interface being requested.

[out] ppvObject

Receives a pointer to the requested interface. The caller must release the interface.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

If the dwStreamIndex parameter equals MF_SINK_WRITER_MEDIASINK, the method attempts to get the interface from the media sink. Otherwise, it attempts to get the interface from the encoder for the stream at the specified index. If that fails, or if no encoder is present, the method attempts to get the interface from the stream on the media sink.

If the input and output types of the sink are identical and compressed, it's possible that no encoding is required and the video encoder will not be instantiated. In that case, GetServiceForStream will return MF_E_UNSUPPORTED_SERVICE.

This interface is available on Windows Vista if Platform Update Supplement for Windows Vista is installed.

Requirements

Requirement Value
Minimum supported client Windows 7, Windows Vista and Platform Update Supplement for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header mfreadwrite.h

See also

IMFSinkWriter

Sink Writer