JFKs AVI decls

Blitz3D Forums/Blitz3D Programming/JFKs AVI decls

Doggie(Posted 2008) [#1]
Can someone post a link to the actual decls files. I tried to make them from the code but they don't work.
Appreciate it.

The "save AVI with sound" in archives


jfk EO-11110(Posted 2008) [#2]
What exactly didn't work?

Save the following as a textfile named "avifil32.decls":

.lib "avifil32.dll"
AVIFileInit%()
AVIFileOpen%(ppfile*,szFile$,uMode%,lpHandler%)
AVIFileRelease%(pfile%)
AVIFileInfo%(pfile%,pfi*,lSize%)
AVIFileGetStream%(pfile%,ppavi*,fccType%,lParam%)
AVIFileExit%()
AVIFileCreateStream%(pfile%, ppavi*, psi*)
AVIStreamInfo%(pStream%,pfi*,lSize%)
AVIStreamStart%(pavi%)
AVIStreamRelease%(pavi%)
AVIStreamLength%(pavi%)
AVIStreamGetFrameOpen%(pavi%,lpbiWanted%)
AVIStreamGetFrame%(pFrame%,index%)
AVIStreamGetFrameClose%(pFrame%)
AVIStreamReadFormat%(pavi%, lPos%, lpFormat%, lpcbFormat*)
AVIStreamSetFormat%(pavi%, lPos%, lpFormat*, cbFormat%)
AVIStreamRead%(pavi%, lStart%, lSamples%, lpBuffer%, cbBuffer%, plBytes*, plSamples*)
AVIStreamWrite%(pavi%, lStart%, lSamples%, lpBuffer*, cbBuffer%, dwflags%, plSampWritten%, plBytesWritten%)
AVISaveOptions%(hwnd%, uiFlags%, nStreams%, ppavi*, plpOptions*)
AVISaveOptionsFree%(nstreams%, plpOptions*)
AVIMakeCompressedStream%(ppsCompressed*, psSource%, lpOptions%, pclsidHandler%)

As well as a textfile named "kernel32.decls":

.lib "kernel32.dll"
RtlMoveMemory2%(Destination*,Source,Length) : "RtlMoveMemory"

If you already got one of these files in your userlibs folder, then you may have to add the missing commands to it. In case of incompatible use of certain commands (that were already declared by older programs and that may be the cause of problems) I suggest you rename the functions in my decls as well as in my bb source like this (use Search and Replace functions)

the line:
AVIFileInit%()
will become
jfk_AVIFileInit%() : "AVIFileInit"

Do this with all declaration lines.

you see I have this new "jfk_" prefix that makes it unique. but now we need to tell Windows the original Name of the function ( : "AVIFileInit") in the decls file.

In the kernel32.decls the
RtlMoveMemory2%(Destination*,Source,Length) : "RtlMoveMemory"
already has this original function name, so it would become:
jfk_RtlMoveMemory2%(Destination*,Source,Length) : "RtlMoveMemory"

As I already mentioned, you also need to edit the function calls in the Blitz Soucecode.

If this is all done then it really should work (unless there is a new XP or Vista Feature that stops it from running)


Doggie(Posted 2008) [#3]
My kernel32.decls file had the function mistyped. It's working now. Thanks!


4pac(Posted 2008) [#4]
I wonder if you can help me... when I try to execute the code in b3d, the program hangs up at the lines

If AVISaveOptions(hwnd, 3, 1, ret, plpOptionsList)=1 ;=0
res=AVIMakeCompressedStream(compression_handle, stream_handle, PeekInt(plpOptionsList,0), 0)

Thatīs around 20 lines before the end of function OpenWriteAvi(). I found out this particular line by placing a lot of debugging marks with waitkey() before and after.

I have to terminate the programm using the XP task manager. An empty avi file is generated. I put the dll and decls files into the userlib folder, think thereīs nothing wrong about that. What could I be doing wrong?