共用方式為


IMFPMediaItem::GetStartStopPosition method (mfplay.h)

[The feature associated with this page, MFPlay, is a legacy feature. It has been superseded by MediaPlayer and IMFMediaEngine. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer and IMFMediaEngine instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

Gets the start and stop times for the media item.

Syntax

HRESULT GetStartStopPosition(
  [out] GUID        *pguidStartPositionType,
  [out] PROPVARIANT *pvStartValue,
  [out] GUID        *pguidStopPositionType,
  [out] PROPVARIANT *pvStopValue
);

Parameters

[out] pguidStartPositionType

Receives the unit of time for the start position. See Remarks. This parameter can be NULL.

[out] pvStartValue

Receives the start position. The meaning and data type of this parameter are indicated by the pguidStartPositionType parameter. The pvStartValue parameter must be NULL if pguidStartPositionType is NULL, and cannot be NULL otherwise.

[out] pguidStopPositionType

Receives the unit of time for the stop position. See Remarks. This parameter can be NULL.

[out] pvStopValue

Stop position. The meaning and data type of this parameter are indicated by the pguidStopPositionType parameter. The pvStopValue parameter must be NULL if pguidStopPositionType is NULL, and cannot be NULL otherwise.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The pguidStartPositionType and pguidStopPositionType parameters receive the units of time that are used. Currently, the only supported value is MFP_POSITIONTYPE_100NS.

Value Description
MFP_POSITIONTYPE_100NS 100-nanosecond units. The time parameter (pvStartValue or pvStopValue) uses the following data type:
  • Variant type (vt): VT_I8
  • Variant member: hVal

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header mfplay.h

See also

How to Play a File Clip

IMFPMediaItem

Using MFPlay for Audio/Video Playback