MFCreateSinkWriterFromURL

Creates the sink writer from a URL or byte stream.

Syntax

HRESULT MFCreateSinkWriterFromURL(
         LPCWSTR pwszOutputURL,
         IMFByteStream *pByteStream,
         IMFAttributes *pAttributes,
         IMFSinkWriter **ppSinkWriter
)  

Parameters

pwszOutputURL
Type: LPCWSTR 

[in, optional] A null-terminated string that contains the URL of the output file. This parameter can be NULL.

pByteStream
Type: IMFByteStream *

[in, optional] Pointer to the IMFByteStream interface of a byte stream. This parameter can be NULL.If this parameter is a valid pointer, the sink writer writes to the provided byte stream. (The byte stream must be writable.) Otherwise, if pByteStream is NULL, the sink writer creates a new file named pwszOutputURL.

pAttributes
Type: IMFAttributes *

[in, optional] Pointer to the IMFAttributes interface. You can use this parameter to configure the sink writer. For more information, see Sink Writer Attributes. This parameter can be NULL.

ppSinkWriter
Type: IMFSinkWriter **

[out] Receives a pointer to the IMFSinkWriter interface. The caller must release the interface.

Return value

Type: HRESULT 

Return codes
Return code Description
S_OK Success.
MF_E_NOT_FOUND The specified URL was not found.

Refer to Media Foundation return codes.

Remarks

Call CoInitialize(Ex) and MFStartup before calling this function.

The first three parameters to this function can be NULL; however, only certain combinations are valid:

Description pwszOutputURL pByteStream pAttributes
Specify a byte stream, with no URL. NULL non-NULL Required (must not be NULL).
Specify a URL, with no byte stream. not NULL NULL Optional (may be NULL).
Specify both a URL and a byte stream. non-NULL non-NULL Optional (may be NULL).

The pAttributes parameter is required in the first case and optional in the others.

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

Requirements

Header: Declared in mfreadwrite.h.

Library: Use Mfreadwrite.lib.