Compartilhar via


IMediaSeeking::CheckCapabilities (Compact 2013)

3/26/2014

This method determines which capabilities exist on a media stream by testing a set of seeking capability flags and checking the returned value.

Syntax

HRESULT CheckCapabilities(
  DWORD* pCapabilities
);

Parameters

  • pCapabilities
    [in, out] Points to a bitwise combination of one or more AM_SEEKING_SEEKING_CAPABILITIES attributes. When the method returns, the value indicates which of those attributes are available.

Return Values

Returns an HRESULT value. Possible values include the following.

Return code

Description

S_FALSE

Not all the capabilities in pCapabilities are present.

S_OK

All capabilities in pCapabilities are present.

E_FAIL

No capabilities in pCapabilities are present.

E_POINTER

NULL pointer argument.

Remarks

This method determines which seeking capabilities are present on a media stream. It tests the pCapabilities flags, and returns a value that indicates whether they match the capabilities of the media stream.

The value of pCapabilities can be accumulated between successive calls to this method so that the value of pCapabilities can be checked when an S_FALSE value is returned to find the capability that does not match.

Example

The following code example shows how to find whether the stream supports forward seeking, backward seeking, and absolute seeking.

Declare a DWORD value equal to the bitwise-OR combination of the AM_SEEKING_SEEKING_CAPABILITIES attributes that you want to test. Pass a pointer to this value in the pCapabilities parameter. When the method returns, pCapabilities contains a subset of the original bits. This indicates which capabilities are present. The return value indicates whether all, some, or none of the requested capabilities are present.

// Set flags for the capabilities that you want to check.
DWORD dwCaps = AM_SEEKING_CanSeekAbsolute | 
               AM_SEEKING_CanSeekForwards |
               AM_SEEKING_CanSeekBackwards;

HRESULT hr = pMediaSeeking->CheckCapabilities(&dwCaps);
if(FAILED(hr)) 
{
    // The stream cannot seek.
}
else if (hr == S_OK) 
{   
    // The stream can seek forward, backward, and to an absolute position.
}
else if (hr == S_FALSE) // The stream might have some of the capabilities.
{
    if (dwCaps & AM_SEEKING_CanSeekAbsolute)
        // The stream can seek to an absolute position.
    if (dwCaps & AM_SEEKING_CanSeekAbsolute)
        // The stream can seek forward.
    if (dwCaps & AM_SEEKING_CanSeekBackwards)
        // The stream can seek backward.
}

Requirements

Header

dshow.h

Library

Strmiids.lib

See Also

Reference

IMediaSeeking