DirectShow / DirectDraw surface problem (getsurface())

First off i apaologise as my DirectShow knowledge is more or less non-existant, if it was better this problem would maybe be blindingly obvious but I have searched forums, documentation, usd the DX debugging features etc and still haven't solved it!

I am using directshow with directdraw surfaces to play avi's in

the Irrlicht engine. they play fine in a windowed app but I have a

problem in full screen. the movie is played to a surface then copied to

a texture that I can use. The problem seems to be that I use 32 bit

textures and that when I call

pSample->GetSurface(&pSurface,&Movie_rect);

(pSample is a pointer to a IDirectDrawStreamSample)

I get a 16 bit surface in fullscreen mode, even though my Irrlicht

device is set to run in 32 bit and my desktop is 32 bit - basically I

have no idea why it is giving me a 16 bit surface and how to stop it.

It sets the pixel format to 32-bit in the windowed app I just can't

figre why it doesn't do the same in fullscreen.

I orignally thought it may be because the surface is 'uninitialised'

(this is the first time it is used). So i tried first using

CreateSurface() to create a surface with the pixel format i wanted then

passed it to GetSample() but GetSample() just reset the pixel format to

16-bit. I have also tried setting the the format of the directdrawmediastream (even though both the current and desired formats are as I want them already) just to be sure but any changes I try to make to the surface seem to de undone by the call to GetSurface().

Any suggestions would be really appreciated as I have been stuck on this for some time and I feel it is so close to working!

PS this casues a problem because when I copy to the texture from the surface I get only half as much data as i need.

[1804 byte] By [funcdoobiest] at [2007-12-24]
# 1
Apart from why you are using the IDirectDrawStreamSample interface and not VMR7.

The GetSurface function will give you an address to an IDirectDrawSurface in the ppDirectDrawSurface, that means that anything that ppDirectDrawSurface is pointing to before will be overwritten.

To avoid memory leaks you should also release the returned IDirectDrawSurface.

Could it be that the video is not delivered as 32bit data to the filter that you try to get the sample from?

Try and dump the MediaType using the DisplayMediaType debug function.

FredrikBergstr?m at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,DirectShow Development...
# 2
Thanks for the reply, the code was provided by someone else so with regards to the IDirectDrawStreamSample/VMR7 issue I was simply using it as is.

The problem was actually a stupidly simple oversight on my behalf, I hadn't realised I had the stencil buffer enabled (and was getting a 16-bit device) until I was looking around in the engine for something else in the function that creates the device. Thanks again anyway for your time.

funcdoobiest at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,DirectShow Development...

Software Development for Windows Vista

Site Classified