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


C# DsROTEntry.Dispose方法代码示例

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


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

示例1: GetTunerCapabilities

 private void GetTunerCapabilities()
 {
   Log.Log.WriteFile("ss2: GetTunerCapabilities");
   _graphBuilder = (IFilterGraph2)new FilterGraph();
   _rotEntry = new DsROTEntry(_graphBuilder);
   _capBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
   _capBuilder.SetFiltergraph(_graphBuilder);
   //=========================================================================================================
   // add the skystar 2 specific filters
   //=========================================================================================================
   Log.Log.WriteFile("ss2:GetTunerCapabilities() create B2C2 adapter");
   _filterB2C2Adapter =
     (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(DVBSkyStar2Helper.CLSID_B2C2Adapter, false));
   if (_filterB2C2Adapter == null)
   {
     Log.Log.Error("ss2:GetTunerCapabilities() _filterB2C2Adapter not found");
     return;
   }
   _interfaceB2C2TunerCtrl = _filterB2C2Adapter as DVBSkyStar2Helper.IB2C2MPEG2TunerCtrl2;
   if (_interfaceB2C2TunerCtrl == null)
   {
     Log.Log.Error("ss2: cannot get IB2C2MPEG2TunerCtrl3");
     return;
   }
   //=========================================================================================================
   // initialize skystar 2 tuner
   //=========================================================================================================
   /* Not necessary for query-only application
    
   Log.Log.WriteFile("ss2: Initialize Tuner()");
   hr = _interfaceB2C2TunerCtrl.Initialize();
   if (hr != 0)
   {
     Log.Log.Error("ss2: Tuner initialize failed:0x{0:X}", hr);
     //return;
   }*/
   //=========================================================================================================
   // Get tuner type (DVBS, DVBC, DVBT, ATSC)
   //=========================================================================================================
   int lTunerCapSize = Marshal.SizeOf(typeof (tTunerCapabilities));
   IntPtr ptCaps = Marshal.AllocHGlobal(lTunerCapSize);
   int hr = _interfaceB2C2TunerCtrl.GetTunerCapabilities(ptCaps, ref lTunerCapSize);
   if (hr != 0)
   {
     Log.Log.Error("ss2: Tuner Type failed:0x{0:X}", hr);
     return;
   }
   tTunerCapabilities tc = (tTunerCapabilities)Marshal.PtrToStructure(ptCaps, typeof (tTunerCapabilities));
   switch (tc.eModulation)
   {
     case TunerType.ttSat:
       Log.Log.WriteFile("ss2: Card type = DVBS");
       _cardType = CardType.DvbS;
       break;
     case TunerType.ttCable:
       Log.Log.WriteFile("ss2: Card type = DVBC");
       _cardType = CardType.DvbC;
       break;
     case TunerType.ttTerrestrial:
       Log.Log.WriteFile("ss2: Card type = DVBT");
       _cardType = CardType.DvbT;
       break;
     case TunerType.ttATSC:
       Log.Log.WriteFile("ss2: Card type = ATSC");
       _cardType = CardType.Atsc;
       break;
     case TunerType.ttUnknown:
       Log.Log.WriteFile("ss2: Card type = unknown?");
       _cardType = CardType.DvbS;
       break;
   }
   Marshal.FreeHGlobal(ptCaps);
   // Release all used object
   if (_filterB2C2Adapter != null)
   {
     Release.ComObject("tuner filter", _filterB2C2Adapter);
     _filterB2C2Adapter = null;
   }
   _rotEntry.Dispose();
   if (_capBuilder != null)
   {
     Release.ComObject("capture builder", _capBuilder);
     _capBuilder = null;
   }
   if (_graphBuilder != null)
   {
     Release.ComObject("graph builder", _graphBuilder);
     _graphBuilder = null;
   }
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:90,代码来源:TvCardDvbSS2.cs

示例2: handleInternalNetworkProviderFilter

 private void handleInternalNetworkProviderFilter(DsDevice[] devices, IFilterGraph2 graphBuilder,
                                                  Guid networkProviderClsId, DsROTEntry rotEntry)
 {
   IDvbNetworkProvider interfaceNetworkProvider;
   TuningType tuningTypes;
   for (int i = 0; i < devices.Length; i++)
   {
     bool isCablePreferred = false;
     string name = devices[i].Name ?? "unknown";
     name = name.ToLowerInvariant();
     Log.Log.WriteFile("Found card:{0}", name);
     //silicondust work-around for dvb type detection issue. generic provider would always use dvb-t
     if (name.Contains("silicondust hdhomerun tuner"))
     {
       isCablePreferred = CheckHDHomerunCablePrefered(name);
       Log.Log.WriteFile("silicondust hdhomerun detected - prefer cable mode: {0}", isCablePreferred);
     }
     IBaseFilter tmp;
     graphBuilder.AddSourceFilterForMoniker(devices[i].Mon, null, name, out tmp);
     //Use the Microsoft Network Provider method first but only if available
     IBaseFilter networkDVB = FilterGraphTools.AddFilterFromClsid(graphBuilder, networkProviderClsId,
                                                                  "MediaPortal Network Provider");
     interfaceNetworkProvider = (IDvbNetworkProvider)networkDVB;
     string hash = GetHash(devices[i].DevicePath);
     interfaceNetworkProvider.ConfigureLogging(GetFileName(devices[i].DevicePath), hash, LogLevelOption.Debug);
     if (ConnectFilter(graphBuilder, networkDVB, tmp))
     {
       Log.Log.WriteFile("Detected DVB card:{0}- Hash: {1}", name, hash);
       interfaceNetworkProvider.GetAvailableTuningTypes(out tuningTypes);
       Log.Log.WriteFile("TuningTypes: " + tuningTypes);
       // determine the DVB card supported GUIDs here!
       if ((tuningTypes & TuningType.DvbT) != 0 && !isCablePreferred)
       {
         Log.Log.WriteFile("Detected DVB-T* card:{0}", name);
         TvCardDVBT dvbtCard = new TvCardDVBT(_epgEvents, devices[i]);
         _cards.Add(dvbtCard);
       }
       if ((tuningTypes & TuningType.DvbS) != 0 && !isCablePreferred)
       {
         Log.Log.WriteFile("Detected DVB-S* card:{0}", name);
         TvCardDVBS dvbsCard = new TvCardDVBS(_epgEvents, devices[i]);
         _cards.Add(dvbsCard);
       }
       if ((tuningTypes & TuningType.DvbC) != 0)
       {
         Log.Log.WriteFile("Detected DVB-C* card:{0}", name);
         TvCardDVBC dvbcCard = new TvCardDVBC(_epgEvents, devices[i]);
         _cards.Add(dvbcCard);
       }
       if ((tuningTypes & TuningType.Atsc) != 0 && !isCablePreferred)
       {
         Log.Log.WriteFile("Detected ATSC* card:{0}", name);
         TvCardATSC dvbsCard = new TvCardATSC(_epgEvents, devices[i]);
         _cards.Add(dvbsCard);
       }
     }
     graphBuilder.RemoveFilter(tmp);
     Release.ComObject("tmp filter", tmp);
     graphBuilder.RemoveFilter(networkDVB);
     Release.ComObject("ms provider", networkDVB);
   }
   FilterGraphTools.RemoveAllFilters(graphBuilder);
   rotEntry.Dispose();
   Release.ComObject("graph builder", graphBuilder);
 }
开发者ID:Yura80,项目名称:MediaPortal-1,代码行数:65,代码来源:TvCardCollection.cs

示例3: DetectCards


//.........这里部分代码省略.........
                  //test the first found guid to determine the DVB card type
                  if (pguidNetworkTypes[n] == (typeof (DVBTNetworkProvider).GUID) && !isCablePreferred)
                  {
                    Log.Log.WriteFile("Detected DVB-T* card:{0}", name);
                    TvCardDVBT dvbtCard = new TvCardDVBT(_epgEvents, devices[i]);
                    _cards.Add(dvbtCard);
                    connected = true;
                  }
                  else if (pguidNetworkTypes[n] == (typeof (DVBSNetworkProvider).GUID) && !isCablePreferred)
                  {
                    Log.Log.WriteFile("Detected DVB-S* card:{0}", name);
                    TvCardDVBS dvbsCard = new TvCardDVBS(_epgEvents, devices[i]);
                    _cards.Add(dvbsCard);
                    connected = true;
                  }
                  else if (pguidNetworkTypes[n] == (typeof (DVBCNetworkProvider).GUID))
                  {
                    Log.Log.WriteFile("Detected DVB-C* card:{0}", name);
                    TvCardDVBC dvbcCard = new TvCardDVBC(_epgEvents, devices[i]);
                    _cards.Add(dvbcCard);
                    connected = true;
                  }
                  else if (pguidNetworkTypes[n] == (typeof (ATSCNetworkProvider).GUID))
                  {
                    Log.Log.WriteFile("Detected ATSC* card:{0}", name);
                    TvCardATSC dvbsCard = new TvCardATSC(_epgEvents, devices[i]);
                    _cards.Add(dvbsCard);
                    connected = true;
                  }
                  if (connected)
                  {
                    graphBuilder.RemoveFilter(tmp);
                    Release.ComObject("tmp filter", tmp);
                    break; // already found one, no need to continue
                  }
                  else if (n == (pulcNetworkTypes - 1))
                  {
                    Log.Log.WriteFile("Connected with generic MS Network Provider however network types don't match, using the original method");
                  }
                }
              }
              else
              {
                Log.Log.WriteFile("Not connected with generic MS Network Provider, using the original method");
                connected = false;
              }
              graphBuilder.RemoveFilter(networkDVB);
              Release.ComObject("ms provider", networkDVB);
            }
            if (!genericNP || !connected)
            {
              if (ConnectFilter(graphBuilder, networkDVBT, tmp))
              {
                Log.Log.WriteFile("Detected DVB-T card:{0}", name);
                TvCardDVBT dvbtCard = new TvCardDVBT(_epgEvents, devices[i]);
                _cards.Add(dvbtCard);
              }
              else if (ConnectFilter(graphBuilder, networkDVBC, tmp))
              {
                Log.Log.WriteFile("Detected DVB-C card:{0}", name);
                TvCardDVBC dvbcCard = new TvCardDVBC(_epgEvents, devices[i]);
                _cards.Add(dvbcCard);
              }
              else if (ConnectFilter(graphBuilder, networkDVBS, tmp))
              {
                Log.Log.WriteFile("Detected DVB-S card:{0}", name);
                TvCardDVBS dvbsCard = new TvCardDVBS(_epgEvents, devices[i]);
                _cards.Add(dvbsCard);
              }
              else if (ConnectFilter(graphBuilder, networkATSC, tmp))
              {
                Log.Log.WriteFile("Detected ATSC card:{0}", name);
                TvCardATSC dvbsCard = new TvCardATSC(_epgEvents, devices[i]);
                _cards.Add(dvbsCard);
              }
              graphBuilder.RemoveFilter(tmp);
              Release.ComObject("tmp filter", tmp);
            }
          }
          FilterGraphTools.RemoveAllFilters(graphBuilder);
          Release.ComObject("dvbc provider", networkDVBC);
          Release.ComObject("atsc provider", networkATSC);
          Release.ComObject("dvbs provider", networkDVBS);
          Release.ComObject("dvbt provider", networkDVBT);
          rotEntry.Dispose();
          Release.ComObject("graph builder", graphBuilder);
        }
      }
      //Analogue TV devices
      devices = DsDevice.GetDevicesOfCat(FilterCategory.AMKSTVTuner);
      for (int i = 0; i < devices.Length; i++)
      {
        string name = devices[i].Name ?? "unknown";
        name = name.ToLowerInvariant();
        Log.Log.WriteFile("Detected analog card:{0}", name);
        TvCardAnalog analogCard = new TvCardAnalog(devices[i]);
        _cards.Add(analogCard);
      }
      _cards.Add(new RadioWebStreamCard());
    }
开发者ID:Yura80,项目名称:MediaPortal-1,代码行数:101,代码来源:TvCardCollection.cs

示例4: GetTunerCapabilities

    private void GetTunerCapabilities()
    {
      Log.Log.WriteFile("b2c2: GetTunerCapabilities");
      _graphBuilder = (IFilterGraph2)new FilterGraph();
      _rotEntry = new DsROTEntry(_graphBuilder);
      _capBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
      _capBuilder.SetFiltergraph(_graphBuilder);
      //=========================================================================================================
      // add the B2C2 specific filters
      //=========================================================================================================
      Log.Log.WriteFile("b2c2:GetTunerCapabilities() create B2C2 adapter");
      _filterB2C2Adapter =
        Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_B2C2Adapter, false)) as IBaseFilter;
      if (_filterB2C2Adapter == null)
      {
        Log.Log.Error("b2c2:GetTunerCapabilities() _filterB2C2Adapter not found");
        return;
      }
      _interfaceB2C2TunerCtrl = _filterB2C2Adapter as IB2C2MPEG2TunerCtrl4;
      if (_interfaceB2C2TunerCtrl == null)
      {
        Log.Log.Error("b2c2: cannot get IB2C2MPEG2TunerCtrl4");
        return;
      }

      _interfaceB2C2DataCtrl = _filterB2C2Adapter as IB2C2MPEG2DataCtrl6;
      if (_interfaceB2C2DataCtrl == null)
      {
        Log.Log.Error("b2c2: cannot get IB2C2MPEG2DataCtrl6");
        return;
      }

      int hr = _interfaceB2C2DataCtrl.SelectDevice(_deviceInfo.DeviceId);
      if (hr != 0)
      {
        Log.Log.Error("b2c2: select device failed: {0:X}", hr);
      }

      //=========================================================================================================
      // Get tuner type (DVBS, DVBC, DVBT, ATSC)
      //=========================================================================================================
      int lTunerCapSize = Marshal.SizeOf(typeof(tTunerCapabilities));
      IntPtr ptCaps = Marshal.AllocHGlobal(lTunerCapSize);
      hr = _interfaceB2C2TunerCtrl.GetTunerCapabilities(ptCaps, ref lTunerCapSize);
      if (hr != 0)
      {
        Log.Log.Error("b2c2: Tuner Type failed:0x{0:X}", hr);
        return;
      }
      tTunerCapabilities tc = (tTunerCapabilities)Marshal.PtrToStructure(ptCaps, typeof(tTunerCapabilities));
      switch (tc.eModulation)
      {
        case TunerType.ttSat:
          Log.Log.WriteFile("b2c2: Card type = DVBS");
          _cardType = CardType.DvbS;
          break;
        case TunerType.ttCable:
          Log.Log.WriteFile("b2c2: Card type = DVBC");
          _cardType = CardType.DvbC;
          break;
        case TunerType.ttTerrestrial:
          Log.Log.WriteFile("b2c2: Card type = DVBT");
          _cardType = CardType.DvbT;
          break;
        case TunerType.ttATSC:
          Log.Log.WriteFile("b2c2: Card type = ATSC");
          _cardType = CardType.Atsc;
          break;
        case TunerType.ttUnknown:
          Log.Log.WriteFile("b2c2: Card type = unknown?");
          _cardType = CardType.Unknown;
          break;
      }
      Marshal.FreeHGlobal(ptCaps);
      // Release all used object
      if (_filterB2C2Adapter != null)
      {
        Release.ComObject("tuner filter", _filterB2C2Adapter);
        _filterB2C2Adapter = null;
      }
      _rotEntry.Dispose();
      if (_capBuilder != null)
      {
        Release.ComObject("capture builder", _capBuilder);
        _capBuilder = null;
      }
      if (_graphBuilder != null)
      {
        Release.ComObject("graph builder", _graphBuilder);
        _graphBuilder = null;
      }
    }
开发者ID:hkjensen,项目名称:MediaPortal-1,代码行数:92,代码来源:TvCardDvbB2C2.cs


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