Share via


IMemAllocatorCallbackTemp::SetNotify

 
Microsoft DirectShow 9.0

IMemAllocatorCallbackTemp::SetNotify

The SetNotify method sets or removes a callback on the allocator. The allocator calls the callback method whenever the allocator's IMemAllocator::ReleaseBuffer method is called.

Syntax

  HRESULT SetNotify(
    IMemAllocatorNotifyCallbackTemp *pNotify
);

Parameters

pNotify

Pointer to the IMemAllocatorNotifyCallbackTemp interface that will be used for the callback. The caller must implement the interface. Use the value NULL to remove the callback.

Return Values

Returns S_OK if successful, or an error code otherwise.

Remarks

Whenever the allocator's ReleaseBuffer method is called, the allocator calls the NotifyRelease method on the interface provided in pNotify. The ReleaseBuffer method returns a media sample to the allocator's free list. Samples call this method when their reference counts reach zero.

The allocator holds a reference count on the caller's IMemAllocatorNotifyCallbackTemp interface. This can create circular reference counts, thereby preventing objects in the graph from being released correctly. Therefore, when the caller no longer needs callback notifications, it should call this method again with the value NULL. An appropriate time to do this is when the graph stops, or else when the pins are disconnected.

Requirements

Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also