-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various problems... #25
Comments
Hi,
|
Thank you very much for your answer, it is much useful! You are quite generous. Now I still have a few other things.
When we call it, we need to pass IntPtr.Zero as the second parameter.
I saw on the following page that you already studied the subject: https://stackoverflow.com/questions/49323410/com-interop-and-marshaling-of-variantvt-ptr Did you do something for this in DirectN, maybe I did not find it? |
Hi,
You can use GetObjectForNativeVariant to convert from IntPtr into an object and the opposite: GetNativeVariantForObject |
Thank you Simon!
However, it appears that it is not simple to deal with the
variant variables, when I read the following three-part article: Using
VARIANTs in Managed Code Part 1 | limbioliong (wordpress.com)
<https://limbioliong.wordpress.com/2011/09/04/using-variants-in-managed-code-part-1/>
Le mar. 7 déc. 2021 à 14:38, Simon Mourier ***@***.***> a
écrit :
… Hi,
1.
true. This is a bug in the .h declaration of SetCurrentMediaType in
the Windows SDK. The annotation specifies it as [out][in], not optional, so
the generator doesn't generate an IntPtr where it should... I've fixed the
.cs.
2.
VARIANTs are normally handled by the .NET (this is *not* the case with
PROPVARIANTs). The SO post is very specific as the VARIANT used there was
an invalid one.
You can use GetObjectForNativeVariant
<https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.getobjectfornativevariant>
to convert from IntPtr into an object and the opposite: GetNativeVariantForObject
<https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.getobjectfornativevariant>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADJJUEHP6SLFVRYTWOE6E53UPZPERANCNFSM5JKD3EKA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
From .NET this is fairly simple, just use the functions and ask again if you face any real issue. |
Here is the code I'm trying to use:
But the value I get for intPtrQualité is 0x0000000000000013 and I get an execution Engine Exception... |
That may be an issue with ICodecAPI definition, the most simple way is to redefine it like this:
|
Closing due to inactivity |
Thank you for your last correction! I was able to progress in my test of DirectN.
CColorConvertDMO (CLSID_CColorConvertDMO)
Guids are missing like: CODECAPI_AVEncCommonQuality
This enum of DirectN is far from user friendly:
public enum __MIDL___MIDL_itf_mfreadwrite_0000_0001_0001 { MF_SOURCE_READER_INVALID_STREAM_INDEX = -1, MF_SOURCE_READER_ALL_STREAMS = -2, MF_SOURCE_READER_ANY_STREAM = -2, MF_SOURCE_READER_FIRST_AUDIO_STREAM = -3, MF_SOURCE_READER_FIRST_VIDEO_STREAM = -4, MF_SOURCE_READER_MEDIASOURCE = -1, }
Functions.MFGetAttributeRatio(pType, MFConstants.MF_MT_FRAME_RATE_RANGE_MAX, out uint frameRateNum, out uint frameRateDem).ThrowOnError();
I get the error:
System.EntryPointNotFoundException : 'Unable to find an entry point named 'MFGetAttributeRatio' in DLL 'mfplat'.'
public Guid __uuidof<T>() { var attribs = Attribute.GetCustomAttributes(typeof(T), typeof(GuidAttribute)); foreach (GuidAttribute attrib in attribs) { if (attrib.GetType() == typeof(GuidAttribute)) return new Guid(attrib.Value); } return new Guid(); }
The text was updated successfully, but these errors were encountered: