IMFSourceResolver::BeginCreateObjectFromByteStream method

Begins an asynchronous request to create a media source from a byte stream.


HRESULT BeginCreateObjectFromByteStream(
  [in]  IMFByteStream    *pByteStream,
  [in]  LPCWSTR          pwszURL,
  [in]  DWORD            dwFlags,
  [in]  IPropertyStore   *pProps,
  [out] IUnknown         **ppIUnknownCancelCookie,
  [in]  IMFAsyncCallback *pCallback,
  [in]  IUnknown         *punkState


pByteStream [in]

A pointer to the byte stream's IMFByteStream interface.

pwszURL [in]

A null-terminated string that contains the original URL of the byte stream. This parameter can be NULL.

dwFlags [in]

A bitwise OR of one or more flags. See Source Resolver Flags.

pProps [in]

A pointer to the IPropertyStore interface of a property store. The method passes the property store to the byte-stream handler. The byte-stream handler can use the property store to configure the media source. This parameter can be NULL. For more information, see Configuring a Media Source.

ppIUnknownCancelCookie [out]

Receives an IUnknown pointer or the value NULL. If the value is not NULL, you can cancel the asynchronous operation by passing this pointer to the IMFSourceResolver::CancelObjectCreation method. The caller must release the interface. This parameter can be NULL.

pCallback [in]

A pointer to the IMFAsyncCallback interface of a callback object. The caller must implement this interface.

punkState [in]

A oointer to the IUnknown interface of a state object, defined by the caller. This parameter can be NULL. You can use this object to hold state information. The object is returned to the caller when the callback is invoked.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription

The method succeeded.


The dwFlags parameter contains mutually exclusive flags.


The byte stream is not supported.


The byte stream does not support seeking.



The dwFlags parameter must contain the MF_RESOLUTION_MEDIASOURCE flag and should not contain the MF_RESOLUTION_BYTESTREAM flag.

The source resolver attempts to find one or more byte-stream handlers for the byte stream, based on the file name extension of the URL, or the MIME type of the byte stream (or both). The URL is specified in the optional pwszURL parameter, and the MIME type may be specified in the MF_BYTESTREAM_CONTENT_TYPE attribute on the byte stream. Byte-stream handlers are registered by file name extension or MIME type, or both, as described in Scheme Handlers and Byte-Stream Handlers. The caller should specify at least one of these values.

When the operation completes, the source resolver calls the IMFAsyncCallback::Invoke method. The Invoke method should call IMFSourceResolver::EndCreateObjectFromByteStream to get a pointer to the media source.


Minimum supported client

Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 [desktop apps | Windows Store apps]





See also

Source Resolver