mmSetSkewCorrection

Sets the skew correction time for an audio stream relative to the video stream.

Prototype

DWORD mmSetSkewCorrection ( MMFile *pMMFile, int skewCorrection)

Argument

Description

pMMFile

A pointer to the object that controls the multimedia file.

skewCorrection

Skew correction time for an audio (AMR) stream during a 3GP file record. The effect of a skew correction is based on the fact that AMR frames are 20 ms duration:

If the skewCorrection value is...

Then...

Greater than 0 ms

The first audio frame is repeated (n ms / 20 ms) times in the audio data stream.

For example, if skewCorrection is 40 ms, the first audio frame is repeated twice (40 ms / 20 ms = 2).

Less than 0 ms

The first (n ms / 20 ms) audio frames are removed from the audio stream. For example, if skewCorrection = -40 ms, the first two audio frames are removed from the audio stream (-40 ms / 20 ms = -2).

Valid values are -4095 to 4095 ms.

Return values

Return value

Description

SUCCESS

 

MMERR_INVALID_SKEW_TIME

Skew time is not -4095 to 4095 ms.

Details

Use mmSetSkewCorrection to synchronize the audio and video streams. The skew correction operation is allowed only during the record of a 3GP file. Call mmSetSkewCorrection before the first call to mmWriteStream for the audio stream.

Example

DWORD ret;
int skewCorrection = 20; /* Set skew correction to 20 ms */
ret = mmSetSkewCorrection( &mmfile, skewCorrection);
if (ret != SUCCESS)
{
printf("\nERROR: failed to set the skew correction time ... ret (%d)\n", ret);
}