开发者

Getting multiple video renderers in directshow.net in c#

I have 4 separate video devices connected to their respective video renderers and I'd like to show the video renderers in 4 separate windows/panels.

With the

IVideoWindow GetSecondRenderer()
    {
        IEnumFilters enumFilters;
        ArrayList filtersArray = new ArrayList();

        IFilterGraph filterGraph = (IFilterGraph)m_FilterGraph;
        filterGraph.EnumFilters(out enumFilters);

        IBaseFilter[] filters = new IBaseFilter[1];
        IntPtr fetched = new IntPtr();

        while (enumFilters.Next(1, filters,fetched) == 0)
        {
            IVideoWindow ivw = filters[0] as IVideoWindow;
            if (ivw != null)
            {
                IntPtr outPtr = new IntPtr();
                ivw.get_Owner(out outPtr);
                if (outPtr == IntPtr.Zero)开发者_如何学运维
                    return ivw;
            }
        }
        return null;
    }

and then using videoWindow2 = GetSecondRenderer(); code I managed to get 2 videos to show,but as I'm still very new to this I can't seem to enumerate the other 2 video renderes. Could someone help with showing how to modify this to be able to get the other 2? Thank you.


Your code just returns first found video renderer. Instead of returning from the while loop make a list of IVideoWindows and add found renderers to it. Then, when the loop finishes, return whole list.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜