我使用Video Processing Project中的过滤器,并希望设置过滤器的设置。在c ++中,它通过ISettingsInterface工作。
ISettingsInterface * pSettingsInterface = NULL;
pRotateFilter->QueryInterface ( IID_ISettingsInterface, ( void ** ) &pSettingsInterface );
hr = pSettingsInterface->SetParameter ( "rotationmode", "3" );
hr = g_pGraph->AddFilter ( pRotateFilter, L"RotateFilter" );
在DirectShowlib c#wrappers中没有这样的界面?过滤器上也没有QueryInterface
功能。
答案 0 :(得分:0)
我通过声明界面来解决它:
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,Guid("388EEF20-40CC-4752-A0FF-66AA5C4AF8FA"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISettingsInterface
{
[PreserveSig]
int GetParameter(
[MarshalAs(UnmanagedType.LPStr)] String type,
[MarshalAs(UnmanagedType.I4)] int buffersize,
[In, Out, MarshalAs(UnmanagedType.LPStr)] String value,
[In, Out, MarshalAs(UnmanagedType.I4)] ref int length
);
[PreserveSig]
int SetParameter(
[MarshalAs(UnmanagedType.LPStr)] String type,
[MarshalAs(UnmanagedType.LPStr)] String value
);
[PreserveSig]
int GetParameterSettings(
[MarshalAs(UnmanagedType.LPStr)] ref String szResult,
[In] int nSize
);
}