Sorry for the late reply. Ok, a little bit of codes now:
Parent class
Code:
/*
*
*/
class CaptureBufferManager {
public:
virtual ~CaptureBufferManager(){}
/*
*
*/
virtual CAPTURE_BUFFER_HANDLE getBuffer(
void** ppvBuffer,
unsigned* puPitch,
unsigned uFlags
) = 0;
/*
*
*/
virtual void returnBuffer(
CAPTURE_BUFFER_HANDLE captureBufferHandle
) = 0;
/*
*
*/
virtual IDirect3DTexture9* getTexture( bool zOnlyIfUpdated = false ) = 0;
/*
*
*/
virtual void returnTexture( IDirect3DTexture9* ) = 0;
};
The faulty code
Code:
bool DemoScreen::onAnimate() //Always called on every loop
{
...
if (AviStreamer::isComplete())
{
AviStreamer::endStreaming();
AviStreamer::uninitialize(); //Delete and uninitialize all, including the capture buffer manager
AviStreamer::initialize(&(*m_iterAviParams)); //Reinitialize all including the capture buffer manager
AviStreamer::startStreaming(
AviStreamer::getCaptureBufferManager() //This one is faulty because the __vfptr is 0xfeefee.While the getCaptureBufferManager() returned a normal pointer. So using "if (AviStreamer::getCaptureBufferManager() != NULL)" doesn't solve it because it never NULL.
);
}
...
}
More codes:
Code:
bool AviStreamer::initialize(AVI_STREAM_PARAMS* pParams)
{
if( !_initStreamGraph( pParams ) ) {
uninitStreamGraph( ) ;
return false;
}
if( !_initBuffers( pParams->m_pDevice ) ) {
uninitBuffers( );
return false;
}
if( !_initBufferManager( ) ) {
uninitBufferManager( ); //I first assume that it will go inside this block when the __vfptr = 0xfeefee. But I was wrong and it didn't go here.
return false;
}
}
/*
*
*/
BOOL AviStreamer::_initBufferManager( ) {
m_pCaptureBufferManager = new XCaptureBufferManager(
m_pTextures[0],
m_pTextures[1],
m_pTextures[2]
); // CaptureBufferManager* pCaptureBufferManager. And XCaptureBufferManager = the child of CaptureBufferManager.
if( !m_pCaptureBufferManager ) {
m_pCaptureBufferManager = NULL ;
delete m_pCaptureBufferManager;
return false;
}
return true;
}
Ok this is the code. I hope you guys can help me with this because I'm lost right now.
Thanks a lot in advance.