IConfigAviMux::SetMasterStream 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 SetMasterStream method specifies a stream that will be used to synchronize the other streams in the file.

Syntax

HRESULT SetMasterStream(
  [in] LONG iStream
);

Parameters

[in] iStream

Specifies the index of the stream, or –1 to indicate no master stream. The AVI Mux writes one stream for each connected input pin. Stream numbers are indexed from zero.

Return value

Returns an HRESULT value. Possible values include the following.

Return code Description
E_INVALIDARG
Invalid argument.
S_OK
Success.

Remarks

If you are capturing audio and video from two different sources, use this method to synchronize the streams. Streams coming from separate capture sources may be captured at slightly different rates. If you specify a master stream, the AVI Mux adjusts the playback rates for the other streams, to compensate for any drift that might occur.

It is recommended to use the audio stream as the master stream, because minor adjustments to the video playback rate are less noticeable than changes to the audio playback rate. Also, modifying the audio playback rate will cause the audio to be resampled by the audio driver.

This method works by adjusting the dwScale and dwRate values in the AVISTREAMHEADER structure.

Requirements

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

See also

AVI RIFF File Reference

Error and Success Codes

IConfigAviMux Interface