views:

374

answers:

2

Writing a game, and I'd like some cutscenes in the middle. In windowed mode, the DirectShow classes work perfectly and are easy to use. But when the game is fullscreen, I can't get DirectShow to show a fullscreen cutscene.

Basically, when I have a D3D Device initialized, I can't get the video to display, even with IVideoWindow.put_Fullscreen(true). I'm guessing that DirectShow just can't do fullscreen with a D3D Device.

So, I tried releasing my D3D Device while the cutscene plays and reinitializing it again after. This seems to work pretty well, but when DirectShow plays fullscreen, it seems to steal focus from my app's main window and not give it back when it's finished. That then causes DirectInput to fail to acquire the device again afterwards (gives me an "Access Denied" error code). I tried SetForegroundWindow() before acquiring, but that doesn't fix it, so that may not be the problem after all.

Anyway, long story short, all I want is a fullscreen cutscene in the middle of my D3D app. Is there a preferred way to accomplish this? Can I do it by having DirectShow output to my D3D primary surface? I think that would fix the problems I'm having.

+2  A: 

Look at the "DumpFilter". By using that you can EASILY write a filter that will write directly to a D3D texture. Also, bear in mind, you don't need to support external com instantiation. You can simple instance the class and use it. It doesn't need to be exposed outside of your application ...

Edit: The DumpFilter is one of the DirectShow API examples.

Goz
I don't see "DumpFilter" anywhere in my DirectShow API file. I'm using DX9. Is that a DX10 thing, by any chance?
TrespassersW
+1  A: 

You want to create a custom allocator for the Video Mixing Renderer 9. It's much easier than making your own renderer filter, and it's specifically made for D3D interop.

There is an example in the Windows SDK. Mine is installed here:

C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\vmr9\vmr9allocator

Jeremiah Morrill
It took me a while, but I found the example you refer to (It was in the Windows SDK, but not the DirectX SDK--how odd). I'll take a look at it tonight and see if I can figure it out. It sounds like what I'm looking for.
TrespassersW
DirectShow (despite it's name) was moved to the Windows SDK 5 or 6 years ago. It confused me also when I first found it out.Anyways, the benefits to using the VMR9 allocator is you can get hw video acceleration with certain formats, hw accelerated color space conversions and deinterlacing...not to mention it helps you render to a d3d surface ;)
Jeremiah Morrill
Just thought I'd pop back and mention that I got this working, thanks to the sample you pointed me to. Thanks again.
TrespassersW
No problem! Glad I could give you useful pointers!
Jeremiah Morrill