IMFSourceResolver::CreateObjectFromByteStream method

Creates a media source from a byte stream. This method is synchronous.


HRESULT CreateObjectFromByteStream(
  [in]  IMFByteStream  *pByteStream,
  [in]  LPCWSTR        pwszURL,
  [in]  DWORD          dwFlags,
  [in]  IPropertyStore *pProps,
  [out] MF_OBJECT_TYPE *pObjectType,
  [out] IUnknown       **ppObject


pByteStream [in]

Pointer to the byte stream's IMFByteStream interface.

pwszURL [in]

Null-terminated string that contains the URL of the byte stream. The URL is optional and can be NULL. See Remarks for more information.

dwFlags [in]

Bitwise OR of flags. See Source Resolver Flags.

pProps [in]

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.

pObjectType [out]

Receives a member of the MF_OBJECT_TYPE enumeration, specifying the type of object that was created.

ppObject [out]

Receives a pointer to the media source's IUnknown interface. The caller must release the interface.

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.


This byte stream is not supported.



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 (both if possible):

  • Specify the URL in the pwszURL parameter.
  • Specify the MIME type by setting the MF_BYTESTREAM_CONTENT_TYPE attribute on the byte stream. (This attribute might be set already when you create the byte stream, depending on how the byte stream was created.)
Note  This method cannot be called remotely.


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