Microsoft DirectX 9.0

IGrabberSample::SetCallback

The implementation of this method is provided as sample code with the DirectShow SDK. It is not a supported DirectShow API.

The SetCallback method specifies a callback method that the Grabber filter will call whenever it receives a media sample.

Syntax

HRESULT SetCallback(
    SAMPLECALLBACK Callback
);

Parameters

Callback

Pointer to the callback function. Specify NULL to cancel the callback. See Remarks for details.

Return Value

Returns S_OK.

Remarks

The callback function must have the following signature:

typedef HRESULT (*SAMPLECALLBACK) (
    IMediaSample *pSample, 
    REFERENCE_TIME *StartTime, 
    REFERENCE_TIME *StopTime,
    BOOL TypeChanged 
);

The pSample parameter is a pointer to the media sample's IMediaSample interface. The StartTime and StopTime parameters are pointers to the sample start and stop times. The TypeChanged parameter equals TRUE if the connect type has changed since the last sample. However, the Grabber filter does not check for dynamic format changes on the media sample. The application should do this inside the callback function. For more information, see QueryAccept (Downstream).

See Also