/// <summary>
        /// Luoz: 创建用户选择的设备设备
        /// </summary>
        bool CreateCaptureDevice(IMoniker mon)
        {
            object capObj = null;

            try
            {
                Guid gbf = typeof(prp.IBaseFilter).GUID;
                mon.BindToObject(null, null, ref gbf, out capObj);
                capFilter = (prp.IBaseFilter)capObj; capObj = null;
                return(true);
            }
            catch (Exception ee)
            {
                MessageBox.Show(this, "Could not create capture device\r\n" + ee.Message, "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }
            finally
            {
                if (capObj != null)
                {
                    Marshal.ReleaseComObject(capObj);
                }
                capObj = null;
            }
        }
        /// <summary>
        /// Luoz: build the capture graph
        /// </summary>
        /// <returns></returns>
        bool SetupGraph()
        {
            int hr;

            prp.IBaseFilter     mux  = null;
            prp.IFileSinkFilter sink = null;

            try
            {
                hr = capGraph.SetFiltergraph(graphBuilder);
                if (hr < 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                hr = graphBuilder.AddFilter(capFilter, "Ds.NET Video Capture Device");
                if (hr < 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                prp.DsUtils.ShowCapPinDialog(capGraph, capFilter, this.Handle);

                Guid sub = prp.MediaSubType.Avi;
                hr = capGraph.SetOutputFileName(ref sub, fileName, out mux, out sink);
                if (hr < 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                Guid cat = prp.PinCategory.Capture;
                Guid med = prp.MediaType.Video;
                hr = capGraph.RenderStream(ref cat, ref med, capFilter, null, mux); // stream to file
                if (hr < 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                cat = prp.PinCategory.Preview;
                med = prp.MediaType.Video;
                hr  = capGraph.RenderStream(ref cat, ref med, capFilter, null, null); // preview window
                if (hr < 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                return(true);
            }
            catch (Exception ee)
            {
                MessageBox.Show(this, "Could not setup graph\r\n" + ee.Message, "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }
            finally
            {
                if (mux != null)
                {
                    Marshal.ReleaseComObject(mux);
                }
                mux = null;
                if (sink != null)
                {
                    Marshal.ReleaseComObject(sink);
                }
                sink = null;
            }
        }
 /// <summary>
 /// Luoz: �����û�ѡ����豸�豸
 /// </summary>
 bool CreateCaptureDevice(IMoniker mon)
 {
     object capObj = null;
     try
     {
         Guid gbf = typeof(prp.IBaseFilter).GUID;
         mon.BindToObject(null, null, ref gbf, out capObj);
         capFilter = (prp.IBaseFilter)capObj; capObj = null;
         return true;
     }
     catch (Exception ee)
     {
         MessageBox.Show(this, "Could not create capture device\r\n" + ee.Message, "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         return false;
     }
     finally
     {
         if (capObj != null)
             Marshal.ReleaseComObject(capObj); capObj = null;
     }
 }