IMFSchemeHandler::BeginCreateObject method (mfidl.h)
Begins an asynchronous request to create an object from a URL.
When the Source Resolver creates a media source from a URL, it passes the request to a scheme handler. The scheme handler might create a media source directly from the URL, or it might return a byte stream. If it returns a byte stream, the source resolver use a byte-stream handler to create the media source from the byte stream.
Syntax
HRESULT BeginCreateObject(
[in] LPCWSTR pwszURL,
[in] DWORD dwFlags,
[in] IPropertyStore *pProps,
[out] IUnknown **ppIUnknownCancelCookie,
[in] IMFAsyncCallback *pCallback,
[in] IUnknown *punkState
);
Parameters
[in] pwszURL
A null-terminated string that contains the URL to resolve.
[in] dwFlags
A bitwise OR of one or more flags. See Source Resolver Flags.
[in] pProps
A pointer to the IPropertyStore interface of a property store. The scheme handler can use this property store to configure the object. This parameter can be NULL. For more information, see Configuring a Media Source.
[out] ppIUnknownCancelCookie
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 IMFSchemeHandler::CancelObjectCreation method. The caller must release the interface. This parameter can be NULL, in which case the IUnknown pointer is not returned to the caller.
[in] pCallback
A pointer to the IMFAsyncCallback interface of a callback object. The caller must implement this interface.
[in] punkState
A pointer 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 code | Description |
---|---|
|
The method succeeded. |
|
Cannot open the URL with the requested access (read or write). |
|
Unsupported byte stream type. |
Remarks
The dwFlags parameter must contain the MF_RESOLUTION_MEDIASOURCE flag or the MF_RESOLUTION_BYTESTREAM flag. If the MF_RESOLUTION_MEDIASOURCE flag is set, the scheme handler might create the media source directly from the URL, or it might create a byte stream. The type of object is returned in the pObjectType parameter of the IMFSchemeHandler::EndCreateObject method. If the scheme handler returns a byte stream, the source resolver will pass the byte stream to a byte-stream handler, which will create the media source from the byte stream.
If the MF_RESOLUTION_BYTESTREAM flag is set, the scheme handler will attempt to create a byte stream from the URL. However, if the scheme handler is designed to create a media source directly, rather than a byte stream, the method will fail.
The following table summarizes the behavior of these two flags when passed to this method:
Flag | Object created |
---|---|
MF_RESOLUTION_MEDIASOURCE | Media source or byte stream |
MF_RESOLUTION_BYTESTREAM | Byte stream |
The MF_RESOLUTION_MEDIASOURCE and MF_RESOLUTION_BYTESTREAM flags can be combined, although in this case it is redundant.
When the operation completes, the scheme handler calls the IMFAsyncCallback::Invoke method. The Invoke method should call IMFSchemeHandler::EndCreateObject to get a pointer to the created object.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | mfidl.h |
Library | Mfuuid.lib |