Microsoft DirectX 9.0 |
The SetPositions method sets the current position and the stop position.
Syntax
HRESULT SetPositions(
LONGLONG *pCurrent,
DWORD dwCurrentFlags,
LONGLONG *pStop,
DWORD dwStopFlags
);
Parameters
pCurrent
[in,out] Pointer to a variable that specifies the current position, in units of the current time format.
dwCurrentFlags
[in] Bitwise combination of flags. See Remarks.
pStop
[in,out] Pointer to a variable that specifies the stop time, in units of the current time format.
dwStopFlags
[in] Bitwise combination of flags. See Remarks.
Return Value
Returns an HRESULT value. Possible values include the following.
Value | Description |
S_FALSE | No position change. (Both flags specify no seeking.) |
S_OK | Success. |
E_INVALIDARG | Invalid argument. |
E_NOTIMPL | Method is not supported. |
E_POINTER | NULL pointer argument. |
Remarks
The dwCurrentFlags and dwStopFlags parameters define the type of seek. The following flags are defined:
Positioning Flags | Description |
AM_SEEKING_NoPositioning | No change in position. (The time parameter can be NULL.) |
AM_SEEKING_AbsolutePositioning | The specified position is absolute. |
AM_SEEKING_RelativePositioning | The specified position is relative to the previous value. |
AM_SEEKING_IncrementalPositioning | The stop position (pStop) is relative to the current position (pCurrent). |
Modifier Flags | Description |
AM_SEEKING_SeekToKeyFrame | Seek to the nearest key frame. This might be faster, but less accurate. |
AM_SEEKING_ReturnTime | Return the equivalent reference times. |
AM_SEEKING_Segment | Use segment seeking. |
AM_SEEKING_NoFlush | Do not flush. |
For each parameter, use one positioning flag. Optionally, include one or more modifier flags.
If the AM_SEEKING_ReturnTime flag is specified, the method converts the position value to a reference time and returns it in the pCurrent or pStop variable. This flag is useful if you are using another time format, such as frames.
The AM_SEEKING_Segment and AM_SEEKING_NoFlush flags support seamless looping:
To perform looping, the graph must report AM_SEEKING_CanDoSegments in the IMediaSeeking::GetCapabilities method. Currently, only the WAVE Parser Filter supports this feature.
The incoming values of pCurrent and pStop are expressed in the current time format. The default time format is REFERENCE_TIME units (100 nanoseconds). To change time formats, use the IMediaSeeking::SetTimeFormat method. If the AM_SEEKING_ReturnTime flag is present, the method converts the outgoing value to REFERENCE_TIME units.
Filter Developers
If you implement this method, you can check whether the caller is requesting a change in the current or stop position, by using the value AM_SEEKING_PositioningBitsMask to mask out the modifier flags. For example:
DWORD dwCurrentPos = dwCurrentFlags & AM_SEEKING_PositioningBitsMask
if (dwCurrentPos == AM_SEEKING_AbsolutePositioning)
{
// Set new position to pCurrent.
m_rtStart = *pCurrent;
}
else if (dwCurrentPos == AM_SEEKING_RelativePositioning)
{
// Increment current position by pCurrent.
m_rtStart += *pCurrent;
}
For more information, see the source code for the CSourceSeeking::SetPositions method in the base class library.
See Also