Oh yes, I will post the updated sources without the binaries.
Regarding the other question:
In the above shots I had some debug code enabled but there is another reason.
If you also need to capture the frame content for additional software postprocessing, like i did for the AR application, you can't simply insert a samplegrabber in the dshow chain.
I've tried this and reading the samples is very slow (It seems they are allocated in video memory).
The solution is to insert an infinite tee filter and split the video signal before going to VMR9. One stream goes directly to VMR9 and gets accelerated. The other stream goes to the sample grabber and delivers frames to the application that can process them. this stream use additional threads.
So, if you need software capture, on single core machine is probably better using the "classic" approach of grabbing frames and dumping them into a dynamic texture.
If you only need to display the texture instead, VMR9 is faster than dynamic texture.
In an updated version of my code I've added the ability to enable/disable VMR9 on a per material basis.
Code: Select all
texture_source dsvmr9_video
{
//filename try.avi
camera_number 0 //Defines which webcam to use.
use_vmr9 true
use_yuvmixing true
capture false
}
I can also enable/disable YUV mixing (that enables the hardware acceleration).
'capture' parameter specifies if software capture is needed for this material, to avoid the stream branching I was talking above.
If I disable Capturing I easily go over 100-150 fps using VMR9.
There is also a third problem I've come across.
The ExternalTextureSource::createAdvancedTexture gets called for every parsed material script...so the first version of my code inited all my collection of "avi" materials. Not very optimal
I did something along the lines of:
Code: Select all
bool OgreDSVMR9Controller::frameStarted(const Ogre::FrameEvent &e)
{
mtCamTexs::iterator i;
for(i = mOgreDSVMR9TextureList.begin(); i != mOgreDSVMR9TextureList.end(); ++i)
{
(*i)->UpdateTexture();
}
return true;
}
bool OgreDSVMR9Texture::UpdateTexture()
{
if(mMaterial->getLoadingState()==Resource::LOADSTATE_LOADED &&
!mbAlreadyLoaded)
{
//let's load
if(!mbAlreadyFailed)
{
if(!load())
mbAlreadyFailed = true;
else
mbAlreadyLoaded = true;
}
}
if(mOgreDSVMR9)
return mOgreDSVMR9->Update();
return false;
}
Is there a way of getting notified when the associated material gets "loaded"?
thanks