如何将回调方法与 c++ 一起使用directshow 样本采集器
我有一个示例抓取器连接到我的 directshow 图表中,基于此示例 http://msdn.microsoft.com/en-us/library/dd407288(VS.85).aspx 问题在于它使用一次性和缓冲区。我想不断地获取样本,并且我宁愿有一个回调,也不愿轮询样本。
如何使用SetCallback方法?
SetCallback(ISampleGrabberCB *pCallback, long WhichMethodToCallback)
如何将 pCallback 指向我自己的方法?
I have a sample grabber hooked into my directshow graph, based on this example http://msdn.microsoft.com/en-us/library/dd407288(VS.85).aspx the problem is that it uses one shot and buffers. I want to continuously grab samples, and i'd rather have a callback than i guess polling for the samples.
How do use the SetCallback method?
SetCallback(ISampleGrabberCB *pCallback, long WhichMethodToCallback)
how do I point pCallback to my own method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我来自 ac# 背景,并认为在某种程度上我可以只传递对方法的引用。这似乎并非如此。相反,它要求您创建一个类来实现其接口,该接口定义了它将调用的方法。然后,您可以将类的实例传递给 SetCallback 方法中的过滤器。与委托或 lambda 表达式相比,当然显得冗长
这是一个实现 ISampleGrabberCB 的类的示例
I come from a c# background, and thought that at some level i could just pass a reference to a method. This doesn't seem to be case. Instead it requires you create a class the implements its interface that defines the method that it will call. You then pass an instance of the class to the filter in the SetCallback method. Certainly seems long winded in comparison to a delegate or lambda expression
Here is an example of a class implementing ISampleGrabberCB