MFCreateSequencerSegmentOffset function (mfidl.h)

Creates a PROPVARIANT that can be used to seek within a sequencer source presentation.

Syntax

HRESULT MFCreateSequencerSegmentOffset(
  [in]  MFSequencerElementId dwId,
  [in]  MFTIME               hnsOffset,
  [out] PROPVARIANT          *pvarSegmentOffset
);

Parameters

[in] dwId

Sequencer element identifier. This value specifies the segment in which to begin playback. The element identifier is returned in the IMFSequencerSource::AppendTopology method.

[in] hnsOffset

Starting position within the segment, in 100-nanosecond units.

[out] pvarSegmentOffset

Pointer to a PROPVARIANT. The method fills in the PROPVARIANT with the information needed for performing a seek operation. The caller must free the PROPVARIANT by calling PropVariantClear.

Return value

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

Remarks

The PROPVARIANT returned in pvarSegmentOffset can be used for the pvarStartPosition parameter in the IMFMediaSession::Start method. Use the time format GUID MF_TIME_FORMAT_SEGMENT_OFFSET.

Examples

// Skips to the specified segment in the sequencer source

HRESULT CPlaylist::SkipTo(DWORD index)
{
    if (index >= m_count)
    {
        return E_INVALIDARG;
    }

    MFSequencerElementId ID = m_segments[index].SegmentID;

    PROPVARIANT var;

    HRESULT hr = MFCreateSequencerSegmentOffset(ID, NULL, &var);
    
    if (SUCCEEDED(hr))
    {
        hr = m_pSession->Start(&MF_TIME_FORMAT_SEGMENT_OFFSET, &var);
        PropVariantClear(&var);
    }
    return hr;
}

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header mfidl.h
Library Mf.lib
DLL Mf.dll

See also

MFTIME

Media Foundation Functions

Sequencer Source

Using the Sequencer Source