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


C# IBaseFilter.QueryFilterInfo方法代码示例

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


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

示例1: Filter

        public Filter(IBaseFilter filter)
        {
            BaseFilter = filter;
            BaseFilter.QueryFilterInfo(out GetFilterInfo);
            Streams = new ArrayList { };

            getStreams();
        }
开发者ID:fivesixty,项目名称:StandaloneMB,代码行数:8,代码来源:FilterControl.cs

示例2: DisconnectAllPins

        public static bool DisconnectAllPins(IGraphBuilder graphBuilder, IBaseFilter filter)
        {
            IEnumPins pinEnum;
            int hr = filter.EnumPins(out pinEnum);
            if (hr != 0 || pinEnum == null)
            {
                return false;
            }
            FilterInfo info;
            filter.QueryFilterInfo(out info);

            Marshal.ReleaseComObject(info.pGraph);
            bool allDisconnected = true;
            for (; ; )
            {
                IPin[] pins = new IPin[1];
                IntPtr fetched = IntPtr.Zero;
                hr = pinEnum.Next(1, pins, fetched);
                if (hr != 0 || fetched == IntPtr.Zero)
                {
                    break;
                }
                PinInfo pinInfo;
                pins[0].QueryPinInfo(out pinInfo);
                DsUtils.FreePinInfo(pinInfo);
                if (pinInfo.dir == PinDirection.Output)
                {
                    if (!DisconnectPin(graphBuilder, pins[0]))
                    {
                        allDisconnected = false;
                    }
                }
                Marshal.ReleaseComObject(pins[0]);
            }
            Marshal.ReleaseComObject(pinEnum);
            return allDisconnected;
        }
开发者ID:jiailiuyan,项目名称:WPF-MediaKit,代码行数:37,代码来源:DirectShowUtil.cs

示例3: Name

 public static string Name(IBaseFilter filter)
 {
     _FilterInfo fi;
     filter.QueryFilterInfo(out fi);
     return fi.achName;
 }
开发者ID:psyCHOder,项目名称:conferencexp,代码行数:6,代码来源:Filters.cs

示例4: ChooseFormat

        private void ChooseFormat(IBaseFilter filter)
        {
            IPin pin = GetOutputPin(filter);

            object configObject = pin as IAMStreamConfig;
            var propertyPages = configObject as ISpecifyPropertyPages;
            if (propertyPages == null)
            {
                return;
            }

            FilterInfo filterInfo;
            int hr = filter.QueryFilterInfo(out filterInfo);
            DsError.ThrowExceptionForHR(hr);

            if (filterInfo.pGraph != null)
                Marshal.ReleaseComObject(filterInfo.pGraph);

            DsCAUUID caGuid;
            hr = propertyPages.GetPages(out caGuid);
            DsError.ThrowExceptionForHR(hr);

            try
            {
                hr = NativeMethods.OleCreatePropertyFrame(
                    ownerHandle, 30, 30,
                    filterInfo.achName,
                    1, ref configObject,
                    caGuid.cElems, caGuid.pElems,
                    0, 0,
                    IntPtr.Zero
                    );
                DsError.ThrowExceptionForHR(hr);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                Marshal.FreeCoTaskMem(caGuid.pElems);
            }
        }
开发者ID:alex-chekhachev,项目名称:WebcamCapture.NET,代码行数:43,代码来源:MediaController.cs

示例5: DigitalDevices

    /// <summary>
    /// Initializes a new instance of the <see cref="DigitalDevices"/> class.
    /// </summary>
    /// <param name="tunerFilter">The tuner filter.</param>
    public DigitalDevices(IBaseFilter tunerFilter)
      : base(tunerFilter)
    {
      _CardName = String.Empty;

      FilterInfo fInfo;
      tunerFilter.QueryFilterInfo(out fInfo);

      // remarks: the better way of detection would be to check the DevicePath for matching parts
      // but I didn't find a way to access IMoniker interface for query DevicePath from its property bag from a IFilterGraph only.
      // see also TvCardDvdBase:
      // //DD components have a common device path part. 
      //   if (!(capDevices[capIndex].DevicePath.ToLowerInvariant().Contains("fbca-11de-b16f-000000004d56") 

      // check for all vendors names to support this hardware
      foreach (String vendor in VendorNames)
      {
        if (fInfo.achName.StartsWith(vendor))
        {
          _CardName = vendor;
          break;
        }
      }
      // nothing found?
      if (_CardName == String.Empty)
      {
        _isGenericBDAS = false; // if this is no DD card, don't try to handle generic BDAS here.
        return;
      }

      IEnumerable<IBaseFilter> nextFilters = FilterGraphTools.GetAllNextFilters(tunerFilter, PINNAME_BDA_TRANSPORT,
                                                                                PinDirection.Output);
      foreach (IBaseFilter nextFilter in nextFilters)
      {
        FilterInfo filterInfo;
        nextFilter.QueryFilterInfo(out filterInfo);

        if (filterInfo.achName.ToLowerInvariant().Contains("common interface") && nextFilter is IKsControl)
        {
          CiFilter = nextFilter;
          _isDigitalDevices = true;
          Log.Log.Debug(FormatMessage(" Common Interface found!"));
          break;
        }
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:50,代码来源:DigitalDevices.cs

示例6: GetFilterName

        public static string GetFilterName(IBaseFilter filter)
        {
            int hr = 0;
            string filterName = string.Empty;

            FilterInfo filterInfo;
            hr = filter.QueryFilterInfo(out filterInfo);
            if (hr == 0)
            {
                if (filterInfo.pGraph != null)
                    Marshal.ReleaseComObject(filterInfo.pGraph);

                filterName = filterInfo.achName;
            }

            return filterName;
        }
开发者ID:Rainking720,项目名称:MediaBrowser.Theater,代码行数:17,代码来源:FilterGraphTools.cs

示例7: ShowFilterPropertyPage

        public static void ShowFilterPropertyPage(IBaseFilter filter, IntPtr parent)
        {
            int hr = 0;
            FilterInfo filterInfo;
            DsCAUUID caGuid;
            object[] objs;

            if (filter == null)
                throw new ArgumentNullException("filter");

            if (HasPropertyPages(filter))
            {
                hr = filter.QueryFilterInfo(out filterInfo);
                DsError.ThrowExceptionForHR(hr);

                if (filterInfo.pGraph != null)
                    Marshal.ReleaseComObject(filterInfo.pGraph);

                hr = (filter as ISpecifyPropertyPages).GetPages(out caGuid);
                DsError.ThrowExceptionForHR(hr);

                try
                {
                    objs = new object[1];
                    objs[0] = filter;

                    NativeMethods.OleCreatePropertyFrame(
                        parent, 0, 0,
                        filterInfo.achName,
                        objs.Length, objs,
                        caGuid.cElems, caGuid.pElems,
                        0, 0,
                        IntPtr.Zero
                        );
                }
                finally
                {
                    Marshal.FreeCoTaskMem(caGuid.pElems);
                }
            }
        }
开发者ID:naik899,项目名称:VideoMaker,代码行数:41,代码来源:FilterGraphTools.cs

示例8: ReConnectAll

 public static bool ReConnectAll(IGraphBuilder graphBuilder, IBaseFilter filter)
 {
   bool bAllConnected = true;
   IEnumPins pinEnum;
   FilterInfo info;
   filter.QueryFilterInfo(out info);
   ReleaseComObject(info.pGraph);
   int hr = filter.EnumPins(out pinEnum);
   if ((hr == 0) && (pinEnum != null))
   {
     Log.Info("got pins");
     pinEnum.Reset();
     IPin[] pins = new IPin[1];
     int iFetched;
     int iPinNo = 0;
     do
     {
       // Get the next pin
       //Log.Info("  get pin:{0}",iPinNo);
       iPinNo++;
       hr = pinEnum.Next(1, pins, out iFetched);
       if (hr == 0)
       {
         if (iFetched == 1 && pins[0] != null)
         {
           PinInfo pinInfo = new PinInfo();
           hr = pins[0].QueryPinInfo(out pinInfo);
           DsUtils.FreePinInfo(pinInfo);
           if (hr == 0)
           {
             Log.Info("  got pin#{0}:{1}", iPinNo - 1, pinInfo.name);
           }
           else
           {
             Log.Info("  got pin:?");
           }
           PinDirection pinDir;
           pins[0].QueryDirection(out pinDir);
           if (pinDir == PinDirection.Output)
           {
             IPin other;
             hr = pins[0].ConnectedTo(out other);
             if (hr == 0 && other != null)
             {
               Log.Info("Reconnecting {0}:{1}", info.achName, pinInfo.name);
               hr = graphBuilder.Reconnect(pins[0]);
               if (hr != 0)
               {
                 Log.Warn("Reconnect failed: {0}:{1}, code: 0x{2:x}", info.achName, pinInfo.name, hr);
               }
             }
           }
           ReleaseComObject(pins[0]);
         }
         else
         {
           iFetched = 0;
           Log.Info("no pins?");
           break;
         }
       }
       else
       {
         iFetched = 0;
       }
     } while (iFetched == 1);
     ReleaseComObject(pinEnum);
   }
   return bAllConnected;
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:70,代码来源:DirectShowUtil.cs

示例9: TryConnect

    private static bool TryConnect(IGraphBuilder graphBuilder, string filtername, IPin outputPin, IBaseFilter to)
    {
      bool ret = false;
      int hr;
      FilterInfo info;
      PinInfo outputInfo;

      to.QueryFilterInfo(out info);
      ReleaseComObject(info.pGraph);

      outputPin.QueryPinInfo(out outputInfo);
      DsUtils.FreePinInfo(outputInfo);

      if (info.achName.Equals(filtername))
      {
        return false; //do not connect to self
      }
      Log.Debug("Testing filter: {0}", info.achName);

      IEnumPins enumPins;
      IPin[] pins = new IPin[1];
      to.EnumPins(out enumPins);
      do
      {
        int pinsFetched;
        hr = enumPins.Next(1, pins, out pinsFetched);
        if (hr != 0 || pinsFetched == 0)
        {
          break;
        }
        PinDirection direction;
        pins[0].QueryDirection(out direction);
        if (direction == PinDirection.Input && !HasConnection(pins[0])) // && TestMediaTypes(outputPin, pins[0]))
        {
          PinInfo pinInfo;
          pins[0].QueryPinInfo(out pinInfo);
          DsUtils.FreePinInfo(pinInfo);
          Log.Debug("Testing compatibility to {0}",
                    pinInfo.name);
          //ListMediaTypes(pins[0]);
          //hr =  outputPin.Connect(pins[0], null);
          hr = graphBuilder.ConnectDirect(outputPin, pins[0], null);
          if (hr == 0)
          {
            Log.Debug("Connection succeeded");
            if (RenderOutputPins(graphBuilder, to))
            {
              Log.Info("Successfully rendered pin {0}:{1} to {2}:{3}.",
                       filtername, outputInfo.name, info.achName, pinInfo.name);
              ret = true;
              ReleaseComObject(pins[0]);
              break;
            }
            else
            {
              Log.Debug("Rendering got stuck. Trying next filter, and disconnecting {0}!", outputInfo.name);
              outputPin.Disconnect();
              pins[0].Disconnect();
            }
          }
          else
          {
            Log.Debug("Could not connect, filters are not compatible: {0:x}", hr);
          }
        }
        ReleaseComObject(pins[0]);
      } while (true);
      ReleaseComObject(enumPins);
      if (!ret)
      {
        Log.Debug("Dead end. Could not successfully connect pin {0} to filter {1}!", outputInfo.name, info.achName);
      }
      return ret;
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:74,代码来源:DirectShowUtil.cs

示例10: FindPin

        internal IPin FindPin(IBaseFilter filter, string name)
        {
            IEnumPins enumPins = null;
            IPin[] pins = new IPin[1];

            reply = filter.EnumPins(out enumPins);
            DsError.ThrowExceptionForHR(reply);

            while (enumPins.Next(pins.Length, pins, IntPtr.Zero) == 0)
            {
                PinInfo pinInfo;
                reply = pins[0].QueryPinInfo(out pinInfo);
                if (reply != 0)
                {
                    FilterInfo filterInfo;
                    filter.QueryFilterInfo(out filterInfo);
                    throw (new InvalidOperationException("The pin '" + name + "' could not be located for filter '" + filterInfo.achName + "'"));
                }

                if (pinInfo.name.StartsWith(name))
                {
                    Marshal.ReleaseComObject(enumPins);
                    return (pins[0]);
                }
            }

            Marshal.ReleaseComObject(enumPins);

            return (null);
        }
开发者ID:esurharun,项目名称:TSDumper,代码行数:30,代码来源:DirectShowGraph.cs

示例11: DisconnectAllPins

 public static bool DisconnectAllPins(IGraphBuilder graphBuilder, IBaseFilter filter)
 {
   IEnumPins pinEnum;
   int hr = filter.EnumPins(out pinEnum);
   if (hr != 0 || pinEnum == null)
   {
     return false;
   }
   FilterInfo info;
   filter.QueryFilterInfo(out info);
   Log.Info("Disconnecting all pins from filter {0}", info.achName);
   DirectShowUtil.ReleaseComObject(info.pGraph);
   bool allDisconnected = true;
   for (;;)
   {
     IPin[] pins = new IPin[1];
     int fetched;
     hr = pinEnum.Next(1, pins, out fetched);
     if (hr != 0 || fetched == 0)
     {
       break;
     }
     PinInfo pinInfo;
     pins[0].QueryPinInfo(out pinInfo);
     DsUtils.FreePinInfo(pinInfo);
     if (pinInfo.dir == PinDirection.Output)
     {
       if (!DisconnectPin(graphBuilder, pins[0]))
       {
         allDisconnected = false;
       }
     }
     ReleaseComObject(pins[0]);
   }
   ReleaseComObject(pinEnum);
   return allDisconnected;
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:37,代码来源:DirectShowUtil.cs

示例12: KNCAPI

    /// <summary>
    /// Initializes a new instance of the <see cref="KNCAPI"/> class.
    /// </summary>
    /// <param name="tunerFilter">The tuner filter.</param>
    /// <param name="DeviceIndex">The KNC1 card hardware index (0 based)</param>
    public KNCAPI(IBaseFilter tunerFilter, uint DeviceIndex)
    {
      ptrPmt = Marshal.AllocCoTaskMem(1024);
      ptrCallback = Marshal.AllocCoTaskMem(7 * 4); // 7*Int32
      _ptrDataInstance = Marshal.AllocCoTaskMem(1024);

      m_tunerFilter = tunerFilter;

      FilterInfo info;
      tunerFilter.QueryFilterInfo(out info);
      foreach (String validTuner in ValidTuners)
      {
        if (info.achName == validTuner)
        {
          m_bIsKNC = true;
          break;
        }
      }
      if (!m_bIsKNC)
      {
        return;
      }

      // iDeviceIndex passed by TvLibrary ! Enumerated by DevicePath
      m_iDeviceIndex = DeviceIndex;
      Log.Log.Debug("KNC: card {0} detected: {1}", m_iDeviceIndex, info.achName);

      OpenCI();
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:34,代码来源:KNCAPI.cs

示例13: getDeviceType

        private deviceCategory getDeviceType(IBaseFilter tunerFilter)
        {
            FilterInfo info;

            if (tunerFilter.QueryFilterInfo(out info) == 0)
            {
                switch (info.achName)
                {
                    case LBDG2_NAME_C_TUNER:
                    case LBDG2_NAME_S_TUNER:
                    case LBDG2_NAME_T_TUNER:
                    case LBDG2_NAME_C_TUNER_NEW:
                    case LBDG2_NAME_S_TUNER_NEW:
                    case LBDG2_NAME_T_TUNER_NEW:
                        return(deviceCategory.BUDGET_2);
                    case LBUDGET3NAME_TUNER:
                    case LBUDGET3NAME_ATSC_TUNER:
                        return(deviceCategory.BUDGET_3);
                    case LUSB2BDA_DVB_NAME_C_TUNER:
                    case LUSB2BDA_DVB_NAME_S_TUNER:
                    case LUSB2BDA_DVB_NAME_T_TUNER:
                        return(deviceCategory.USB_2);
                    case LUSB2BDA_DVBS_NAME_PIN_TUNER:
                        return(deviceCategory.USB_2_PINNACLE);
                    default:
                        return(deviceCategory.UNKNOWN);
                }
            }

            return (deviceCategory.UNKNOWN);
        }
开发者ID:esurharun,项目名称:TSDumper,代码行数:31,代码来源:TechnoTrendDiseqcHandler.cs

示例14: GetFilterName

 /// <summary>
 /// Gets the filter name.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <returns>FilterName</returns>
 public static string GetFilterName(IBaseFilter filter)
 {
   FilterInfo filterInfo;
   int hr = filter.QueryFilterInfo(out filterInfo);
   if (hr == 0)
   {
     if (filterInfo.pGraph != null)
       Release.ComObject(filterInfo.pGraph);
   }
   return String.Format(filterInfo.achName);
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:16,代码来源:FilterGraphTools.cs

示例15: AddDigitalDevicesCIModule

    /// <summary>
    /// Checks if the DigitalDevices CI module is installed
    /// if so it adds it to the directshow graph
    /// in the following way:
    /// [Network Provider]->[Tuner Filter]->[Capture Filter]->[Digital Devices Common Interface]->[InfTee]
    /// alternaively like this:
    /// [Network Provider]->[Tuner Filter]->[Digital Devices Common Interface]->[InfTee]
    /// </summary>
    /// <param name="lastFilter">A reference to the last filter.</param>
    /// <returns>
    /// true if hardware found and graph building succeeded, else false
    /// </returns>
    protected bool AddDigitalDevicesCIModule(ref IBaseFilter lastFilter)
    {
      FilterInfo pInfo;
      IBaseFilter tmpCiFilter = null;
      String CiDeviceName = String.Empty;
      bool filterSuccess = false;

      lastFilter.QueryFilterInfo(out pInfo);
      //Log.Log.Debug(pInfo.achName);

      if (_captureDevice == null)
        return false;

      if (!_captureDevice.DevicePath.ToLowerInvariant().Contains("fbca-11de-b16f-000000004d56"))
        return false;

      Log.Log.WriteFile("dvb:  DigitalDevices CI: try to connect [demux]");
      IPin lastFilterOutputPin = null;
      IPin demuxPinIn = null;
      IBaseFilter tmpDemux = null;
      try
      {
        tmpDemux = (IBaseFilter)new MPEG2Demultiplexer();
        _graphBuilder.AddFilter(tmpDemux, "MPEG2-Demultiplexer");

        lastFilterOutputPin = DsFindPin.ByDirection(lastFilter, PinDirection.Output, 0);
        demuxPinIn = DsFindPin.ByDirection(tmpDemux, PinDirection.Input, 0);
        
        // If connection to Demux is possible, CI filter cannot be put between.
        // this test removes a 30 .. 45 second delay when the graphbuilder tries to 
        // render Capture->CI->Demux and CI is not enabled for this tuner.
        if (_graphBuilder.Connect(lastFilterOutputPin, demuxPinIn) == 0)
        {
          Log.Log.WriteFile("dvb:  DigitalDevices CI: connection to [demux] successful, CI not available or configured for this tuner.");
          Log.Log.WriteFile("dvb:  DigitalDevices CI: disconnect [demux], HR:" + lastFilterOutputPin.Disconnect());
          return false;
        }
      }
      finally
      {
        Release.ComObject(pInfo.achName+" pin0", lastFilterOutputPin);
        Release.ComObject("tifdemux pinin", demuxPinIn);
        _graphBuilder.RemoveFilter(tmpDemux);
        Release.ComObject("tmpDemux", tmpDemux);
      }

      try
      {
        DsDevice[] capDevices = DsDevice.GetDevicesOfCat(FilterCategory.BDAReceiverComponentsCategory);
        DsDevice DDCIDevice = null;
        for (int capIndex = 0; capIndex < capDevices.Length; capIndex++)
        {
          // DD components have a common device path part. 
          if (!(capDevices[capIndex].DevicePath.ToLowerInvariant().Contains("fbca-11de-b16f-000000004d56") &&
                capDevices[capIndex].Name.ToLowerInvariant().Contains("common interface")))
            continue;

          CiDeviceName = capDevices[capIndex].Name;

          //try add filter to graph
          Log.Log.Info("dvb:  Adding {0} to graph", CiDeviceName);
          if (
            _graphBuilder.AddSourceFilterForMoniker(capDevices[capIndex].Mon, null, capDevices[capIndex].Name,
                                                    out tmpCiFilter) == 0)
          {
            //DigitalDevices ci module found
            Log.Log.Info("dvb:  {0} detected", CiDeviceName);

            String filterName = tunerOnly ? "Tuner" : "Capture";
            //now render [Tuner/Capture]->[CI]
            Log.Log.Info("dvb:  Render [{0}]->[{1}]", filterName, CiDeviceName);
            if (_capBuilder.RenderStream(null, null, lastFilter, null, tmpCiFilter) != 0)
            {
              Log.Log.Info("dvb:  Render [{0}]->[{1}] failed", filterName, CiDeviceName);
              _graphBuilder.RemoveFilter(tmpCiFilter);
              continue;
            }
            // filter connected, device found
            if (!DevicesInUse.Instance.IsUsed(capDevices[capIndex]))
            {
              DDCIDevice = capDevices[capIndex];
              break;
            }
          }
          //cannot add filter to graph...
          Log.Log.Info("dvb:  failed to add {0} filter to graph, try to find more devices.", CiDeviceName);
          //there can be multiple CI devices, try next one
        }
//.........这里部分代码省略.........
开发者ID:doskabouter,项目名称:MediaPortal-1,代码行数:101,代码来源:TvCardDvbBase.cs


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