Multimedia AviFil32: bug with passing AVICOMPRESSOPTIONS[] plpOptions
See original GitHub issueThere is a bug with how the AVICOMPRESSOPTIONS are passed to the AVISaveOptions, AVISaveOptionsFree and AVISaveOptionsFree functions. They are passed directly as an array of structs which causes a crash. As stated in the description, they should be passed as an array of pointers.
Pointer to an array of pointers to AVICOMPRESSOPTIONS structures. These structures hold the compression options set by the dialog box. The nStreams parameter indicates the number of pointers in the array.
I’m not sure what the most elegant way to fix this is, but I’ve confirmed that it works when the following signature is used instead:
[DllImport("avifil32.dll")]
public static extern unsafe bool AVISaveOptions(
HWND hwnd,
ICMF_CHOOSE uiFlags,
int nStreams,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface, SizeParamIndex = 2)] IAVIStream[] ppavi,
AVICOMPRESSOPTIONS** plpOptions);
And for instance a single AVICOMPRESSOPTIONS passed like this:
AVICOMPRESSOPTIONS opts = new AVICOMPRESSOPTIONS();
opts.fccType = streamtypeVIDEO;
AVICOMPRESSOPTIONS* optionsPtr = &opts;
AVICOMPRESSOPTIONS** optionsPtrPtr = &optionsPtr;
AVISaveOptions(IntPtr.Zero, Avi.ICMF_CHOOSE.ICMF_CHOOSE_KEYFRAME | Avi.ICMF_CHOOSE.ICMF_CHOOSE_DATARATE, 1, streams, optionsPtrPtr);
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
AVICOMPRESSOPTIONS structure (vfw.h) - Win32
This structure passes data to the AVIMakeCompressedStream function (or the AVISave function, which uses AVIMakeCompressedStream). Syntax. C++
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for your work. Trying to create a small snippet, I’ve noticed that there also seem to be some other problems with your AviFil32 Wrap.
The following code sometimes creates a working video and sometimes it does not. Sadly I can’t figure out why. Perhaps you have an idea what is going on.
To be honest I’ve just stumbled upon your library, because I ported an old program to .NET 6.0 and had a problem with my old AviFil32 wrap. I’ve managed to solve that problem and will probably stick to my old wrap. In the long run I want to replace AviFil32 all together with a more modern alternative.
OK, I see. Thanks.