Microsoft DirectX 8.0

CRendererPosPassThru Class

CRendererPosPassThru class hierarchy

Handles seek commands for renderer filters.

Declaration: Ctlutil.h

This class derives from the CPosPassThru class. It adds support for caching the time stamps from samples as they arrive.

Use this class in the same way as the CPosPassThru class. (Refer to the CPosPassThru documentation for details.) In addition, however, the renderer filter must update the object's cached time stamps:

For an example of how to use this class, refer to the CBaseRenderer source code.

Public Methods
CRendererPosPassThruConstructor method.
GetMediaTimeRetrieves the time stamps on the current sample.
RegisterMediaTimeCaches the time stamps from the current sample.
ResetMediaTimeResets the cached time stamps to zero.
EOSUpdates the cached time stamps after an end-of-stream notification.

CRendererPosPassThru::CRendererPosPassThru

CRendererPosPassThru Class

Constructor method.

Syntax

CRendererPosPassThru(
    const TCHAR *pName,
    LPUNKNOWN pUnk,
    HRESULT *phr,
    IPin *pPin
);

Parameters

pName
Pointer to the name of the object, for debugging purposes. Allocate this parameter in static memory.
pUnk
Pointer to the owner of this object. If the object is aggregated, pass a pointer to the aggregating object's IUnknown interface. Otherwise, set this parameter to NULL.
phr
Pointer to an HRESULT value. Ignored.
pPin
Pointer to the IPin interface of the filter's input pin.

CRendererPosPassThru::EOS

CRendererPosPassThru Class

Updates the cached time stamps after an end-of-stream notification.

Syntax

HRESULT EOS(void);

Return Value

Returns an HRESULT value. Possible values include those listed in the following table.

S_OKSuccess.
E_FAILFailure. Possibly the filter is not streaming.

Remarks

The filter should call this method when it receives an end-of-stream notification (IPin::EndOfStream). The method sets both cached time stamps equal to the stop position, ensuring that the IMediaStream::GetCurrentPosition method returns the correct values at the end of the stream.

CRendererPosPassThru::GetMediaTime

CRendererPosPassThru Class

Retrieves the time stamps on the current sample.

Syntax

HRESULT GetMediaTime(
    LONGLONG *pStartTime,
    LONGLONG *pEndTime
);

Parameters

pStartTime
Pointer to a variable that receives the start time, in units of the current time format.
pEndTime
Pointer to a variable that receives the end time, in units of the current time format. Can be NULL.

Return Value

Returns an HRESULT value. Possible values include those listed in the following table.

S_OKSuccess.
E_INVALIDARGConversion to this format is not supported.
E_POINTERNULL pointer argument.

Remarks

This method overrides the CPosPassThru::GetMediaTime method. The time-stamp values are converted to the current time format by calling the CPosPassThru::ConvertTimeFormat method.

CRendererPosPassThru::RegisterMediaTime

CRendererPosPassThru Class

Caches the time stamps from the current sample.

Syntax

HRESULT RegisterMediaTime(
    IMediaSample *pMediaSample
);

HRESULT RegisterMediaTime(
    LONGLONG StartTime,
    LONGLONG EndTime
);

Parameters

pMediaSample
Pointer to the IMediaSample interface of the sample.
StartTime
Sample start time, in 100-nanosecond units.
EndTime
Sample end time, in 100-nanosecond units.

Return Value

Returns an HRESULT value. Possible values include those listed in the following table.

S_OKSuccess.
VFW_E_MEDIA_TIME_NOT_SETThe sample is not time-stamped.

Remarks

This method stores the time stamps from the current sample. The GetMediaTime method retrieves the same values.

The filter should call this method for each sample that it receives. The method is overloaded to accept either a pointer to the sample, or the time stamp values themselves.

CRendererPosPassThru::ResetMediaTime

CRendererPosPassThru Class

Resets the cached time stamps to zero.

Syntax

HRESULT ResetMediaTime(void);

Return Value

Returns S_OK.

Remarks

The filter should call this method whenever the time stamps cached by the RegisterMediaTime method become invalid. Specifically, it should call this method in response to the IPin::EndFlush and IMediaFilter::Stop methods.

After this method is called, the GetMediaTime method returns zero for the start and end times.