Compartilhar via


CBaseRenderer::GetSampleTimes

 
Microsoft DirectShow 9.0

CBaseRenderer::GetSampleTimes

The GetSampleTimes method retrieves the time stamps from a sample.

Syntax

  virtual HRESULT GetSampleTimes(
    IMediaSample *pMediaSample,
    REFERENCE_TIME *pStartTime,
    REFERENCE_TIME *pEndTime
);

Parameters

pMediaSample

Pointer to the sample's IMediaSample interface.

pStartTime

Pointer to a variable that receives the start time.

pEndTime

Pointer to a variable that receives the end time.

Return Value

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

Value Description
S_OK The sample should be rendered immediately.
S_FALSE The sample should be scheduled for rendering, based on the time stamps.
E_FAIL Do not render this sample.
VFW_E_START_TIME_AFTER_END Bad time stamp: The end time is earlier than the start time.

Remarks

The filter calls this method to determine how it should handle a sample. If the return value is S_OK, the filter renders the sample immediately. If the return value is S_FALSE, the filter schedules the sample for rendering, based on the time stamps. If the return value is an error code, the filter rejects the sample.

This method returns S_OK if the sample has no time stamps, or if the filter does not have a reference clock. Otherwise, it returns the value of the CBaseRenderer::ShouldDrawSampleNow method. In the base class, ShouldDrawSampleNow always returns S_FALSE. The derived class can override this behavior. For example, if the derived class implements quality control management, it might return E_FAIL to drop a sample.

Requirements

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

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

See Also