Jump to content
  • Advertisement
Sign in to follow this  
Sparhawk42

AVIStreamGetFrame and Direct3d 9

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

Advertisement
Hey man!

You need to get the DIB(device-independent bitmap) information for the surface first.

I am assuming that you know how to use the DirectShow functions such as AVIStreamGetFrame.

This can be done as follows:

LPBITMAPINFOHEADER lpbi;
lpbi = (LPBITMAPINFOHEADER)AVIStreamGetFrame(pgf, lFrame);

I haven't tested this part so don't kill me if it's wrong.

Hopefully this will be a 'file in memory' and it can be loaded into the surface using the D3DXLoadSurfaceFromFileInMemory function.

If you don't already know the D3DXLoadSurfaceFromFileInMemory function takes the following parameters in order:

LPDIRECT3DSURFACE9 pDestSurface: A pointer to the surface you are trying to draw to.

CONST PALETTEENTRY *pDestPalette: A pointer to a PALETTEENTRY structure. This should be NULL in your case. (maybe)

CONST RECT *pDestRect: A pointer to a RECT structure that represents the destination rectangle for your picture. NULL for the whole surface.

LPCVOID pSrcData: This is a pointer to the 'file in memory.' This should be lpbi from above.

UINT SrcData: This is the size of your 'file in memory' in bytes. You should probably use the sizeof keyword. eg: sizeof(&lpbi).

CONST RECT *pSrcRect: This is a pointer to a RECT structure that represents the source rectangle for your picture. NULL if you want the entire picture.

DWORD Filter: This is the filtering method for the picture. You should probably use D3DX_DEFAULT as the value.

D3DCOLOR ColorKey: This is the transparency colour that you want to set. Use the value 0 (black) for disabling it.

D3DXIMAGE_INFO *pSrcInfo: This is a pointer to a D3DXIMAGE_INFO structure. Unless you actually need this use NULL as a value.

Then draw the surface to the screen or whatever and remember to check it that the loading of the file from memory was successful.

Also here is a link to an article on Gamedev: link

Good luck with your project.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!