Some problems getting the plugin to work

Pokemonster

16-04-2010 15:13:25

Hey there,

I'm having a bit of trouble getting the Theora pluginto work using Ogre 1.7 under Windows.

First of all, I can't compile the trunk project (OgreVideoPlugin) because of missing dependencies such as TheoraDataSource.h,
TheoraVideoManager.h etc. . So I tried using the headers in one of the branches but TheoraDataSource is still missing and the Manager
doesn't seem to be up to date...

So my second try was to use the plugin in the branches/monolith directory which compiled fine but when used as a texture source,
I only get a black texture. The log file shows this :


16:05:28: Vorbis Headers: 0 Theora Headers : 3
16:05:28: Vorbis Headers: 0 Theora Headers : 3


It seems like the plugin finds the file but doesn't start playing. My material definition looks like this :


material VideoTest
{
technique
{
pass
{
texture_unit
{
texture_source ogg_video
{
//filename konqi.ogg
//filename test.ogg
filename Pentagon_News_Sample.ogg
precache 16
play_mode play
//output rgb
}
}
}
}
}


Am I missing something else ? Is this the "right" plugin to use ?

Kreso

18-04-2010 11:38:25

you need to download and compile the 'Theora Playback Library' which is a platform independent fork of this project monolith version.

go to libtheoraplayer.sf.net and download/compile the latest SVN version, and use that to compile ogrevideo plugin.

Pokemonster

19-04-2010 11:43:54

Thanks! I managed to build the latest plugin now. But I still have problems playing video files. I'm not sure if it's really a problem of the video plugin or
if it is me.

I'm running my own main loop which calls Ogre's Root::renderOneFrame() method with a fixed update of 60Hz ( i.e renderOneFrame(1000/60.0) ). I put some
debug output into the plugin dll and it looks like it's not catching up delivering the video frames. TheoraVideoClip::getNextFrame() returns null most of the time.

Skipping some frames, i.e. updating only on every 5th frame for example plays the video out just fine. So I'm wondering if I use the plugin correctly :-) ...

Kreso

19-04-2010 11:47:41

Hmm, the plugin registers OnFrameStarted events, but that should be called uoon each renderOneFrame call :/ I think :)

put some debug output in OnFrameStarted() function, if it isn't called, that's the problem.

Pokemonster

19-04-2010 12:14:36

Yup, that's what I did.


bool OgreVideoManager::frameStarted(const FrameEvent& evt)
{
static int frameCounter = 0;
static char buffer[255];

sprintf( buffer, "OgreVideoManager::frameStarted() : Frame #%i timeSinceLastFrame %fms\n", frameCounter, evt.timeSinceLastFrame);
OutputDebugString( buffer );
frameCounter++;

// *** commenting this in makes the video play fine ***

//if( frameCounter%5 != 0)
// return true;

if (evt.timeSinceLastFrame > 0.3f)
update(0.3f);
else
update(evt.timeSinceLastFrame);

// update playing videos
std::vector<TheoraVideoClip*>::iterator it;
TheoraVideoFrame* f;
for (it=mClips.begin();it!=mClips.end();it++)
{
float timePos = (*it)->getTimePosition();

f=(*it)->getNextFrame();
if (f)
{
<snip>
Frame update stuff
</snip>
sprintf( buffer, "[%f] Frame updated\n", timePos );
OutputDebugString( buffer );
}
else
{
sprintf( buffer, "[%f] next frame is null!\n", timePos );
OutputDebugString( buffer );
}
}
return true;
}


and the output looks like this :


OgreVideoManager::frameStarted() : Frame #0 timeSinceLastFrame 0.000000ms
[0.000000] next frame is null!
OgreVideoManager::frameStarted() : Frame #1 timeSinceLastFrame 616.000000ms
[0.300000] Frame updated
OgreVideoManager::frameStarted() : Frame #2 timeSinceLastFrame 45.000000ms
[0.600000] Frame updated
OgreVideoManager::frameStarted() : Frame #3 timeSinceLastFrame 17.000000ms
[0.900000] Frame updated
OgreVideoManager::frameStarted() : Frame #4 timeSinceLastFrame 16.000000ms
[1.200000] Frame updated
OgreVideoManager::frameStarted() : Frame #5 timeSinceLastFrame 17.000000ms
[1.500000] Frame updated
OgreVideoManager::frameStarted() : Frame #6 timeSinceLastFrame 16.000000ms
[1.800000] next frame is null!
OgreVideoManager::frameStarted() : Frame #7 timeSinceLastFrame 21.000000ms
[2.100000] next frame is null!
OgreVideoManager::frameStarted() : Frame #8 timeSinceLastFrame 23.000000ms
[2.400000] Frame updated
OgreVideoManager::frameStarted() : Frame #9 timeSinceLastFrame 19.000000ms
[2.700000] next frame is null!
OgreVideoManager::frameStarted() : Frame #10 timeSinceLastFrame 14.000000ms
[3.000000] next frame is null!
OgreVideoManager::frameStarted() : Frame #11 timeSinceLastFrame 14.000000ms
[3.300000] next frame is null!
OgreVideoManager::frameStarted() : Frame #12 timeSinceLastFrame 14.000000ms
[3.600000] next frame is null!
OgreVideoManager::frameStarted() : Frame #13 timeSinceLastFrame 14.000000ms
[3.900000] next frame is null!
OgreVideoManager::frameStarted() : Frame #14 timeSinceLastFrame 14.000000ms
[4.200000] next frame is null!
OgreVideoManager::frameStarted() : Frame #15 timeSinceLastFrame 14.000000ms
[4.500000] next frame is null!
OgreVideoManager::frameStarted() : Frame #16 timeSinceLastFrame 14.000000ms
[4.800000] next frame is null!
OgreVideoManager::frameStarted() : Frame #17 timeSinceLastFrame 14.000000ms
[5.100000] next frame is null!
OgreVideoManager::frameStarted() : Frame #18 timeSinceLastFrame 14.000000ms
[5.400001] next frame is null!
OgreVideoManager::frameStarted() : Frame #19 timeSinceLastFrame 13.000000ms
[5.700001] next frame is null!
OgreVideoManager::frameStarted() : Frame #20 timeSinceLastFrame 14.000000ms
[6.000001] next frame is null!
OgreVideoManager::frameStarted() : Frame #21 timeSinceLastFrame 14.000000ms
[6.300001] next frame is null!
OgreVideoManager::frameStarted() : Frame #22 timeSinceLastFrame 13.000000ms
[6.600001] next frame is null!
OgreVideoManager::frameStarted() : Frame #23 timeSinceLastFrame 18.000000ms
[6.900002] next frame is null!
OgreVideoManager::frameStarted() : Frame #24 timeSinceLastFrame 14.000000ms
[7.200002] next frame is null!
OgreVideoManager::frameStarted() : Frame #25 timeSinceLastFrame 16.000000ms
[7.500002] next frame is null!
...


As you can see, the texture is only updated once in a while, most of the time I get a null pointer instead of the frame. Do I have to throttle this manually ? Somehow, it looks like
I'm pulling the frames to fast ...

Kreso

19-04-2010 12:17:31

huh, I update every 5 frames? forgot about that. will check that.

as for null pointers, yeah, if you get a null pointer, that means there are no frames ready at the moment, so just continue using the previous frame rendered to your texture, that's how it works. It decodes eg 25 FPS while your app runs at 60 FTP at best.

Pokemonster

19-04-2010 12:28:24

Hey,

I found the problem. Your code is perfectly fine. Your update method expects seconds, I'm supplying it with ms because of my custom ogre main loop where I call
renderOneFrame() with ms instead of seconds. Now that I changed this it works fine :-) Now let's see how far I can turn up that resolution 8)

Kreso

19-04-2010 12:57:23

kewl B)