DirectShow IVideoWindow and Fullscreen--Can I write to my D3D Primary Surface?
Asked Answered
C

2

6

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.

Condescending answered 6/12, 2009 at 20:27 Comment(0)
P
2

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

Parchment answered 7/12, 2009 at 6:14 Comment(3)
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.Condescending
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 ;)Parchment
Just thought I'd pop back and mention that I got this working, thanks to the sample you pointed me to. Thanks again.Condescending
M
2

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.

Mho answered 6/12, 2009 at 20:31 Comment(1)
I don't see "DumpFilter" anywhere in my DirectShow API file. I'm using DX9. Is that a DX10 thing, by any chance?Condescending
P
2

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

Parchment answered 7/12, 2009 at 6:14 Comment(3)
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.Condescending
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 ;)Parchment
Just thought I'd pop back and mention that I got this working, thanks to the sample you pointed me to. Thanks again.Condescending

© 2022 - 2024 — McMap. All rights reserved.