Jump to content
  • Advertisement
Sign in to follow this  
meanoldgeezer

Direct Show

This topic is 3445 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

Ok..... so, my problem is that I want to render a background, then render video a smaller video window on top of that, then render a third layer. Right now, I am rendering to the back buffer surface, then getting the device context for the window and using direct show (VMR9) to display video on top of that. But, I don't know how I should go about applying the 3rd layer. Anyone?

Share this post


Link to post
Share on other sites
Advertisement
In my experience I found that direct show is rendering to it's own buffer, so I dont think there is a way to render on top and below it.

One thing you can do is get the direct show video current bitmap and render that to your backbuffer too. Then it would be the case of just z sorting of what is on top or below.

Share this post


Link to post
Share on other sites
Alright, I have used sample grabber to get a bitmap back from the video frame. But, now I can't seem to put the image on a texture.

I can push the bitmap onto the screen using...

hr = SetDIBitsToDevice(
compatableHDC
, 0, 0,
pVih->bmiHeader.biWidth,
pVih->bmiHeader.biHeight,
0, 0,
0,
pVih->bmiHeader.biHeight,
pBuffer,
(BITMAPINFO*)&pVih->bmiHeader,
DIB_RGB_COLORS);


But, I try pushing it to my texture with....


((IDirect3DTexture9*)(Videos.g_Texture))->GetSurfaceLevel(0,&pSurface);
HDC surfaceHDC = NULL;
pSurface->GetDC(&surfaceHDC);
HDC compatableHDC = CreateCompatibleDC(surfaceHDC);

hr = SetDIBitsToDevice(
compatableHDC
, 0, 0,
pVih->bmiHeader.biWidth,
pVih->bmiHeader.biHeight,
0, 0,
0,
pVih->bmiHeader.biHeight,
pBuffer,
(BITMAPINFO*)&pVih->bmiHeader,
DIB_RGB_COLORS
);

Afterward, I use beginscene settexture draw endscene...
But no such luck, the texture just looks like garbage.
(Actually, not completely garbage, it actually looks like a scrampled version of a texture I loaded earlier in my code.)
Any idea what I'm doing wrong?

Share this post


Link to post
Share on other sites
Well the main difference would be that your using a texture in the 2nd example right? so that would mean something like the texture format isnt working with the frame format?

Im not sure but thats what it seems like to me. Looks like you are on the right track though otherwise you would have got worse outcomes.

when I was trying to do this a couple months ago I was suprised by the lack of information reguarding video rendering compared to everything else.

Share this post


Link to post
Share on other sites
I found the only reliable way to do this was to copy this bytes by hand. This way you can do some quick and dirty in-place effects, like setting each pixel to 0xffff0000 (red?), or modifying alpha in place.

There's plabably other ways, but this worked for me. also to see if anything is going wrong turn debug reporting on in debug direct3d

Share this post


Link to post
Share on other sites
FOLLOW-UP:

Ended up going from an IMediaSample, and converting the bits to the correct format, and shoving them into a texture. (Skips the step of going from the sample grabber, to a bitmap, then bitmap to texture.) Then applying the texture to a polygon to draw it.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!