Jump to content
  • Advertisement
Sign in to follow this  
sipickles

DirectShow not happy in DX9 :(

This topic is 4918 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have been successfully using DirectShow in DX8.1 to play small videos in my app. Since upgrading to 9.0c it NEARLY works, but i can't fathom it! The video is supposed to appear over a d3d background (like it did quite happily in DX8). In DX9, it appears briefly, then disappears, but is still playing (i can hear the audio). Here's my code, pretty much straight off msdn.... //////////////VIDEO INIT HRESULT hr = CoInitialize(NULL); if (FAILED(hr)) { MessageBox(NULL,"CoInitialize Failed", "VIDEO", MB_OK); } hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph); if (FAILED(hr)) { MessageBox(NULL,"CoCreateInstance Failed", "VIDEO", MB_OK); } hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl); hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent); hr = pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVideoWindow); hr = pGraph->RenderFile(L"data/movies/si.avi", NULL); if (FAILED(hr)) { MessageBox(NULL,"RenderFile Failed", "VIDEO", MB_OK); } if( FAILED( pVideoWindow->put_Owner((OAHWND)g_hWnd) ) ) {MessageBox(NULL, "put_Owner Failed", "VIDEO", MB_OK);} if( FAILED( pVideoWindow->put_Windowstyle(WS_BORDER | WS_CHILD | WS_CLIPSIBLINGS ) ) ) {MessageBox(NULL, "put_Windowstyle Failed", "VIDEO", MB_OK);} RECT vwrect= { 100, 100, 600, 400 }; if( FAILED( pVideoWindow->SetWindowPosition(vwrect.top,vwrect.left,vwrect.right,vwrect.bottom) ) ) {MessageBox(NULL, "SetWindowPosition Failed", "VIDEO", MB_OK);} pVideoWindow->put_Visible(OATRUE); hr = pControl->Run(); if (SUCCEEDED(hr)) { long evCode; pEvent->WaitForCompletion(0, &evCode); } Anyone got any ideas? I am going round in ever decreasing circles! Thanks Si

Share this post


Link to post
Share on other sites
Advertisement
I suggest looking up how to render a video to a texture and use that method. There should be a video texture sample with the sdk or on msdn. I know there is definatly one for C# and pretty sure there is one for C++. I am also pretty sure it uses the framework so you will have to modify the code abit to work with yoru game (assuming you are not using the directx framework).

Also look up the VMR9 renderer and how to allocate a buffer with it. Directshow and directgraphics are not meant to work together like you have it.

Its likly that the newer video drivers in directx 9 mode force the d3d window above your child.

Also why are you calling CoInitialize()? that should be done once at the very start of the app. you should not call it in video init, because your video_init() is likly to become video_open(). You definatly dont want to be calling CoInitlize() multiple times during your game.

Also look and see if msdn has any game cutscene samples since that is what you need. What you have seems to be a play a video with directshow sample, and not play a video with directshow while using d3d as well.

Share this post


Link to post
Share on other sites
Before any you make any major changes to your code you should register your graph with the running object table and then use GraphEdit to spy on it to make sure that what you think is happening actually is doing.

Having said that I have recently moved to Windows 2000 with no changes to the code base and I am having an absolute nightmare getting the full screen to work. I would make sure that you are creating output from anything which is in anyway connected to DirectShow, that way you kind at least find out where the problem is.

Regards

Mark Coleman

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!