| Microsoft DirectX 8.1 (C++) | 
Retrieves a media stream that has the specified purpose ID.
Syntax
HRESULT GetMediaStream(
  REFMSPID idPurpose,
  IMediaStream **ppMediaStream
  );
Parameters
idPurpose
Value that specifies the desired stream.
ppMediaStream
Address of a pointer to an IMediaStream interface that will point to the desired media stream.
Return Value
Returns one of the following values.
| Return code | Description | 
| E_POINTER | The ppMediaStream pointer is invalid. | 
| MS_E_NOSTREAM | No stream has the specified purpose ID. | 
| S_OK | Success. | 
Remarks
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.
See Also