directshow中IFilterGraph::Disconnect和IEnumFilters::Next

 
Living with you!
欢迎转载
http://blog.csdn.net/livingpark
Living Park

使用智能连接建立了文件播放的链路,要断开其中两个filter,在之间插入另一个filter,先找到前面的filter对其使用IFilterGraph::Disconnect断开连接,然后连接前面filter和要插入的filter成功,接下来连接要插入的filter和后面filter时总是出错(连接失败),最后从文档中找到了对IFilterGraph::Disconnect的描述:
This method does not completely break the connection. To completely break the connection, both ends must be disconnected.
原来如此,开始以为disconnect后两个filter就断开了,要两个全断开才行,加入断开后面filter后运行成功。

要在枚举filter的while循环中(其中使用EnumFilters::Next)加入一个filter,结果发现循环只运行一次就退出,后从文档中找到对EnumFilters::Next的描述:
If the filter graph changes (for example, the application removes a filter), the enumerator is no longer be consistent with the graph, and the method returns VFW_E_ENUM_OUT_OF_SYNC. Discard any data obtained from previous calls to the enumerator, because it might be invalid.
原来在枚举的过程中不能改变Graph,添加、删除filter等都不可以,将加入filter的功能分离出去单独进行就可以了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值