• Advertisement
Sign in to follow this  

AVIStreamGetFrame and Direct3d 9

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

Hello how can I render the image information I get with AVIStreamGetFrame to IDirect3DSurface9? Thanks a lot for your help!!!

Share this post


Link to post
Share on other sites
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