Reputation: 365
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.
Upvotes: 0
Views: 1505
Reputation: 1046
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.
Upvotes: 1