简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM