IVMRFilterConfig::SetNumberOfStreams method (strmif.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The SetNumberOfStreams method sets the number of streams to be mixed and instructs the VMR to go into mixer mode.

Syntax

HRESULT SetNumberOfStreams(
  [in] DWORD dwMaxStreams
);

Parameters

[in] dwMaxStreams

Double word containing the maximum number of input streams that the VMR will be required to mix. Must not be greater than MAX_MIXER_STREAMS (16).

Return value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Return code Description
E_FAIL
The mixer is already configured.
E_INVALIDARG
An attempt was made to configure the mixer for more than 16 input streams.
E_OUTOFMEMORY
Memory to manage the streams could not be allocated.

Remarks

dwMaxStreams should be equal to the number of input pins required. Pins cannot be added or removed after the VMR has been connected. If you do not know in advance how many input streams will be required, set dxMaxStreams to the maximum number that might be required. A value of 1 is valid for dwMaxStreams. This value does not cause any extra pins to be created, but it does force the VMR to go into "mixer mode." Therefore, once this method has been called, you cannot call SetRenderingMode to set the mode to VMRMode_Renderless

The VMR creates as many input pins as are specified without attempting to determine whether there is enough video memory to support them all. This is because it has no way of knowing the media type or rectangle dimensions at this time. Later, when an upstream filter attempts to connect to a pin, at that point the media type is known and the VMR will examine the video memory and fail the connection if there is not enough to process the stream.

Note  Although the VMR supports multiple streams, they all share a single clock, and therefore you cannot seek one stream independently of the others. If you need to seek the input streams independently, you must use a different technique. See the VMRMulti sample for more information.
 

Requirements

Requirement Value
Minimum supported client Windows XP with SP1 [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header strmif.h (include Dshow.h)
Library Strmiids.lib

See also

Error and Success Codes

IVMRFilterConfig Interface

IVMRFilterConfig::GetNumberOfStreams

Using the Video Mixing Renderer