已知ax中接口
- C/C++ code
DECLARE_INTERFACE_(INetReceiver, IUnknown){ STDMETHOD(SetStreamType) (THIS_ long inType ) PURE; STDMETHOD(SetSize) (THIS_ long inTotalSize, long inCheckOffset ) PURE; STDMETHOD(SetStreamSocket) (THIS_ SOCKET inSocket ) PURE; STDMETHOD(StartReceiving) (THIS) PURE; STDMETHOD(StopReceiving) (THIS) PURE; STDMETHOD(CanConnectToDownstream) (THIS) PURE;};
我用C#写的调用接口
- C# code
[ComImport, Guid("3F565AA9-3004-4f82-8882-174D51C73332")] public class FilterNetReceiver { } [Guid("8D2AE29A-2783-416c-B40F-790E2FE83267"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ISourceFilter { [PreserveSig] bool SetStreamType(long inType); [PreserveSig] bool SetSize(long inTotalSize, long inCheckOffset); [PreserveSig] bool SetStreamSocket(Socket inSocket); [PreserveSig] bool StartReceiving(); [PreserveSig] bool StopReceiving(); [PreserveSig] bool CanConnectToDownstream(); }
我自己写的C#接口对吗?
主要问题是,C#怎么调用这个sourcefilter?就是IBaseFilter、FilgraphManager、和FilterGraph那一堆,怎么写啊?
------解决方案--------------------------------------------------------
C#没办法使用DShow的接口吧?这个比较困难。
------解决方案--------------------------------------------------------
没有问题可以调用,关键是你要按照C#的语法来
------解决方案--------------------------------------------------------
试试directshowlib, c#封装的directshow.