Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Pages: [1] 2

Author Topic: blitFrameCheck() not working ?  (Read 5495 times)

M&M

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 30
    • View Profile
    • http://www.blueprintgames.com
blitFrameCheck() not working ?
« on: December 09, 2005, 03:27:08 PM »

Since this is a completely different problem, I made a different topic.

Every frame i Call blitFrameCheck() but the screen is still black, I tried to place a breakmark inside displayedFrame since its being called by blitFrameCheck() and debugging, but it didn't get triggered :? whats going on ?
Logged
url=http://www.blueprintgames.com/][/url]

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
blitFrameCheck() not working ?
« Reply #1 on: December 09, 2005, 03:42:13 PM »

Hard to say without seeing the problem. Is this with the CEGUI demo or just your app?
Logged

M&M

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 30
    • View Profile
    • http://www.blueprintgames.com
blitFrameCheck() not working ?
« Reply #2 on: December 09, 2005, 04:19:53 PM »

my app, but I based my code somewhat on the CEGUI demo.I'm sure blitFrameCheck() is being called every frame. And i did subclass from TheoraMovieMessage and provided my implementations of the functions required (including displayedFrame() )
Logged
url=http://www.blueprintgames.com/][/url]

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
blitFrameCheck() not working ?
« Reply #3 on: December 09, 2005, 04:52:01 PM »

If that method is being called, and you are getting no video being displayed.. Then, that means that a picture is not ready for display yet. Which would be caused by a) the decoding thread could not get a decoded theora packet b) the audio time has not advanced may cause this - does this happen with the cheer.ogg?
Logged

M&M

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 30
    • View Profile
    • http://www.blueprintgames.com
blitFrameCheck() not working ?
« Reply #4 on: December 10, 2005, 09:49:32 AM »

Quote
b) the audio time has not advanced may cause this

I've sorta disabled the audio atm, in the cegui demo it worked when I commented out the audio manager. Anyways, i'll experiment further with that other video and perhaps try adding audio and see if that works
Logged
url=http://www.blueprintgames.com/][/url]

M&M

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 30
    • View Profile
    • http://www.blueprintgames.com
blitFrameCheck() not working ?
« Reply #5 on: December 11, 2005, 03:31:18 PM »

interesting, I've integrated audio and now the audio plays but there is no video (no image). I suppose a) is the probable answer. And yes, it does happen with the cheer.ogg movie.

So what do I do to make sure theora audio packets are recieved ?
Logged
url=http://www.blueprintgames.com/][/url]

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
blitFrameCheck() not working ?
« Reply #6 on: December 11, 2005, 05:46:33 PM »

Well, if it happens with the cheer.ogg ( a known good ogg encoded video/audio file) than I am doubting my first choice of a...

In which case, I'm kinda lost as to what may be wrong.. You should try placing some break points inside the decoding thread in movie clip to see if a theora packet is being decoded properly (decodeTheora() method). If the CEGUI demo is working.. then, your app has to missing something even if it is very slight.. I think you may have to post some relevent code here... I would just take a look at your whole project.. but I do not have time for that ATM.

On a side note, I am going to investigate a crash when there is no audio stream present - though, this may or may not be related to your problem.. as you say you used a clip that has an audio stream.
Logged

M&M

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 30
    • View Profile
    • http://www.blueprintgames.com
blitFrameCheck() not working ?
« Reply #7 on: December 11, 2005, 06:05:07 PM »

yeah, I tried using the CEGUI demo after commenting the sound system lines in  MovieLogic (as i was lazy to get fmod deps) and it worked fine, no crashes.

Here is the relative code from my project

Code: [Select]

void CVideoStream::InitialiseStream(const Ogre::String &fileName, const Ogre::String &referenceName, const Ogre::String &groupName)
{
m_RefName = referenceName;
m_VideoControl = CVideoStreamManager::getSingletonPtr()->GetVideoController();
//Sets an input file name - needed by plugin
m_VideoControl->setInputName(fileName);
m_AudioClip = new CTheoraStream();
//Start paused so we can have audio
m_VideoControl->setPlayMode( TextureEffectPause );

// Used for attaching texture to Technique, State, and texture unit layer
m_VideoControl->setTextureTecPassStateLevel( 0, 0, 0 );

//Set to true to allow for seeking - highly experimental though ;)
m_VideoControl->setSeekEnabled( false );

// Create movie material
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create( "VideoStreamPlayer/PlayWindowMaterial", groupName);
if( material.isNull() )
{
OGRE_EXCEPT(Ogre::Exception::ERR_INTERNAL_ERROR, string("VideoStream: Unable to create a material for VideoStream " + m_RefName),
           "CVideoStream::InitialiseStream");
}

material->createTechnique()->createPass();
material->getTechnique(0)->getPass(0)->createTextureUnitState();

m_VideoControl->createDefinedTexture( "VideoStreamPlayer/PlayWindowMaterial", groupName );
m_VideoClip = m_VideoControl->getMaterialNameClip("VideoStreamPlayer/PlayWindowMaterial"); // set Clip material

m_Texture = ((OgreCEGUIRenderer*)System::getSingletonPtr()->getRenderer())->createTexture( m_VideoClip->getVideoDriver()->getTexture() );
}
//-------------------------------------------------------------

//-------------------------------------------------------------
void CVideoStream::Play()
{
if( m_VideoClip->getPlayMode() == TextureEffectPlay_ASAP)
return; // movie playing, ignore play command

m_MovieSheet = (StaticImage*)WindowManager::getSingleton().createWindow("WindowsLook/StaticImage", string("VideoStreamPlayer/" + m_RefName + "/MovieSheet") );
System::getSingletonPtr()->getGUISheet()->addChildWindow(m_MovieSheet);

m_MovieSheet->setMaximumSize(Size(2.0f, 2.0f));
m_MovieSheet->setPosition(Point(0.1f, 0.05f));
m_MovieSheet->setSize(Size(1.0f, 0.86f));
m_MovieSheet->setFrameEnabled(true);
m_MovieSheet->setBackgroundEnabled(true);
m_MovieSheet->setAlwaysOnTop(true);
// m_MovieSheet->disable();

//Now attach Texture to movie sheet
CEGUI::String temp = "MovieImageset";

Imageset *MovieImageset = ImagesetManager::getSingleton().createImageset( temp, m_Texture );

unsigned int width = m_VideoClip->getVideoDriver()->getWidth();
unsigned int height= m_VideoClip->getVideoDriver()->getHeight();

MovieImageset->defineImage( m_RefName, Point(0.0f,0.0f), Size( width, height ), Point(0.0f,0.0f));
m_MovieSheet->setImage( temp, m_RefName);
m_VideoClip->registerMessageHandler( this );
// Set audio clip
m_VideoClip->setAudioDriver( m_AudioClip );

m_VideoClip->changePlayMode( TextureEffectPlay_ASAP );
m_Paused = false;

}


CVideoStreamManager simply initialises the plugin, handles loading/unloading & updating the CVideoStream.

This is pretty much a rearranged collection of what was in MovieLogic & the handleplay() method in MainModule
Logged
url=http://www.blueprintgames.com/][/url]

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
blitFrameCheck() not working ?
« Reply #8 on: December 11, 2005, 06:15:01 PM »

I'll take a look at your code tomorrow..

as a side though, I just fixed the crash when no audio stream present. It worked when you did not apply an AudioDriver to the plugin but not when you did give it an audiodriver but the video had no audio stream.. simple fix there:

reason was in movie clip execute method:
if( m_audioInterface )
should hav been (and now is in cvs)
if( m_audioInterface && m_vorbis_streams )

Though, probably not your problem here at all.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
blitFrameCheck() not working ?
« Reply #9 on: December 12, 2005, 09:24:01 AM »

Well, I do not see anything wrong with the code posted (though, that does not mean there isn't.. hard to tell sometimes). I suggest that you start placing breakpoints inside the plugin to try to find where it is failing to update:

FIrst, line 348 in void TheoraMovieClip::blitFrameCheck() to make sure that is in fact being called right...
Then try one on line 350 to see if a frame is ever ready.

If you actually get to both of those breakpoints and your image is still blank. Then that suggests that maybe you applied the wrong texture to the CEGUI StaticImage.

If you do not hit the breakpoint on line 350 (but you did hit 348), then try placing some breakpoints around the execute() method of TheoraMovieClip to see if it is actually going into the decodeTheora method.. And maybe you can narrow it down further.
Logged

M&M

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 30
    • View Profile
    • http://www.blueprintgames.com
blitFrameCheck() not working ?
« Reply #10 on: December 12, 2005, 10:49:07 AM »

well, the problem is my app is seperated from the theora project files. I'll have to add the project to my solution and get my project to use it instead of the dll's i've built.

I'll report when I get it working.
Logged
url=http://www.blueprintgames.com/][/url]

M&M

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 30
    • View Profile
    • http://www.blueprintgames.com
blitFrameCheck() not working ?
« Reply #11 on: December 12, 2005, 12:09:48 PM »

well, I'm not sure if I did it right but it seemed to work somewhat (stepping through plugin's code from my project). When I try to step into plugin methods mentioned in my code, it would just continue w/o stepping in. But if I place a breakmark, the application breaks there.

blitFrameCheck() doesn't seem to have been called at all :?, but i'm sure its being called from my code along with the audio update() code. And the audio works fine so ..... :?. But the breakmark never got triggered

i placed a bookmark inside execute() and decodeTheora() has been called several times.
Logged
url=http://www.blueprintgames.com/][/url]

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
blitFrameCheck() not working ?
« Reply #12 on: December 12, 2005, 12:20:47 PM »

Hmm, debugger stepping over the methods when you try to step in usually is because the code's pdb cannot be found or, you are using a different build of the dll to the pdb it did find (copy over the dll again). Make sure you have rebuilt your app  against the same dll you are trying to debug.

Anyway, if the other breakpoints are being met, except the blitFrameCheck, I would suspect that that is the problem. Not sure how.. I don't think you posted where you update the frame from... Perhaps you did not register a framelistener to Ogre Root..
Logged

M&M

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 30
    • View Profile
    • http://www.blueprintgames.com
blitFrameCheck() not working ?
« Reply #13 on: December 12, 2005, 12:53:13 PM »

here is the source code for the 2 classes so you could see the bigger picture, the whole project is ALOT bigger and you only need those to anyways.

-CVideoStreamManager is supposed to handle multiple video streams, it still needs some work which will happen after I get the first video working.
-CVideoStream is basicly a TheoraMovieClip with a few extra methods and member data like reference names. This is basicly the MovieLogic class
-There is a CTheoraStream which handles the audio, i didn't include it since its not going to be too helpful

As for frames, I'm using a single frame listener which calls CVideoStreamManager::UpdateActiveStreams() every frame. and thats calling the Update() method for active CVideoStream.
I'm pretty sure the updating is working properly because audio is being played properly, and the debugger seems to call blitframecheck() (although I don't see any results of that).
Logged
url=http://www.blueprintgames.com/][/url]

M&M

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 30
    • View Profile
    • http://www.blueprintgames.com
blitFrameCheck() not working ?
« Reply #14 on: December 13, 2005, 06:03:51 PM »

a VERY interesting thing happened. Out of sheer desperation, I took my 3 classes and plugged them right into the CEGUI_DEMO. Changed the MainModule's code around to use my stuff instead, modified project settings and all that. Then I built the project and tried it. And guess what ... video image appeared !!!!  :shock:

So basicly my code works, so why isn't it working in my project !? My guess is there must be something in my project thats disabling/conflicting with something in the plugin, or perhaps something in my project isn't yet initialised ?

There isn't much done in my project when I start playing the movie, I only show the game intro, then the menu. The movie is played over the menu but I get a black screen. The movie worked fine in the cegui demo, it was played over the existing layout btw (in the StaticImage i define from code). So pretty much all my code is working. What could be wrong ?

Please post your thoughts on this as I don't know what to do with this new information
Logged
url=http://www.blueprintgames.com/][/url]
Pages: [1] 2