Microsoft DirectX 9.0 |
The Reconnect method performs a dynamic reconnection between two pins.
Syntax
HRESULT Reconnect(
IPin *pOutputPin,
IPin *pInputPin,
const AM_MEDIA_TYPE *pmtFirstConnection,
IBaseFilter *pUsingFilter,
HANDLE hAbortEvent,
DWORD dwFlags
);
Parameters
pOutputPin
[in] Pointer to an output pin. Can be NULL, in which case pInputPin must not be NULL.
pInputPin
[in] Pointer to an input pin. Can be NULL, in which case pOutputPin must not be NULL.
pmtFirstConnection
[in] Pointer to an AM_MEDIA_TYPE structure that specifies the media type for the first pin connection made during the reconnection. If this parameter is NULL, the first connection can have any media type.
pUsingFilter
[in] Pointer to an optional filter to use in the reconnection. The filter must already be in the graph. Can be NULL.
hAbortEvent
[in] Handle to an event. If the caller is a filter calling on one of its data processing threads, this parameter should be a handle to an event that will be signaled when the filter is put into a stopped state. Otherwise, this parameter can be NULL. For more information, see Remarks.
dwFlags
[in] Combination of flags from the AM_GRAPH_CONFIG_RECONNECT_FLAGS enumeration, specifying how to perform the reconnection.
Return Value
Returns S_OK if successful. Otherwise, returns an error code that may be one of the following values, or others not listed.
E_INVALIDARG | Invalid argument. (For example, both pInputPin and pOutputPin are NULL.) |
E_NOINTERFACE | Input pin does not support IPinConnection. |
VFW_E_CANNOT_CONNECT | Unable to connect filter. |
VFW_E_STATE_CHANGED | The state of the filter changed. Unable to complete the operation. |
Remarks
If you specify only one pin, the method will search for the other pin. By default, however, the search fails if it reaches a filter that was added to the graph by means of the IFilterGraph::AddFilter method. To override this behavior, call IGraphConfig::SetFilterFlags and set the AM_FILTER_FLAGS_REMOVABLE flag on the filter.
The reconnection process involves several steps, most of them handled inside this method:
If a filter calls this method on one of its own data processing threads, it creates the potential for a deadlock. The method obtains a lock on the filter graph, which can block the filter from stopping on receiving a call to IMediaFilter::Stop. To prevent this situation, the method takes a handle to an event object provided by filter. The filter should signal the event if it receives a call to its Stop method.
See Also