当前位置: 首页>>代码示例>>C#>>正文


C# IBaseFilter类代码示例

本文整理汇总了C#中IBaseFilter的典型用法代码示例。如果您正苦于以下问题:C# IBaseFilter类的具体用法?C# IBaseFilter怎么用?C# IBaseFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IBaseFilter类属于命名空间,在下文中一共展示了IBaseFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConnectFilter

 private static bool ConnectFilter(IFilterGraph2 graphBuilder, IBaseFilter networkFilter, IBaseFilter tunerFilter)
 {
   IPin pinOut = DsFindPin.ByDirection(networkFilter, PinDirection.Output, 0);
   IPin pinIn = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
   int hr = graphBuilder.Connect(pinOut, pinIn);
   return (hr == 0);
 }
开发者ID:Yura80,项目名称:MediaPortal-1,代码行数:7,代码来源:TvCardCollection.cs

示例2: Hauppauge

    //Initializes the Hauppauge interfaces

    /// <summary>
    /// Constructor: Require the Hauppauge capture filter, and the deviceid for the card to be passed in
    /// </summary>
    public Hauppauge(IBaseFilter filter, string tuner)
    {
      try
      {
        //Don't create the class if we don't have any filter;

        if (filter == null)
        {
          return;
        }

        //Load Library
        hauppaugelib = LoadLibrary("hauppauge.dll");

        //Get Proc addresses, and set the delegates for each function
        IntPtr procaddr = GetProcAddress(hauppaugelib, "Init");
        _Init = (Init)Marshal.GetDelegateForFunctionPointer(procaddr, typeof (Init));

        procaddr = GetProcAddress(hauppaugelib, "DeInit");
        _DeInit = (DeInit)Marshal.GetDelegateForFunctionPointer(procaddr, typeof (DeInit));

        procaddr = GetProcAddress(hauppaugelib, "IsHauppauge");
        _IsHauppauge = (IsHauppauge)Marshal.GetDelegateForFunctionPointer(procaddr, typeof (IsHauppauge));

        procaddr = GetProcAddress(hauppaugelib, "SetVidBitRate");
        _SetVidBitRate = (SetVidBitRate)Marshal.GetDelegateForFunctionPointer(procaddr, typeof (SetVidBitRate));

        procaddr = GetProcAddress(hauppaugelib, "GetVidBitRate");
        _GetVidBitRate = (GetVidBitRate)Marshal.GetDelegateForFunctionPointer(procaddr, typeof (GetVidBitRate));

        procaddr = GetProcAddress(hauppaugelib, "SetAudBitRate");
        _SetAudBitRate = (SetAudBitRate)Marshal.GetDelegateForFunctionPointer(procaddr, typeof (SetAudBitRate));

        procaddr = GetProcAddress(hauppaugelib, "GetAudBitRate");
        _GetAudBitRate = (GetAudBitRate)Marshal.GetDelegateForFunctionPointer(procaddr, typeof (GetAudBitRate));

        procaddr = GetProcAddress(hauppaugelib, "SetStreamType");
        _SetStreamType = (SetStreamType)Marshal.GetDelegateForFunctionPointer(procaddr, typeof (SetStreamType));

        procaddr = GetProcAddress(hauppaugelib, "GetStreamType");
        _GetStreamType = (GetStreamType)Marshal.GetDelegateForFunctionPointer(procaddr, typeof (GetStreamType));

        procaddr = GetProcAddress(hauppaugelib, "SetDNRFilter");
        _SetDNRFilter = (SetDNRFilter)Marshal.GetDelegateForFunctionPointer(procaddr, typeof (SetDNRFilter));

        //Hack
        //The following is strangely necessary when using delegates instead of P/Invoke - linked to MP using utf-8
        //Hack

        byte[] encodedstring = Encoding.UTF32.GetBytes(tuner);
        string card = Encoding.Unicode.GetString(encodedstring);

        hr = new HResult(_Init(filter, card));
        Log.Log.WriteFile("Hauppauge Quality Control Initializing " + hr.ToDXString());
      }
      catch (Exception ex)
      {
        Log.Log.WriteFile("Hauppauge Init failed " + ex.Message);
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:65,代码来源:Hauppauge.cs

示例3: Create

        public void Create(ref string strAVIin, ref string strAVIout, ref string strDevice, ref string strPinOut, ref IBaseFilter pRen)
        {
            var hr = 0;
            _class.Debug.Log("");
            _class.Debug.Log("Creating AVI renderer");
            var pAviDecompressor = (IBaseFilter) new AVIDec();
            hr = _class.Graph.CaptureGraph.AddFilter(pAviDecompressor, "AVI Decompressor");
            _class.Debug.Log("-> " + DsError.GetErrorText(hr));

            _class.GraphPin.ListPin(pAviDecompressor);
            strAVIin = _class.GraphPin.AssumePinIn("XForm");
            strAVIout = _class.GraphPin.AssumePinOut("XForm");

            _class.Debug.Log("");
            _class.Debug.Log("***   Connect " + strDevice + " (" + strPinOut + ") to AVI Decompressor (" + strAVIin + ")");
            hr = _class.Graph.CaptureGraph.ConnectDirect(_class.GraphPin.GetPin(pRen, strPinOut), _class.GraphPin.GetPin(pAviDecompressor, strAVIin), null);
            if (hr == 0)
            {
                _class.Debug.Log("[OK] Connected " + strDevice + " to AVI Decompressor");
                pRen = pAviDecompressor;
                strDevice = "AVI Decompressor";
                strPinOut = strAVIout;
            }
            else
            {
                _class.Debug.Log("[FAIL] Can't connected " + strDevice + " to AVI Decompressor. May interrupt operation");

            }
        }
开发者ID:Nefylem,项目名称:consoleXstream,代码行数:29,代码来源:AviRender.cs

示例4: BuildGraph

        private void BuildGraph(string fileName)
        {
            int hr = 0;

             try
             {
                 graphBuilder = (IFilterGraph2)new FilterGraph();
                 mediaControl = (IMediaControl)graphBuilder;

                 mediaSeeking = (IMediaSeeking)graphBuilder;
                 mediaPosition = (IMediaPosition)graphBuilder;

                 vmr9 = (IBaseFilter)new VideoMixingRenderer9();

                 ConfigureVMR9InWindowlessMode();

                 hr = graphBuilder.AddFilter(vmr9, "Video Mixing Renderer 9");
                 DsError.ThrowExceptionForHR(hr);

                 hr = graphBuilder.RenderFile(fileName, null);
                 DsError.ThrowExceptionForHR(hr);
             }
             catch (Exception e)
             {
                 CloseInterfaces();
                 MessageBox.Show("An error occured during the graph building : \r\n\r\n" + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
        }
开发者ID:andrewjswan,项目名称:mvcentral,代码行数:28,代码来源:framegrabber.cs

示例5: PinInfo

 /// <summary>
 /// Erzeugt eine neue Beschreibung.
 /// </summary>
 /// <param name="direction">Die Übertragunsrichtung des Endpunktes.</param>
 /// <param name="name">Der eindeutige Name des Endpunktes.</param>
 /// <param name="filter">Der Filter, zu dem dieser Endpunkt gehört.</param>
 public PinInfo( PinDirection direction, string name, IBaseFilter filter )
 {
     // Remember all
     Filter = Marshal.GetComInterfaceForObject( filter, typeof( IBaseFilter ) );
     Direction = direction;
     Name = name;
 }
开发者ID:davinx,项目名称:DVB.NET---VCR.NET,代码行数:13,代码来源:PinInfo.cs

示例6: ViXSATSC

 /// <summary>
 /// Initializes a new instance of the <see cref="ViXSATSC"/> class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 public ViXSATSC(IBaseFilter tunerFilter)
 {
   IPin pin = DsFindPin.ByName(tunerFilter, "MPEG2 Transport");
   if (pin != null)
   {
     _propertySet = tunerFilter as IKsPropertySet;
     if (_propertySet != null)
     {
       KSPropertySupport supported;
       _propertySet.QuerySupported(guidViXSTunerExtention, (int)BdaDigitalModulator.MODULATION_TYPE, out supported);
       if ((supported & KSPropertySupport.Set) != 0)
       {
         Log.Log.Debug("ViXS ATSC: DVB-S card found!");
         _tempValue = Marshal.AllocCoTaskMem(1024);
         _isViXSATSC = true;
       }
       else
       {
         Log.Log.Debug("ViXS ATSC: card NOT found!");
         _isViXSATSC = false;
       }
     }
   }
   else
     Log.Log.Info("ViXS ATSC: could not find MPEG2 Transport pin!");
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:30,代码来源:ViXSATSC.cs

示例7: GetPin

        /// <summary>
        /// Get filter's pin.
        /// </summary>
        /// 
        /// <param name="filter">Filter to get pin of.</param>
        /// <param name="dir">Pin's direction.</param>
        /// <param name="num">Pin's number.</param>
        /// 
        /// <returns>Returns filter's pin.</returns>
        /// 
        public static IPin GetPin( IBaseFilter filter, PinDirection dir, int num )
        {
            IPin[] pin = new IPin[1];
            IEnumPins pinsEnum = null;

            // enum filter pins
            if ( filter.EnumPins( out pinsEnum ) == 0 )
            {
                PinDirection pinDir;
                int n;

                // get next pin
                while ( pinsEnum.Next( 1, pin, out n ) == 0 )
                {
                    // query pin`s direction
                    pin[0].QueryDirection( out pinDir );

                    if ( pinDir == dir )
                    {
                        if ( num == 0 )
                            return pin[0];
                        num--;
                    }

                    Marshal.ReleaseComObject( pin[0] );
                    pin[0] = null;
                }
            }
            return null;
        }
开发者ID:Tob1112,项目名称:405sentry,代码行数:40,代码来源:Tools.cs

示例8: Run

        public static void Run()
        {
            var fg = FilterGraph.Create();
            var mc = (IMediaControl)fg;
            var me = (IMediaEvent)fg;
            fg.RenderFile("c:\\test.mp3", IntPtr.Zero);

            IEnumFilters ief;
            var filters = new IBaseFilter[8];
            fg.EnumFilters(out ief);
            int fetched;
            ief.Next(8, filters, out fetched);

            for (int i = 0; i < fetched; i++)
            {
                var ibf = filters[i];
                FilterInfo fi;
                ibf.QueryFilterInfo(out fi);
                string vendorInfo = "";
                try
                {
                    ibf.QueryVendorInfo(out vendorInfo);
                }
                catch (Exception)
                {
                }
                Console.WriteLine(fi.Name + " " + vendorInfo);
            }

            Console.ReadLine();
        }
开发者ID:cyruslopez,项目名称:Floe,代码行数:31,代码来源:Test.cs

示例9: GenericATSC

 /// <summary>
 /// Initializes a new instance of the <see cref="GenericATSC"/> class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 public GenericATSC(IBaseFilter tunerFilter)
 {
   IPin pin = DsFindPin.ByName(tunerFilter, "MPEG2 Transport");
   if (pin != null)
   {
     _propertySet = pin as IKsPropertySet;
     if (_propertySet != null)
     {
       KSPropertySupport supported;
       _propertySet.QuerySupported(guidBdaDigitalDemodulator, (int)BdaDigitalModulator.MODULATION_TYPE, out supported);
       if ((supported & KSPropertySupport.Set) != 0)
       {
         Log.Log.Debug("GenericATSC: QAM capable card found!");
         _isGenericATSC = true;
         _tempValue = Marshal.AllocCoTaskMem(1024);
         _tempInstance = Marshal.AllocCoTaskMem(1024);
       }
       else
       {
         Log.Log.Debug("GenericATSC: QAM card NOT found!");
         _isGenericATSC = false;
       }
     }
   }
   else
     Log.Log.Info("GenericATSC: tuner pin not found!");
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:31,代码来源:GenericATSC.cs

示例10: TBSDVBS2Handler

        internal TBSDVBS2Handler(IBaseFilter tunerFilter, Tuner tuner)
        {
            if (!tuner.Name.ToUpperInvariant().Contains("TBS"))
                return;

            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
            if (pin != null)
            {
                propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    reply = propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_NBC_PARAMS, out supported);
                    if (reply == 0)
                    {
                        dvbs2Capable = (supported & KSPropertySupport.Get) == KSPropertySupport.Get || (supported & KSPropertySupport.Set) == KSPropertySupport.Set;

                        if (dvbs2Capable)
                        {
                            useSet = (supported & KSPropertySupport.Set) == KSPropertySupport.Set;
                            useGet = !useSet;
                        }
                    }
                }
            }
        }
开发者ID:esurharun,项目名称:TSDumper,代码行数:26,代码来源:TBSDVBS2Handler.cs

示例11: Hauppauge

 /// <summary>
 /// Initializes a new instance of the <see cref="Hauppauge"/> class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 public Hauppauge(IBaseFilter tunerFilter)
 {
   IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
   if (pin != null)
   {
     _propertySet = pin as IKsPropertySet;
     if (_propertySet != null)
     {
       KSPropertySupport supported;
       _propertySet.QuerySupported(BdaTunerExtentionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC,
                                   out supported);
       if ((supported & KSPropertySupport.Set) != 0)
       {
         Log.Log.Debug("Hauppauge: DVB-S card found!");
         _isHauppauge = true;
         _ptrDiseqc = Marshal.AllocCoTaskMem(1024);
         _tempValue = Marshal.AllocCoTaskMem(1024);
         _tempInstance = Marshal.AllocCoTaskMem(1024);
       }
       else
       {
         Log.Log.Debug("Hauppauge: DVB-S card NOT found!");
         _isHauppauge = false;
         Dispose();
       }
     }
   }
   else
     Log.Log.Info("Hauppauge: tuner pin not found!");
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:34,代码来源:Hauppauge.cs

示例12: ConnectFilter

        public static int ConnectFilter(IGraphBuilder graph, IBaseFilter up, IBaseFilter down)
        {
            IPin pinSrc  = null;
            int i = 0;
            while ( (pinSrc = DsFindPin.ByDirection(up, PinDirection.Output, i++) ) != null )
            {
                IPin pinDest = null;
                int j = 0;
                while((pinDest = DsFindPin.ByDirection(down, PinDirection.Input, j++)) != null)
                {
                    try
                    {
                        ConnectFilters(graph, pinSrc, pinDest, true);
                    }
                    catch(Exception e)
                    {
                        Marshal.FinalReleaseComObject(pinDest);
                        continue;
                    }
                    //�ɹ�
                    Marshal.FinalReleaseComObject(pinSrc);
                    Marshal.FinalReleaseComObject(pinDest);
                    return 0;
                }
                Marshal.FinalReleaseComObject(pinSrc);
            }

            return -1;
        }
开发者ID:crazyender,项目名称:Console-Player,代码行数:29,代码来源:Interface.cs

示例13: TwinhanDVBS2Handler

        public TwinhanDVBS2Handler(IBaseFilter filter)
        {
            captureFilter = filter;

            if (filter != null)
                dvbs2Capable = checkTwinhanInterface();
        }
开发者ID:esurharun,项目名称:TSDumper,代码行数:7,代码来源:TwinhanDVBS2Handler.cs

示例14: SetupAudio

        protected virtual void SetupAudio()
        {
            int hr;

            IEnumFilters enumFilters;
            hr = _graph.EnumFilters(out enumFilters);
            DsError.ThrowExceptionForHR(hr);

            IBaseFilter[] filters = new IBaseFilter[1];
            IntPtr fetched = new IntPtr();

            while (enumFilters.Next(1, filters, fetched) == 0)
            {
                IBaseFilter filter = filters[0] as IBaseFilter;
                IPin unconnectedPin = DsFindPin.ByConnectionStatus((IBaseFilter)filter, PinConnectedStatus.Unconnected, 0);
                if (unconnectedPin != null)
                {
                    PinDirection direction;
                    hr = unconnectedPin.QueryDirection(out direction);
                    DsError.ThrowExceptionForHR(hr);

                    if (direction == PinDirection.Output)
                    {
                        hr = _graph.Render(unconnectedPin);
                        DsError.ThrowExceptionForHR(hr);

                        SetupSampleGrabber();
                    }
                }
            }
        }
开发者ID:Inner-room,项目名称:VrPlayer,代码行数:31,代码来源:MediaGraphPlayer.cs

示例15: createSmartTee

        public void createSmartTee(ref string strPreviewIn, ref string strPreviewOut, ref string strDevice, ref string strPinOut, ref IBaseFilter pRen)
        {
            int hr = 0;
            _class.Debug.Log("");
            _class.Debug.Log("Creating SmartTee Preview Filter");

            IBaseFilter pSmartTee2 = (IBaseFilter)new DirectShowLib.SmartTee();
            hr = _class.Graph.CaptureGraph.AddFilter(pSmartTee2, "Smart Tee");
            _class.Debug.Log(DsError.GetErrorText(hr));
            _class.Debug.Log("");

            _class.GraphPin.ListPin(pSmartTee2);
            strPreviewIn = _class.GraphPin.AssumePinIn("Input");
            strPreviewOut = _class.GraphPin.AssumePinOut("Preview");

            _class.Debug.Log("");
            _class.Debug.Log("***   Connect " + strDevice + " (" + strPinOut + ") to SmartTee Preview Filter (" + strPreviewIn + ")");
            hr = _class.Graph.CaptureGraph.ConnectDirect(_class.GraphPin.GetPin(pRen, strPinOut), _class.GraphPin.GetPin(pSmartTee2, strPreviewIn), null);
            if (hr == 0)
            {
                _class.Debug.Log("[OK] Connected " + strDevice + " to SmartTee Preview Filter");
                strDevice = "SmartTee Preview Filter";
                pRen = pSmartTee2;
                strPinOut = strPreviewOut;
            }
            else
            {
                _class.Debug.Log("[NG] cant Connect " + strDevice + " to Preview Filter. Attempting to continue without preview");
                _class.Debug.Log("-> " + DsError.GetErrorText(hr));
            }
        }
开发者ID:Nefylem,项目名称:consoleXstream,代码行数:31,代码来源:SmartTee.cs


注:本文中的IBaseFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。