Reconnect Directshow Filter Pin

故事扮演 提交于 2019-12-11 18:43:55

问题


How to reconnect Filter Pins?

I created a resizer filter (c++) and added a property page with options Pal(720X576) and Ntsc(720X480).(default is Pal).

In Graph Edit i selected a video file and added My resizer filter to it, when i played the graph it is working fine and showing video in Pal. when i tried to change it to Ntsc, it is not working correctly. To make it work correctly i need to first disconnect the Resizer filter pins and then change the output settings and then reconnect it.(i do this manually and video is playing in Ntsc mode.)

is it possible to reconnect the filter in Transform() or any other better suggestions. Please suggest/Point me in rite direction.


回答1:


While the graph is stopped, you can reconnect pins the same way you build the graph: using IGraphBuilder::Disconnect, IGraphBuilder::Connect. You cannot do it from Transform method because stopped graph does not yet call it.

When the graph is running you can try to dynamically re-agree media type connection, which is not guaranteed to work. See Dynamic Format Changes:

When a filter switches media types, it is called a dynamic format change. If you are writing a DirectShow filter, you should be aware of the mechanisms for dynamic format changes. Even if your filter does not support such changes, it should respond correctly if another filter requests a new format.



来源:https://stackoverflow.com/questions/14556941/reconnect-directshow-filter-pin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!