簡體   English   中英

在C#中的DirectShow.net中獲取多個視頻渲染器

[英]Getting multiple video renderers in directshow.net in c#

我有4個單獨的視頻設備連接到各自的視頻渲染器,我想在4個單獨的窗口/面板中顯示視頻渲染器。

隨着

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;
    }

然后使用videoWindow2 = GetSecondRenderer(); 代碼我設法顯示了2個視頻,但是由於我對此還很陌生,所以我似乎無法枚舉其他2個視頻渲染。 有人可以幫忙顯示如何修改它以獲取其他2個嗎? 謝謝。

您的代碼僅返回第一個找到的視頻渲染器。 而不是從while循環中返回,而是創建IVideoWindows列表並向其中添加找到的渲染器。 然后,當循環結束時,返回整個列表。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM