Microsoft DirectX 8.0 |
Obtains and releases access to a CDynamicOutputPin object.
Declaration: Amfilter.h
When certain methods are called on CDynamicOutputPin, the caller must obtain access to the pin and then release that access. To obtain access, the caller uses the CDynamicOutputPin::StartUsingOutputPin method. To release access, it calls the CDynamicOutputPin::StopUsingOutputPin method. The CAutoUsingOutputPin class is a helper class that handles these tasks in its constructor and destructor methods. The following code example shows how to use this class:
CDynamicOutputPin *pPin; HRESULT hr = S_OK; // Important! Initialize to S_OK. // Obtain a pointer to the pin (not shown). { CAutoUsingOutputPin UsingPin(pPin, &hr) if (SUCCEEDED(hr)) { // Safe to use the pin. pPin->Deliver(pSample); } } // Object goes out of scope here. // No longer safe to use the pin.
Public Methods | |
---|---|
CAutoUsingOutputPin | Constructor method. Obtains access to the specified pin. |
~CAutoUsingOutputPin | Destructor method. Releases access to the pin. |
Constructor method. Obtains access to the specified pin.
Syntax
CAutoUsingOutputPin( CDynamicOutputPin *pOutputPin, HRESULT *phr );
Parameters
- pOutputPin
- Pointer to a CDynamicOutputPin object.
- phr
- Pointer to a variable that contains an HRESULT value. The value must be S_OK.
Remarks
When the method returns, the value of *phr indicates the success or failure of the method.
Destructor method. Releases access to the pin.
Syntax
~CAutoUsingOutputPin(void);