Click here to Skip to main content
15,035,283 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What function of input pin is called, when I disconnect pin?

MSDN:
CBasePin::BreakConnect
Remarks
This member function is called when a connection to the pin cannot be made or when CBasePin::Disconnect is called. In this case, it is necessary to undo anything performed during the connection process. You can override this member function to release any references to interfaces that were made during the connection.

But this function is not called. This means, that
CBasePin::Disconnect is not called.

I disconnect pin in Graph edit. I want to delete pin after disconnecting. When i connect pin, i add new pin, to connect additional stream. I saw this in 3dtv.at Stereo Transformation filter. I use function CBasePin::BreakConnect. But, when i disconnect, connect and disconnect pin again, i get exception. The same situation is with mensioned filter. Does it mean, that problem is now in Graph edit? Earlies mensioned filter worked fine.

Here is the code:
HRESULT CTransformerVideoInputPin::BreakConnect(void){
    HRESULT hr = CBaseInputPin::BreakConnect();
    if (this->IsConnected())
    {
        m_pVideoTransformerFilter->InputCloseConnection(this);
    }
	m_pVideoTransformerFilter->InputDelete(this);
    return hr;
}

HRESULT CVideoTransformerFilter::InputDelete( CTransformerVideoInputPin* lpIpin )
{
    for(std::vector<CTransformerVideoInputPin*>::iterator local_iterator=m_Arrinputpin.begin();local_iterator!=m_Arrinputpin.end();local_iterator++)
    {
        if (*local_iterator==lpIpin)
        {
            m_Arrinputpin.erase(local_iterator);
//          delete lpIpin;
            break;
        }
    }
    return S_OK;
}


How can i delete lpIpin?
Everything works, but deleting pin object.
Posted
Updated 27-Dec-10 21:18pm
v3

I hope this[^] thread helps.
   
Comments
[no name] 28-Dec-10 4:05am
   
Thank you for link. I hope it will help in future.
I have created additional list of deleted pins, to delete them after filter terminated.

C++
HRESULT CVideoTransformerFilter::InputDelete( CTransformerVideoInputPin* lpIpin )
{
    for(std::vector<CTransformerVideoInputPin*>::iterator local_iterator=m_Arrinputpin.begin();local_iterator!=m_Arrinputpin.end();local_iterator++)
    {
        if (*local_iterator==lpIpin)
        {
            m_ArrinputpinDeleted.push_back(*local_iterator);
            m_Arrinputpin.erase(local_iterator);
            break;
        }
    }
    return S_OK;
}
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900