Windows Media Format SDK banner art
PreviousNext

IWMDMDeviceControl::Seek

The Seek method seeks to a position that will be used as a starting position for either play or record operations.

Syntax

HRESULT Seek(
  UINT  fuMode,
  int  nOffset
);

Parameters

  fuMode

[in]  Mode for the seek operation being performed. The fuMode parameter must be one of the following modes.

Mode Description
WMDM_SEEK_BEGIN Seek to a position that is nOffset units after the beginning of the file.
WMDM_SEEK_CURRENT Seek to a position that is nOffset units from the current position.
WMDM_SEEK_END Seek to a position that is nOffset units before the end of the file.

  nOffset

[in]  Number of units of offset by which the seek operation moves the starting position away from the origin specified by fuMode. The units of nOffset are defined by the content. They can be milliseconds for music, pages for electronic books, and so on.

A positive value for nOffset indicates seeking forward through the file. A negative value indicates seeking backward through the file. Any combination of nOffset and fuMode that indicates seeking to a position before the beginning of the file or after the end of the file is invalid, and causes the method to return E_INVALIDARG.

Return Values

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Return code Description
E_INVALIDARG An invalid parameter was passed.
WMDM_E_NOTSUPPORTED The seek function is not implemented on this device.
E_FAIL An unspecified error occurred.

Remarks

The seek operation is defined by passing either an IWMDMStorage interface pointing to an entry address on some storage medium, or an IWMDMOperation interface implemented to support streaming audio. In addition, an IWMDMObjectInfo interface pointer can be passed to describe an entry address within the object to which the specified interface points.

For device playback, if Seek is not called before Play, then playback starts at the first audio track on the first storage medium on the media device.

For device recording, if Seek is not called before Record, the record operation fails. Once the Record method is called, subsequent calls to the IWMDMObjectInfo::GetPlayPosition method report the total play length at any time, and equal the value returned from IWMDMObjectInfo::GetTotalLength. The record length can be limited by calling the IWMDMObjectInfo::SetPlayLength method after returning from the Seek call.

See Also

PreviousNext


© 1999 Microsoft Corporation. All rights reserved.