Partager via


IMediaParams::SetTimeFormat

The SetTimeFormat method specifies the time format for the object.

Syntax

HRESULT SetTimeFormat(
    GUID guidTimeFormat,
    MP_TIMEDATA mpTimeData
);

Parameters

guidTimeFormat

[in] Time format GUID that specifies the time format.

mpTimeData

[in] Value of type MP_TIMEDATA that specifies the unit of measure for the new format.

Return Values

Returns an HRESULT value. Possible values include the following.

Return Code Description
E_DMOTIMESTAMPFORMAT Object does not support this time format.
S_OK Success.

Remarks

Objects can support more than one time format. Every object must support reference time, in which each unit of time is 100 nanoseconds (ns). Other formats are optional. The application must ensure that time stamps on the input buffers match whatever time format was set using this method.

The meaning of the mpTimeData parameter depends on the value of the guidTimeFormat parameter.

Time Format Meaning of Time Data
GUID_TIME_MUSIC Parts per quarter note.
GUID_TIME_REFERENCE Ignored.
GUID_TIME_SAMPLES Samples per second.

When you call this method, also call the FlushEnvelope method, to flush any envelopes that were set using the previous time format.

To determine what time formats an object supports, call the IMediaParamInfo::GetSupportedTimeFormat method. To retrieve the current format, call the IMediaParamInfo::GetCurrentTimeFormat method.

Requirements

  Header: Medparam.h
  Library: Dmoguids.lib.

See Also

© 2004 Microsoft Corporation. All rights reserved.