|Microsoft DirectX 9.0|
The Rate Change property set enables MPEG-2 source/parser filters to change the playback rate. MPEG-2 decoders should support this property set. The DVD Navigator and the Stream Buffer Engine both use this property set to control playback rates.
|Property Set GUID||AM_KSPROPSETID_TSRateChange|
|AM_RATE_CorrectTS||Informs the decoder that the Navigator is setting the correct time stamps. Earlier versions of the DVD Navigator did not set the correct time stamps when the playback rate was something other than 1.0. Many decoders work around this problem by ignoring the time stamps during rewind or fast forward, and estimating the correct presentation times.
These problems have been corrected in the current version of the DVD Navigator. For backward compatibility with existing decoders, the DVD Navigator indicates that the time stamps are correct by setting the AM_RATE_CorrectTS property on the decoder with the value TRUE. When this property is set, the decoder should use the actual time stamps, instead of estimating the presentation times.
|AM_RATE_MaxFullDataRate||The DVD Navigator uses this property to query the decoder for the maximum rate at which the decoder can process the data. The data type for this property is AM_MaxFullDataRate, which is a
|AM_RATE_QueryFullFrameRate||This property queries the decoder for the maximum full-frame rate that the decoder supports. The data type for this property is an AM_QueryRate structure. If the playback rate exceeds the decoder's maximum rate, the source filter sends groups of continuous samples separated by discontinuities. The time stamps jump across the discontinuities. The source filter might do this even if the playback rate is within the decoder's maximum rate, because there may be other factors, such as disk IO, that limit the full playback rate.|
|AM_RATE_QueryLastRateSegPTS||The source filter can use this property to synchronize rate changes across several audio and video streams. Queries the decoder for the effective PTS of the rate segment that was set most recently.This property queries the decoder for the start time of the rate change that was queued most recently.
This property is defined for version 1.1 of this property set; see AM_RATE_UseRateVersion.
|AM_RATE_SimpleRateChange||This property is used to send rate changes to the decoder. The data type for this property is an AM_SimpleRateChange structure, which gives the new playback rate and the presentation time when the new rate takes effect.|
|AM_RATE_Step||Obsolete. See Frame Stepping Property Set.|
|AM_RATE_UseRateVersion||This property is used to signal which version of the Rate Change property set the decoder should use. The value is a WORD type. The high-order byte contains the minor version number, and the low-order byte contains the low-order byte. Thus, version 1.1 is signaled with the value 0x0101.
If the decoder does not support the specified version, it should fail the call to IKsPropertySet::Set. If the source filter does not set the version, the decoder should default to version 1.0.
Rate is the inverse of playback speed; if playback speed is 2x, the rate is 0.5. The decoder scales the presentation times on the decoded samples to match the rate. For example, if the rate is 0.5, the presentation times increase at half the normal rate, which translates to a faster playback speed, because samples are rendered earlier than normal.
Samples are sent to the decoder with a time stamp equal to the presentation time at 1x rate. The decoder must scale the time stamps on the output samples to the correct presentation time for the current rate. Generally, only I frames have time stamps. The decoder must interpolate the time stamps for the B and P frames. Note that during reverse playback, time stamps continue to increase time stamps never go backward.
Two versions of the Rate Change property set are defined, version 1.0 and version 1.1. The default behavior is given by version 1.0. Decoder vendors are encouraged to support version 1.1, because it provides a smoother playback experience.
Rate Change Version 1.0
Version 1.0 of the Rate Change property set defines the default behavior for MPEG-2 decoders. The DVD Navigator currently uses this version.
The source filter signals a rate change by setting the AM_RATE_SimpleRateChange property. The data for this property is the new rate, plus the start time on the input sample where the rate takes effect. The decoder maintains a queue of pending rate changes, sorted by start time.
Before the DVD Navigator changes to a non-1x speed, it delivers all pending samples, temporarily sets the rate to 1.0, and flushes the graph. Then it sets the new rate. All rate changes are scheduled for the end of the current VOBU (video object unit). Note that flushing the graph resets the presentation time to zero.
The DVD Navigator operates either in smooth mode or in scan mode. In smooth mode, it sends every frame to the decoder, including B frames and P frames. The DVD Navigator uses smooth mode whenever playback speed is greater than zero but less than the decoder's maxmimum data rate. If playback speed is less than zero (reverse playback), or exceeds the decoder's maximum data rate, the DVD Navigator uses scan mode, where it sends just the I frames to the decoder. At very high speeds, it may skip some I frames; for example, it may send every other I frame.
By default, the DVD Navigator mutes the audio stream for rates other than 1.0. You can change this by calling IDvdControl2::SetOption with the DVD_AudioDuringFFwdRew flag.
Rate Change Version 1.1
Version 1.1 of the Rate Change property set follows the same basic principles as version 1.0, with the following differences:
More details are given in the reference pages for the individual properties.
Calculating Rate Segments
In the following diagram, the output time stamp (y) is given by formula
y = r(x - xi)
where x is the input time stamp, r is the rate, and xi is the x-intercept for the current rate. This formula is obtained by solving for the equation y = mx + b at the point xi, where m is the slope (r) and b is the y-intercept. This gives b = -m(xi), which can then be substituted back into the equation y = mx + b.
The decoder can calculate the x-intercept as follows. Given:
r1 = previous rate
r2 = current rate
xi1 = x-intercept for the previous rate change
xi2 = x-intercept for the current rate change
x = start time for the current rate change
The unknown xi2 can be found by setting y = r2(x - xi2) = r1(x - xi1)
xi2 = (r1 / r2)(xi - x) + x
In the special case where playback is 1x at time 0, r1 = 1 and xi1 = 0.