Deferred commands are queued by calls to methods on the IQueueCommand interface and are exposed by the filter graph manager and by some filters. A successful call to one of these methods returns an IDeferredCommand interface representing the queued command.
A CDeferredCommand object represents a single deferred command and exposes the IDeferredCommand interface as well as other methods that permit time checks and actual execution. A CDeferredCommand object contains a reference to the CCmdQueue object on which it is queued.
Reference counts control the lifetime of the CDeferredCommand class. When calling the CDeferredCommand::Invoke member function, the calling application gets an interface pointer that is reference-counted, and the CCmdQueue object also holds a reference count on the deferred command. Calling the IDeferredCommand::Cancel member function takes the deferred command off the command queue and thus reduces the reference count by one. Once taken off the queue, the command cannot be put back on the queue.
Protected Data Members
| Name | Description |
| m_bStream | Flag for stream time or presentation time. to be passed to the invoked method. |
| m_Dispatch | Accesses the ITypeInfo interface. |
| m_dispidMethod | Method on the interface to run. |
| m_DispParams | CDispParams object containing the DISPPARAMS parameter list |
| m_hrResult | Stores the returned HRESULT value. |
| m_iid | Globally unique identifier (GUID) of the interface. |
| m_pQueue | Pointer to the CCmdQueue object that exposes the IQueueCommand interface. |
| m_pUnk | IUnknown pointer to the interface on which the command will be run. |
| m_pvarResult | Resulting information, if any, from the invoked method. |
| m_time | Time at which the command will be run. |
| m_wFlags | Flags specifying the context of the invocation. |
Member Functions
| Name | Description |
| CDeferredCommand | Constructs a CDeferredCommand object. |
| GetFlags | Returns the context flags associated with the deferred command. |
| GetIID | Returns the interface identifier (IID) of the interface on which the method will be run. |
| GetMethod | Returns the dispatch identifier of the method to be run. |
| GetParams | Returns the DISPPARAMS argument list to the method. |
| GetResult | Returns the resulting argument list, if one exists. |
| GetTime | Returns the time when the method will be run. |
| Invoke | Provides access to methods and properties exposed by an object. |
| IsStreamTime | Specifies whether the command is to be run at stream time or presentation time. |
Implemented IDeferredCommand Methods
| Name | Description |
| Cancel | Cancels a previously queued CDeferredCommand::Invoke request. |
| Confidence | Not currently implemented. |
| Postpone | Specifies a new presentation time for a previously queued command. |
| GetHResult | Returns the HRESULT value of the invoked method. |
Implemented INonDelegatingUnknown Methods
| Name | Description |
| NonDelegatingQueryInterface | Returns a specified reference-counted interface. |
Cancels a previously queued CDeferredCommand::Invoke request.
HRESULT Cancel( );
Returns VFW_E_ALREADY_CANCELLED if m_pQueue is NULL. Returns an HRESULT from CCmdQueue::Remove if the call generates an error. Returns S_OK if successful.
This member function implements the IDeferredCommand::Cancel method.
Constructs a CDeferredCommand object.
CDeferredCommand(
CCmdQueue * pQ,
LPUNKNOWN pUnk,
HRESULT * phr,
LPUNKNOWN pUnkExecutor,
REFTIME time,
GUID* iid,
long dispidMethod,
short wFlags,
long cArgs,
VARIANT* pDispParams,
VARIANT* pvarResult,
short* puArgErr,
BOOL bStream
);
No return value.
This method is not currently implemented.
HRESULT Confidence(
LONG *pConfidence
);
Returns E_NOTIMPL.
See IDeferredCommand::Confidence for information about implementing this method.
Returns the context flags associated with the deferred command.
short GetFlags( );
The value retrieved will be one of the following.
| Value | Description |
| DISPATCH_METHOD | Run the member as a method. If a property has the same name, both this and the DISPATCH_PROPERTYGET flag may be set. |
| DISPATCH_PROPERTYGET | The member is being retrieved as a property or data member. |
| DISPATCH_PROPERTYPUT | The member is being changed as a property or data member. |
| DISPATCH_PROPERTYPUTREF | The member is being changed via a reference assignment, rather than a value assignment. This flag is valid only when the property accepts a reference to an object. |
Returns the HRESULT value from the invoked command.
HRESULT GetHResult(
HRESULT* phrResult
);
Returns E_ABORT if m_pQueue is NULL. Otherwise, returns S_OK.
This member function implements the IDeferredCommand::GetHResult method.
Retrieves the interface identifier (IID) of the interface on which the method will be run.
REFIID GetIID( );
Retrieves the dispatch identifier of the method to be run.
long GetMethod( );
Retrieves the DISPPARAMS argument list to the method.
DISPPARAMS* GetParams( );
Retrieves the resulting argument list, if one exists.
VARIANT* GetResult( );
Returns the time at which the method will be run.
CRefTime GetTime( );
Returns a CRefTime object containing a reference time.
Provides access to methods and properties exposed by an object.
HRESULT Invoke( );
Returns VFW_E_ALREADY_CANCELLED if m_pQueue is NULL. Otherwise, returns the HRESULT resulting from a call to IDispatch::GetTypeInfo or IUnknown::QueryInterface.
Specifies whether the command is to be run at stream time or presentation time.
BOOL IsStreamTime( );
Returns TRUE if set to stream time; otherwise, returns FALSE.
Returns a specified reference-counted interface.
HRESULT NonDelegatingQueryInterface(
REFIID riid,
void **ppv
);
Returns E_POINTER if ppv is invalid. Returns NOERROR if the query is successful or E_NOINTERFACE if it is not.
Returns pointers to the IDeferredCommand and IUnknown interfaces by default. Override this method to publish any additional interfaces implemented by the derived class.
This member function implements the INonDelegatingUnknown::NonDelegatingQueryInterface method.
Specifies a new presentation time for a previously queued command.
HRESULT Postpone(
REFTIME newtime
);
Returns VFW_E_TIME_ALREADY_PASSED if newtime is already passed. Otherwise, returns an HRESULT resulting from a call to CCmdQueue::Remove (when extracting from the list) or CCmdQueue::Insert (when reinserting with the changed time).
This member function implements the IDeferredCommand::Postpone method.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.