IMFSample::SetSampleDuration Method

Sets the duration of the sample.

Syntax

public:
HRESULT SetSampleDuration(
         LONGLONG hnsSampleDuration
)  

Parameters

hnsSampleDuration
Type: LONGLONG 

Duration of the sample, in 100-nanosecond units.

Return value

Type: HRESULT 

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

Refer to Media Foundation return codes.

Remarks

This method succeeds if the duration is negative, although negative durations are probably not valid for most types of data. It is the responsibility of the object that consumes the sample to validate the duration.

The duration can also be zero. This might be valid for some types of data. For example, the sample might contain stream metadata with no buffers.

Until this method is called, the IMFSample::GetSampleDuration method returns MF_E_NO_SAMPLE_DURATION.

Requirements

Header: Declared in mfobjects.h (include mfidl.h).

Library: Use mfuuid.lib.