This method retrieves a media stream that has the specified purpose ID.

HRESULT GetMediaStream(
  REFMSPID idPurpose,
  IMediaStream** ppMediaStream


  • idPurpose
    [in] Value that specifies the desired stream.
  • ppMediaStream
    [out] Address of a pointer to an IMediaStream interface that will point to the desired media stream.

Return Values

Returns one of the following values.

Value Description
E_POINTER The ppMediaStream pointer is invalid.
MS_E_NOSTREAM No stream has the specified purpose ID.
S_OK Success.


If a stream exists that matches the purpose ID in idPurpose, the ppMediaStream parameter points to the stream and increments its reference count.

MSPID_PrimaryVideo and MSPID_PrimaryAudio, which represent the primary video and audio streams, are the most commonly used purpose IDs.


DirectShow applications and DirectShow filters have different include file and link library requirements. See Setting Up the Build Environment for more information.

OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.

See Also

IMultiMediaStream Interface

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.