共用方式為


IWMMutualExclusion2::GetStreamsForRecord method (wmsdkidl.h)

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The GetStreamsForRecord method retrieves the list of streams that are present in a record.

Syntax

HRESULT GetStreamsForRecord(
  [in]      WORD wRecordNumber,
  [out]     WORD *pwStreamNumArray,
  [in, out] WORD *pcStreams
);

Parameters

[in] wRecordNumber

WORD containing the record number for which to retrieve the streams.

[out] pwStreamNumArray

Pointer to an array that will receive the stream numbers. If it is NULL, GetStreamsForRecord will return the number of streams to pcStreams.

[in, out] pcStreams

Pointer to a WORD containing the number of streams in the record.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK
The method succeeded.
E_INVALIDARG
pcStreams is NULL.

OR

wRecordNumber does not contain a valid record number.

ASF_E_BUFFERTOOSMALL
The value passed as pcStreams is smaller than the number of streams in the record. On exit with this error code, the value at pcStreams will contain the correct number of streams.
E_FAIL
The method is unable to access the record for an unspecified reason.

Remarks

You should make two calls to GetStreamsForRecord. On the first call, pass NULL as pwStreamNumArray. On return, the value of pcStreams is set to the number of streams. Then you can allocate the amount of memory needed to hold the array and pass a pointer to it as pwStreamNumArray on the second call.

If you pass an array that is not large enough to contain all of the streams, an error code of ASF_E_BUFFERTOOSMALL is returned. When returning this error code, the method still sets the value at pcStreams to the correct number of streams.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only],Windows Media Format 9 Series SDK, or later versions of the SDK
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wmsdkidl.h (include Wmsdk.h)
Library Wmvcore.lib; WMStubDRM.lib (if you use DRM)

See also

IWMMutualExclusion2 Interface