共用方式為


IWMProfile::AddStream 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 AddStream method adds a stream to the profile by copying the stream configuration details into the profile.

Use AddStream only to include a stream that is new to the profile. New streams can be created by calling IWMProfile::CreateNewStream, but will not be added to the profile until AddStream is called.

If you edit an existing stream using IWMProfile::GetStream or IWMProfile::GetStreamByNumber, you should not call AddStream to include the changes. To include changes made to an existing stream, call IWMProfile::ReconfigStream.

Syntax

HRESULT AddStream(
  [in] IWMStreamConfig *pConfig
);

Parameters

[in] pConfig

Pointer to the IWMStreamConfig interface of the stream configuration object to be added to the profile. The stream must be configured by using the methods of the IWMStreamConfig interface before this method is used to add the stream to the profile.

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
The pConfig parameter is NULL.
E_OUTOFMEMORY
There is not enough available memory.
E_FAIL
The method failed for an unspecified reason.
NS_E_INVALID_STREAM
The stream is not valid, possibly because it does not have a valid stream number.

Remarks

When a stream is added, its configuration is copied into the profile. A maximum of 63 streams can exist in a profile.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only],Windows Media Format 7 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

IWMProfile Interface

IWMProfile2

IWMProfile3

IWMProfile::GetStream

IWMProfile::RemoveStream

IWMStreamConfig Interface