Hi, I made this function a while ago and it was working.
streamtypeVIDEO equ 1935960438
fAVIS struct
avihnd dword 0
pAVIStream dword 0
firstframe dword 0
totalframe dword 0
pGetFrameObject dword 0
fAVIS ends
.data?
m_hdrawdib dword 0
.code
fInitVideo proc
invoke AVIFileInit
invoke DrawDibOpen
.if eax!=0
mov m_hdrawdib,eax
.else
invoke PERR
.endif
ret
fInitVideo endp
fAviFileOpen proc uses esi edi lps:dword,lptz:dword
assume esi: ptr fAVIS
mov esi,lps
lea eax,[esi].avihnd
invoke AVIFileOpen,eax,lptz,OF_SHARE_DENY_WRITE,NULL
.if eax!=0
invoke PERR
ret
.endif
lea eax,[esi].pAVIStream
invoke AVIFileGetStream,[esi].avihnd,eax,streamtypeVIDEO,0
.if eax!=0
invoke PERR
.endif
invoke AVIStreamStart,[esi].pAVIStream
.if eax==-1
invoke PERR
.endif
mov [esi].firstframe,eax
invoke AVIStreamLength,[esi].pAVIStream
.if eax==-1
invoke PERR
.endif
mov [esi].totalframe,eax
invoke AVIStreamGetFrameOpen,[esi].pAVIStream,AVIGETFRAMEF_BESTDISPLAYFMT
.if eax!=NULL
mov [esi].pGetFrameObject,eax
.else
invoke PERR
.endif
assume esi:nothing
ret
fAviFileOpen endp
fAVIClose proc uses esi lps:dword
assume esi:ptr fAVIS
invoke AVIStreamGetFrameClose,[esi].pGetFrameObject
invoke AVIStreamRelease,[esi].pAVIStream
invoke AVIFileRelease,[esi].avihnd
assume esi:nothing
ret
fAVIClose endp
fAVIDraw proc uses esi edi lps:dword,FramePos:dword,DC:dword,x:dword,y:dword,xDst:dword,yDst:dword,xSrc:dword,ySrc:dword
LOCAL lpbi:dword
assume esi:ptr fAVIS
mov esi,lps
mov eax,[esi].totalframe
.if FramePos>eax
xor eax,eax
dec eax
ret
.endif
invoke AVIStreamGetFrame,[esi].pGetFrameObject,FramePos
mov lpbi,eax
invoke DrawDibDraw,m_hdrawdib,DC,x,y,xDst,yDst,lpbi,NULL,xSrc,ySrc,-1,-1,0
assume esi:nothing
xor eax,eax
ret
fAVIDraw endp
Because of my computer is infected by a virus so I have to reinstall my comp to make it return to normal. After I reinstall my computer my avi function did not work. I have search the internet for a new version of the .dll and I install it but it still not working. the problem seems on fAVIDraw function in this line invoke AVIStreamGetFrame,[esi].pGetFrameObject,FramePos because it always return null. Anybody know how to solve it?
I also upload the include file and the lib
[attachment deleted by admin]
Was your previous installation using the vfw32.lib from the PSDK?
http://www.masm32.com/board/index.php?topic=7619.0
The one from your attachment is smaller than the one from the February 2003 PSDK.
What about (re)installing DShow and VFW codecs to decompress the video :toothy ?
Quote from: MichaelW on November 28, 2007, 06:52:18 AM
Was your previous installation using the vfw32.lib from the PSDK?
http://www.masm32.com/board/index.php?topic=7619.0
The one from your attachment is smaller than the one from the February 2003 PSDK.
i dont know what is PSDK, I think I did not use it.
Microsoft Windows Platform Software Development Kit (http://www.microsoft.com/downloads/details.aspx?FamilyID=a55b6b43-e24f-4ea3-a93e-40c0ec4f68e5&DisplayLang=en#Overview)
The one I use, and I think the last one that will work under Windows 98/ME, is here (http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm).
fAviFileOpen proc uses esi edi lps:dword,lptz:dword
assume esi: ptr fAVIS
mov esi,lps
lea eax,[esi].avihnd
invoke AVIFileOpen,eax,lptz,OF_SHARE_DENY_WRITE,NULL
.if eax!=0
invoke PERR
ret
.endif
lea eax,[esi].pAVIStream
invoke AVIFileGetStream,[esi].avihnd,eax,streamtypeVIDEO,0
.if eax!=0
invoke PERR
.endif
invoke AVIStreamStart,[esi].pAVIStream
.if eax==-1
invoke PERR
.endif
mov [esi].firstframe,eax
invoke AVIStreamLength,[esi].pAVIStream
.if eax==-1
invoke PERR
.endif
mov [esi].totalframe,eax
invoke AVIStreamGetFrameOpen,[esi].pAVIStream,0; AVIGETFRAMEF_BESTDISPLAYFMT << change this to 0 and its working
.if eax!=NULL
mov [esi].pGetFrameObject,eax
.else
invoke PERR
.endif
assume esi:nothing
ret
fAviFileOpen endp
I make it working. Have fun of this code.