IMFPMediaItem::GetDuration method
Gets the duration of the media item.
Syntax
HRESULT GetDuration(
[in] REFGUID guidPositionType,
[out] PROPVARIANT *pvDurationValue
);
Parameters
- guidPositionType [in]
-
Specifies the unit of time for the duration value. The following value is defined.
Value Meaning - MFP_POSITIONTYPE_100NS
100-nanosecond units.
The value returned in pvDurationValue is a LARGE_INTEGER.
- Variant type (vt): VT_I8
- Variant member: hVal
- pvDurationValue [out]
-
Pointer to a PROPVARIANT that receives the duration.
Return value
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
The method returns the total duration of the content, regardless of any values set through IMFPMediaItem::SetStartStopPosition.
Examples
#include <propvarutil.h>
HRESULT GetPlaybackDuration(IMFPMediaItem *pItem, ULONGLONG *phnsDuration)
{
PROPVARIANT var;
HRESULT hr = pItem->GetDuration(MFP_POSITIONTYPE_100NS, &var);
if (SUCCEEDED(hr))
{
hr = PropVariantToUInt64(var, phnsDuration);
PropVariantClear(&var);
}
return hr;
}
Requirements
|
Minimum supported client |
Windows 7 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2008 R2 [desktop apps only] |
|
Header |
|
See also