다음을 통해 공유


CPosPassThru Class

 
Microsoft DirectShow 9.0

CPosPassThru Class

CPosPassThru Base Class Hierarchy

The CPosPassThru class handles seek commands for transform filters, by passing them upstream to the next filter.

When an application seeks the filter graph, the Filter Graph Manager gives the seek command to the renderer filters. The command is passed upstream, through each filter's output pin, until it reaches a filter that can execute the command (if any). For details, see Seeking. The CPosPassThru class passes all seek commands to the output pin on the upstream filter, as shown in the following diagram.

The CPosPassThru class sends seek commands upstream.

Although this class is provided in the base class library, DirectShow also provides the same class in Quartz.dll. Using the Quartz.dll version can reduce the code size in your filter somewhat, because the class is loaded at run-time from the DLL. To use that version, call the CreatePosPassThru function.

In your output pin's NonDelegatingQueryInterface method, delegate to the CPosPassThru object whenever the requested interface is IMediaSeeking or IMediaPosition, as shown in the following code:

// The following member variables are assumed:
IPin *m_pInput;    // Pointer to the input pin on your filter.
IUnknown *m_pPos;  // Pointer to the CPosPassThru object.

STDMETHODIMP CMyPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
{
    HRESULT hr
    if (riid == IID_IMediaPosition || riid == IID_IMediaSeeking) 
    {
        if (m_pPos == NULL) 
        {
            // We have not created the CPosPassThru object yet. Do so now.
            hr = CreatePosPassThru(GetOwner(), FALSE, m_pInput, &m_pPos);
            if (FAILED(hr)) return hr;
        }
        return m_pPos->QueryInterface(riid, ppv);
    } 
    else
    {
         // Other interfaces (not shown).
    }
}

~CMyPin::CMyPin() 
{
    // Release the CPosPassThruObject.
    if (m_pPos != NULL) m_pPos->Release();
}

Except where noted, all IMediaPosition and IMediaSeeking methods in this class call the corresponding method on the connected pin and return the result.

Requirements

**  Header:** Declared in Ctlutil.h; include Streams.h.

**  Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

Public Methods  
CPosPassThru Constructor method.
ForceRefresh Obsolete.
GetMediaTime Retrieves the time stamps on the current sample. Virtual.
IMediaPosition Methods  
get_Duration Retrieves the duration of the stream.
put_CurrentPosition Sets the current position, relative to the total duration of the stream.
get_StopTime Retrieves the time at which the playback will stop, relative to the duration of the stream.
put_StopTime Sets the time at which the playback will stop, relative to the duration of the stream.
get_PrerollTime Retrieves the amount of data that will be queued before the start position.
put_PrerollTime Sets the amount of data that will be queued before the start position.
get_Rate Retrieves the playback rate.
put_Rate Sets the playback rate.
get_CurrentPosition Retrieves the current position, relative to the total duration of the stream.
CanSeekForward Determines whether the stream can be seeked backward.
CanSeekBackward Determines whether the stream can be seeked forward.
IMediaSeeking Methods  
CheckCapabilities Queries whether a stream has specified seeking capabilities.
ConvertTimeFormat Converts from one time format to another.
GetAvailable Retrieves the range of times in which seeking is efficient.
GetCapabilities Retrieves all the seeking capabilities of the stream.
GetCurrentPosition Retrieves the current position, relative to the total duration of the stream.
GetDuration Retrieves the duration of the stream.
GetPositions Retrieves the current position and the stop position, relative to the total duration of the stream.
GetPreroll Retrieves the amount of data that will be queued before the start position.
GetRate Retrieves the playback rate.
GetStopPosition Retrieves the time at which the playback will stop, relative to the duration of the stream.
GetTimeFormat Retrieves the current time format.
IsFormatSupported Determines whether a specified time format is supported.
IsUsingTimeFormat Determines whether a specified time format is the format currently in use.
QueryPreferredFormat Retrieves the preferred time format for the stream.
SetPositions Sets the current position and the stop position.
SetRate Sets the playback rate.
SetTimeFormat Sets the time format.
Helper Functions  
CreatePosPassThru Creates a CPosPassThru or CRendererPosPassThru object.