GuiAviBitmapCtrl DirectShow Full screen problem.
by Kuju Manila · in Torque Game Engine · 03/12/2007 (11:36 pm) · 7 replies
Hi Guys.
I need help on making the GuiAviBitmapCtrl DirectShow version (http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7826) be able to work properly on full screen.
First of all, has anyone ever been successful on making this to work on full screen?
By default, the gui control works properly on Windowed mode. However, when I switch to full screen, the video does not appear.
I investigated a little and found in MSDN about the IVideoWindow::put_FullScreenMode() method. Using that, I have been able to have full screen mode of the video only when my Torque window is NOT in fullscreen mode in the background.
But, I really need everything to be in full screen! Doing so, I only came across numerous problems whenever both Torque and the Directshow (via put_FullScreenMode()) are set as fullscreen mode -- BSOD!!!
So I did a little hack. I just made a point that before I start the movie, I set Torque to be not full screen and then set Directshow to full screen. And when the movie ends, close directshow and set Torque to full screen. However, when my game will go back to this sequence, the time Torque is set to full screen my keys or events are no longer accepted, EC_COMPLETE is also seem to be not notified.
What do you think am I missing?
Here my codes. Mark/enclosed by AOV remarks are my modifications.
In GuiAviBitmapCtrl constructor AND in InitDirectShow function:
Better yet, what's the better implementation? I'm a noob to DirectShow but I'm trying hard to fix this. I really just need assistance this time.
I need help on making the GuiAviBitmapCtrl DirectShow version (http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7826) be able to work properly on full screen.
First of all, has anyone ever been successful on making this to work on full screen?
By default, the gui control works properly on Windowed mode. However, when I switch to full screen, the video does not appear.
I investigated a little and found in MSDN about the IVideoWindow::put_FullScreenMode() method. Using that, I have been able to have full screen mode of the video only when my Torque window is NOT in fullscreen mode in the background.
But, I really need everything to be in full screen! Doing so, I only came across numerous problems whenever both Torque and the Directshow (via put_FullScreenMode()) are set as fullscreen mode -- BSOD!!!
So I did a little hack. I just made a point that before I start the movie, I set Torque to be not full screen and then set Directshow to full screen. And when the movie ends, close directshow and set Torque to full screen. However, when my game will go back to this sequence, the time Torque is set to full screen my keys or events are no longer accepted, EC_COMPLETE is also seem to be not notified.
What do you think am I missing?
Here my codes. Mark/enclosed by AOV remarks are my modifications.
In GuiAviBitmapCtrl constructor AND in InitDirectShow function:
mWindow = FindWindow( L"Darkstar Window Class", NULL); // AOV 070312
S32 GuiAviBitmapCtrl::movieClose()
{
movieStop();
if (g_pVideoWindow)
{
g_pVideoWindow->put_Owner(NULL);
g_pVideoWindow->put_Visible(OAFALSE);
//if(GetForegroundWindow() != mWindow)
// SetForegroundWindow(mWindow); //Eric
}
// notify the script that the movie was closed
//+ AOV 070313
Con::executef( this, 1, "onMovieClosed" );
Point2I pSize = Parent::getExtent();
char* cmd = Con::getReturnBuffer( 100 );
dSprintf( cmd, 100, "setScreenMode( %d, %d, %d, %d );",
pSize.x, pSize.y, 32, true );
Con::errorf(cmd);
Con::evaluatef( cmd );
//- AOV 070313
return MOVERR_OK;
}
S32 GuiAviBitmapCtrl::movieStart()
{
// TDD - Added DirectShow check for starting the movie
#if USE_DIRECTSHOW
// start playing the movie
// This does not currently handle stop/resume
// find out the position and size of our control
Point2I pPos = Parent::getPosition();
Point2I pSize = Parent::getExtent();
g_pVideoWindow->put_AutoShow(OAFALSE);
g_pVideoWindow->put_Owner((OAHWND)mWindow);
g_pVideoWindow->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
g_pVideoWindow->put_MessageDrain((OAHWND)mWindow);
g_pVideoWindow->SetWindowPosition(pPos.x, pPos.y, pSize.x, pSize.y);
g_pVideoWindow->put_Visible(OATRUE);
g_pVideoWindow->SetWindowForeground(-1);
//+ AOV 070313
Con::errorf("movieStart: setting non-fullscreen");
char* cmd = Con::getReturnBuffer( 100 );
dSprintf( cmd, 100, "setScreenMode( %d, %d, %d, %d );", pSize.x, pSize.y, 32, false );
Con::evaluatef( cmd );
if( mFullScreen )
{
if( g_pVideoWindow->put_FullScreenMode(OATRUE) != S_OK )
{
Con::printf( "Movie full screen mode failed." );
}
}
Con::executef(this, 1, "onMovieBegin");
//- AOV 070313
g_pMediaControl->Run();
return MOVERR_OK;
#endif
return MOVERR_NOVIDEOSTREAM;
// ---------------
}Better yet, what's the better implementation? I'm a noob to DirectShow but I'm trying hard to fix this. I really just need assistance this time.
#2
03/13/2007 (5:14 pm)
Ok, I'll try to ask the authors. I used to use theora at start, but it is so unnacceptable in terms of quality. It stutters and breaks too much especially on what we're trying to do is to play a video that is 1280x720 with very high quality. Theora, well is frankly only up to BetaMax or VHS quality, no matter what we do.
#4
Problem is, Bink nor Cri-ware is not an option for us. So, that's why resorted in DirectShow, where we could play an avi or wmv video on whatever codec applied on that machine. There are also other reasons that I am forbidden to specify.
Also, the resource specified above (or was it Vanderback's?) seem to have some people claim to have been successful on fullscreen. So, I'm waiting for such GG people to have their say on this (it seems to be pretty simple yet I can't figure out what's wrong). ;)
03/14/2007 (6:03 am)
Thanks for replying.Problem is, Bink nor Cri-ware is not an option for us. So, that's why resorted in DirectShow, where we could play an avi or wmv video on whatever codec applied on that machine. There are also other reasons that I am forbidden to specify.
Also, the resource specified above (or was it Vanderback's?) seem to have some people claim to have been successful on fullscreen. So, I'm waiting for such GG people to have their say on this (it seems to be pretty simple yet I can't figure out what's wrong). ;)
#5
Ok, I made a terrible work-around for this. As I have said the concept is to simply change resolutions before and after the movie started and ended respectively. Note that this has bad performance! As you can see the transitions of changing resolutions (seeing a the desktop for a second or two). I really need a good solution for this DirectShow player to play in full screen seamlessly.
I found out that the cause of the crash/BSOD (depending on your computer) is the InitDirectShow code. Initially, when your Torque window is at full screen and you call InitDirectShow (which just creates and queries the direct show interfaces), that's the time it causes the crash. Anyone would shed some light on how do we go about this? Perhaps, share a working DirectShow code out there?
03/16/2007 (10:02 pm)
Update:Ok, I made a terrible work-around for this. As I have said the concept is to simply change resolutions before and after the movie started and ended respectively. Note that this has bad performance! As you can see the transitions of changing resolutions (seeing a the desktop for a second or two). I really need a good solution for this DirectShow player to play in full screen seamlessly.
I found out that the cause of the crash/BSOD (depending on your computer) is the InitDirectShow code. Initially, when your Torque window is at full screen and you call InitDirectShow (which just creates and queries the direct show interfaces), that's the time it causes the crash. Anyone would shed some light on how do we go about this? Perhaps, share a working DirectShow code out there?
#6
You might want to look at "windowless mode" in the directshow sdk.
Windowless mode
Using Windowless mode
I'm not sure that will work for you, and if it will happily co-exist with openGL. I haven't tried it myself and it's been many years since I did anything with DirectShow, but it seems like its a good place to start looking.
Also, you can just get the HWND with GetForegroundWindow(), no need to do "FindWindow". That might crash if you're running more than one instance of Torque and you get the wrong one. :)
EDIT: There is a sample in the NVIDIA SDK ("gpu_videoeffects") that plays back HD res video into an openGL application (using directShow). It also applies fancy filters. But it's really complicated, it's not something that you can just drop into torque. But it might help figure out what's going on if you look at the directshow stuff in there (even if you don't have an NV card).
joel
03/17/2007 (12:41 am)
This approach seems really sketchy to me. You might be able to get it to work, but I would be doubtful of it working with different drivers/systems. You might want to look at "windowless mode" in the directshow sdk.
Windowless mode
Using Windowless mode
I'm not sure that will work for you, and if it will happily co-exist with openGL. I haven't tried it myself and it's been many years since I did anything with DirectShow, but it seems like its a good place to start looking.
Also, you can just get the HWND with GetForegroundWindow(), no need to do "FindWindow". That might crash if you're running more than one instance of Torque and you get the wrong one. :)
EDIT: There is a sample in the NVIDIA SDK ("gpu_videoeffects") that plays back HD res video into an openGL application (using directShow). It also applies fancy filters. But it's really complicated, it's not something that you can just drop into torque. But it might help figure out what's going on if you look at the directshow stuff in there (even if you don't have an NV card).
joel
#7
-xiao guang
05/13/2009 (10:47 pm)
You can detector whether the canvas mode is full screen, then set the window width and height of the control to cover the whole screen.-xiao guang
Associate David Montgomery-Blake
David MontgomeryBlake