AVISaveOptions problems

Archives Forums/Win32 Discussion/AVISaveOptions problems

jfk EO-11110(Posted 2006) [#1]
I am currently trying to make a userlib for Avi export using AVIFil32.dll. It's progressing nicely and I already got the framegrabber working (code archives), so there is some kind of a working basement.

A am able to open the Avi for writing, to create an Avi Stream handle.
Then I call AVISaveOptions. It was a bit tricky, but finally the desired windows video export options messagebox pops up nicely. I can choose a codec etc. Now when I click cancel, the app progresses without error and ends. But when I click OK here, I get a MAV (also in Debug Mode).

This MAV is then one of those endless-loop MAVS you cannot click away because they popup again, right after clicking their ok Button, so I have to kill the task using the taskmanager.

This also happens after a fresh reboot. It seems to me, AVISaveOptions reserves some memory that will be freed in a way that makes troubles in Blitz.

Or maybe there's a problem with the parent hwd that should be defined. Tho I tried the blitz's hwnd, the desktop hwnd and zero, none had an impact on the descibed behaviour.

This is how I call it:

result=AVISaveOptions(hwnd,3,1,ret,plpOptionsList)

3 is the uiFlags, this is double-checked and should work
1 is the number of streams. Seems to be right
ret is a bank that contains the stream handle. seems to be ok.
plpOptionsList is a bank handle. The bank contains bank-data adresses to AVICOMPRESSOPTIONS structures (well, only 1 adress because there is only one stream)
This structure is there ready to retrieve the infos, and the size is surely big enough (44 bytes required, reserved a few thousand while debugging).
One strange thing is: even after the call of the function I still can execute one print command, but no other commands. Printing res to the screen tells me the return value is 1, telling me the codec selection is successful.

Everything seems to work correctly, only there's this special MAV. BTW the MAV is not generated in one of the following commands, it happens somehow when the AVISaveOptions function ends/deallocates. I even added an "End" command right after the function call, it wasn't executed.


BTW The function is correctly declared in AVIFil32.decls:
AVISaveOptions%(hwnd%,uiFlags%,nStreams%,ppavi*,plpOptions*)


If there is any pitfall, trap or trick that I should know, please tell me, thanks.

Oh, yeah, jere's a link to the function description my msdn:
http://msdn.microsoft.com/library/?url=/library/en-us/multimed/htm/_win32_avisaveoptions.asp

although I have to say, there are two contradicting statements:
ppavi
Pointer to an array of stream interface pointers. The
nStreams parameter indicates the number of pointers in the 
array.

and:
The argument ppavi contains the address of a pointer to an
IAVIStream interface.


Isn't it funny, on one page?
well, however, I tried both: a pointer to an array of pointers to handles, and a pointer to a handle, only the second worked and gave me the codec selection box. Of course it still didn't solve the MAV-on-return problem.


jfk EO-11110(Posted 2006) [#2]
Nevermind, this specific problem seems to be solved. When giving the Function a bank handle that contains hacked adresses of further banks, blitz seems to dislike when a dll tries to write to those further banks. At least it could be solved when the bank points to itself, with some offset range.

Now I have other problems to solve (troubles with the bitmapinfoheader).