Microsoft DirectX 9.0

IConfigAviMux::SetMasterStream

The SetMasterStream method specifies a stream that will be used to synchronize the other streams in the file.

Syntax

HRESULT SetMasterStream(
  LONG iStream
);

Parameters

iStream

[in] 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 Values

Returns an HRESULT value. Possible values include the following.

Value 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.

See Also