IMediaSeeking::SetPositions

This method sets current and stop positions and applies flags to both.

HRESULT SetPositions(
  LONGLONG* pCurrent,
  DWORD dwCurrentFlags,
  LONGLONG* pStop,
  DWORD dwStopFlags
);

Parameters

  • pCurrent
    [in, out] Start position if stopped, or position from which to continue if paused.
  • dwCurrentFlags
    [in] When seeking, one of these flags must be set to indicate the type of seek. The flags passed to this method should include one positioning value and (optionally) any of the nonpositioning values.
    Value Description
    AM_SEEKING_NoPositioning No change in positioning.
    AM_SEEKING_AbsolutePositioning Position supplied is absolute.
    AM_SEEKING_RelativePositioning Position supplied is relative to the current position.
    AM_SEEKING_IncrementalPositioning Stop position relative to current; useful for seeking when paused (only valid in conjunction with stop times).
    AM_SEEKING_PositioningBitsMask Mask flag; determine if seeking is required by performing a bitwise AND of the four flags listed above and this mask. If the resulting value is nonzero, some form of seeking is required. Check the value of the last two bits to determine which of the above flags are set.
    AM_SEEKING_SeekToKeyFrame Seek to the nearest key frame (not as accurate but quicker).
    AM_SEEKING_ReturnTime Return the media time equivalents for pCurrent and pStop (overwriting these values with the returned values).
    AM_SEEKING_Segment At the end of the segment call EC_ENDOFSEGMENT instead of EndOfStream.
    AM_SEEKING_NoFlush Do not flush.
  • pStop
    [in, out] Position in the stream at which to quit.
  • dwStopFlags
    [in] Stop position seeking options to be applied. These are the same as listed for dwCurrentFlags.

Return Values

Returns an HRESULT value that depends on the implementation of the interface. The default DirectShow implementation returns E_POINTER if the pointer argument is NULL, NOERROR for success, E_INVALIDARG if a parameter is out of range, or another COM return code otherwise.

Remarks

The following code fragment checks for the type of seeking required.

switch ( dwFlags & AM_SEEKING_PositioningBitsMask )
{
case AM_SEEKING_IncrementalPositioning:
// Check this is on a stop time
// Get Current, add this delta, apply result as new stop time
break;
case AM_SEEKING_RelativePositioning:
// ...
break;
case AM_SEEKING_AbsolutePositioning:
// ...
break;
case AM_SEEKING_NoPositioning:
// Nothing to do.
break;
}

Requirements

DirectShow applications and DirectShow filters have different include file and link library requirements. See Setting Up the Build Environment for more information.

OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.

See Also

IMediaSeeking Interface

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.