IMFReadWriteClassFactory::CreateInstanceFromObject method (mfreadwrite.h)

Creates an instance of the sink writer or source reader, given an IUnknown pointer.

Syntax

HRESULT CreateInstanceFromObject(
  REFCLSID      clsid,
  IUnknown      *punkObject,
  IMFAttributes *pAttributes,
  REFIID        riid,
  LPVOID        *ppvObject
);

Parameters

clsid

The CLSID of the object to create.

Value Meaning
CLSID_MFSinkWriter
Create the sink writer. The ppvObject parameter receives an IMFSinkWriter interface pointer.
CLSID_MFSourceReader
Create the source reader. The ppvObject parameter receives an IMFSourceReader interface pointer.

punkObject

A pointer to the IUnknown interface of an object that is used to initialize the source reader or sink writer. The method queries this pointer for one of the following interfaces.

Value Meaning
IMFByteStream
Pointer to a byte stream.

If clsid is CLSID_MFSinkWriter, the sink writer writes data to this byte stream.

If clsid is CLSID_MFSourceReader, this byte stream provides the source data for the source reader.

IMFMediaSink
Pointer to a media sink. Applies only when clsid is CLSID_MFSinkWriter.
IMFMediaSource
Pointer to a media source. Applies only when clsid is CLSID_MFSourceReader.

pAttributes

A pointer to the IMFAttributes interface. You can use this parameter to configure the sink writer or source reader. For more information, see the following topics:

This parameter can be NULL.

riid

The IID of the requested interface.

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

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

Requirements

   
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

IMFReadWriteClassFactory