Microsoft DirectX 9.0

IAMMultiMediaStream::AddMediaStream

The AddMediaStream method adds a new media stream to the filter graph.

Syntax

HRESULT AddMediaStream(
  IUnknown *pStreamObject,
  const MSPID *pPurposeID,
  DWORD dwFlags,
  IMediaStream **ppNewStream
);

Parameters

pStreamObject

[in] Pointer to the IUnknown interface of an object that is used to create the new media stream. This parameter can be NULL. See Remarks for more information.

pPurposeID

[in] Pointer an MSPID the specifies the type of media stream to create. This parameter can be NULL. 

dwFlags

[in] Bitwise combination of zero or more of the following flags.

Value Description
AMMSF_ADDDEFAULTRENDERER Add a default renderer (audio streams only).
AMMSF_CREATEPEER Create a new stream based on the object specified in pStreamObject.
AMMSF_NOSTALL Create a stream that does not block waiting for Update calls.
AMMSF_STOPIFNOSAMPLES Create a stream that stops if there are not samples.

ppNewStream

[out] Address of a variable that receives an IMediaStream interface pointer.

Return Values

Returns an HRESULT value. Possible values include the following.

Return code Description
E_INVALIDARG Invalid argument.
E_POINTER Null pointer argument.
MS_E_PURPOSEID Invalid purpose ID.
S_OK Success.

Remarks

If pPurposeID is NULL, pMediaStream must specify an IMediaStream object. The object's GetInformation method is used to determine the purpose ID, which is then used to create the new media stream.

If the purpose ID is MSPID_PrimaryAudio and dwFlags includes the AMMSF_ADDDEFAULTRENDERER flag, the method adds the DirectSound Renderer to the filter graph.

If dwFlags includes the AMMSF_CREATEPEER flag, the method uses the object specified by pStreamObject to create a new media stream. In that case, pStreamObject can specify any of the following:

If neither flag is set, pStreamObject can be any of the following:

If the method succeeds, the caller must release the returned IMediaStream interface.

See Also