Showing a captured video in multiple windows
- From: "jbessow" <jbessow@xxxxxxxxx>
- Date: 11 May 2006 14:47:38 -0700
Hi,
I'm trying to use a camera to capture video in real time and show it in
more than one window.
All posts that I read about it recommended to use "Infinite Tee" but no
examples.
This code below is all that I got. Just the original video is displayed
in his own window. I want to show one more window with the same video
in real time.
I think that I'm not connecting the pins correctly.
Can anyone help me with it?
If someone has some source code (any language) as example, I will be
very grateful.
Thanks a lot!
Jonatas Bessow
//--------------------------------------------------------------------------------------
public IBaseFilter FindCaptureDevice(){
int hr = 0;
UCOMIEnumMoniker classEnum = null;
UCOMIMoniker[] moniker = new UCOMIMoniker[1];
object source = null;
// Create the system device enumerator
ICreateDevEnum devEnum = (ICreateDevEnum) new CreateDevEnum();
// Create an enumerator for the video capture devices
hr = devEnum.CreateClassEnumerator(FilterCategory.VideoInputDevice,
out classEnum, 0);
DsError.ThrowExceptionForHR(hr);
// The device enumerator is no more needed
Marshal.ReleaseComObject(devEnum);
if (classEnum == null)
throw new ApplicationException("No video capture device was
detected");
int i;
if (classEnum.Next (moniker.Length, moniker, out i) == 0) {
// Bind Moniker to a filter object
Guid iid = typeof(IBaseFilter).GUID;
moniker[0].BindToObject(null, null, ref iid, out source);
}
else { throw new ApplicationException("Unable to access video capture
device!");}
// Release COM objects
Marshal.ReleaseComObject(moniker[0]);
Marshal.ReleaseComObject(classEnum);
// An exception is thrown if cast fail
return (IBaseFilter) source;
}
IVideoWindow GetSecondRenderer() {
IEnumFilters enumFilters;
ArrayList filtersArray = new ArrayList();
IFilterGraph filterGraph = (IFilterGraph)fg;
filterGraph.EnumFilters(out enumFilters);
IBaseFilter[] filters = new IBaseFilter[1];
int fetched;
while(enumFilters.Next(1, filters, out 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;
}
.
- Follow-Ups:
- Re: Showing a captured video in multiple windows
- From: lgs.lgs
- Re: Showing a captured video in multiple windows
- Prev by Date: Re: Is WM Player built on DirectShow?
- Next by Date: HELP with error C1189: Need to include strsafe.h after tchar.h
- Previous by thread: Problem with media types in a filter, HELP
- Next by thread: Re: Showing a captured video in multiple windows
- Index(es):
Relevant Pages
|