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_F开发者_JAVA百科ullscreen(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.
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
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.
精彩评论