How to develop only one custom Pin for a CTransformFilter
How to override only one Pin of a CTransformFilter?
-------------------------------------------------------
1.I want to implement the allocator for the Transform input pin.
How can we do this ?...
I developed my own CTransformInputPin derived class as follows :
class CMyAllocator : public CMemAllocator
{
};
class CNewTransformInputPin :public CTransformInputPin
{
friend class CMyAllocator;
};
I initialized my "CNewTransformInputPin" as follows :
class CMyTransformFilter : CTransformFilter
{
public:
CMyTransformFilter()
{
m_pInput = new CNewTransformInputPin();
}
};
while running the Graph, the GraphEdit hangs and I closed the application.
Solution :
-------------------
I modified it as follows :
class CMyTransformFilter : CTransformFilter
{
public:
CBasePin* GetPin(int i)
{
if( m_pInput == NULL)
{
m_pInput = new CNewTransformInputPin();
}
if( m_pOutput == NULL)
{
m_pOutput = new CTransformOutputPin();
}
if( i== 0) { return m_pInput;}
else if (i == 1) { return m_pOutput;}
else return NULL;
}
};
Now we can override the single Pin in a transform filter by Overriding the CBasePin* GetPin() fn...
-------------------------------------------------------
1.I want to implement the allocator for the Transform input pin.
How can we do this ?...
I developed my own CTransformInputPin derived class as follows :
class CMyAllocator : public CMemAllocator
{
};
class CNewTransformInputPin :public CTransformInputPin
{
friend class CMyAllocator;
};
I initialized my "CNewTransformInputPin" as follows :
class CMyTransformFilter : CTransformFilter
{
public:
CMyTransformFilter()
{
m_pInput = new CNewTransformInputPin();
}
};
while running the Graph, the GraphEdit hangs and I closed the application.
Solution :
-------------------
I modified it as follows :
class CMyTransformFilter : CTransformFilter
{
public:
CBasePin* GetPin(int i)
{
if( m_pInput == NULL)
{
m_pInput = new CNewTransformInputPin();
}
if( m_pOutput == NULL)
{
m_pOutput = new CTransformOutputPin();
}
if( i== 0) { return m_pInput;}
else if (i == 1) { return m_pOutput;}
else return NULL;
}
};
Now we can override the single Pin in a transform filter by Overriding the CBasePin* GetPin() fn...
Labels: Directshow, Directshow problems
0 Comments:
Post a Comment
<< Home