Sign in to follow this  
Lyev

AVIStreamGetFrameOpen Problem

Recommended Posts

Lyev    118
First of all I learnt how to do this from [url="http://nehe.gamedev.net/tutorial/playing_avi_files_in_opengl/23001/"]http://nehe.gamedev....n_opengl/23001/[/url]
AVIStreamGetFrameOpen is always returning NULL. I checked to see if I could open the AVI file in windows media player and that worked, so that means it can't be a codec problem, right? I'm not too sure. All the variables have valid values before the call to AVIStreamGetFrameOpen
Here's my code:

[CODE]
if (AVIStreamOpenFromFile(&avi, file, streamtypeVIDEO, 0, OF_READ, NULL) != 0)
return;
AVIStreamInfo (avi, &info, sizeof(info));
w = info.rcFrame.right - info.rcFrame.left;
h = info.rcFrame.bottom - info.rcFrame.top;
lastframe = AVIStreamLength (avi);
mpf = AVIStreamSampleToTime (avi, lastframe) / lastframe;
header.biSize = sizeof (BITMAPINFOHEADER);
header.biPlanes = 1;
header.biBitCount = 24;
header.biWidth = BITMAP_WIDTH;
header.biHeight = BITMAP_HEIGHT;
header.biCompression = BI_RGB;
bitmap = CreateDIBSection (hdc, (BITMAPINFO*)(&header), DIB_RGB_COLORS, (void**)(&data), NULL, NULL);
SelectObject (hdc, bitmap);
pgf = AVIStreamGetFrameOpen (avi, NULL);
if (!pgf)
return;
[/CODE] Edited by Lyev

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this