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


C# IPin.ConnectedTo方法代码示例

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


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

示例1: BuildRoutingList

        // This function is called recursively, every time a new crossbar is
        // entered as we search upstream.
        //
        // Return values:
        //
        //   0 - Returned on final exit after recursive search if at least
        //       one routing is possible
        //   1 - Normal return indicating we've reached the end of a
        //       recursive search, so save the current path
        //  -1 - Unable to route anything
        private int BuildRoutingList(IPin startingInputPin, Routing routing, int depth)
        {
            if (startingInputPin == null || routing == null)
                return -1; // E_POINTER;

            // If the pin isn't connected, then it's a terminal pin
            IPin startingOutputPin = null;
            int hr = startingInputPin.ConnectedTo(out startingOutputPin);
            if (hr != 0)
                return ((depth == 0) ? -1 : 1);

            // It is connected, so now find out if the filter supports IAMCrossbar
            PinInfo pinInfo;
            if (startingOutputPin.QueryPinInfo(out pinInfo) == 0)
            {
                //ASSERT (pinInfo.dir == PINDIR_OUTPUT);

                IAMCrossbar crossbar = pinInfo.filter as IAMCrossbar;
                if (crossbar != null)
                {
                    int inputs, outputs, inputIndex, outputIndex;
                    int inputIndexRelated, outputIndexRelated;
                    PhysicalConnectorType inputPhysicalType, outputPhysicalType;

                    hr = crossbar.get_PinCounts(out outputs, out inputs);

                    // for all output pins
                    for (outputIndex = 0; outputIndex < outputs; outputIndex++)
                    {
                        hr = crossbar.get_CrossbarPinInfo(false, outputIndex, out outputIndexRelated, out outputPhysicalType);

                        // for all input pins
                        for (inputIndex = 0; inputIndex < inputs; inputIndex++)
                        {
                            hr = crossbar.get_CrossbarPinInfo(true, inputIndex, out inputIndexRelated, out inputPhysicalType);

                            // Can we route it?
                            if (crossbar.CanRoute(outputIndex, inputIndex) == 0)
                            {
                                IPin pPin = null;
                                hr = GetCrossbarPinAtIndex(crossbar, inputIndex, true, out pPin);

                                // We've found a route through this crossbar
                                // so save our state before recusively searching
                                // again.
                                Routing routingNext = new Routing();
                                // doubly linked list
                                routingNext.rightRouting = routing;
                                routing.leftRouting = routingNext;

                                routing.crossbar = crossbar;
                                routing.inputIndex = inputIndex;
                                routing.outputIndex = outputIndex;
                                routing.inputIndexRelated = inputIndexRelated;
                                routing.outputIndexRelated = outputIndexRelated;
                                routing.inputPhysicalType = inputPhysicalType;
                                routing.outputPhysicalType = outputPhysicalType;
                                routing.depth = depth;
                                routing.inputName = this.pinNameByPhysicalConnectorType[inputPhysicalType] as string;

                                hr = BuildRoutingList(pPin, routingNext, depth + 1);
                                if (hr == 1)
                                {
                                    routing.leftRouting = null;
                                    SaveRouting(routing, inputPhysicalType >= PhysicalConnectorType.Audio_Tuner);
                                }
                            } // if we can route
                        } // for all input pins
                    }
                    //pXbar.Release();
                }
                else
                {
                    // The filter doesn't support IAMCrossbar, so this
                    // is a terminal pin
                    DsUtils.FreePinInfo(pinInfo);
                    Marshal.ReleaseComObject(startingOutputPin);

                    return (depth == 0) ? -1 : 1;
                }

                DsUtils.FreePinInfo(pinInfo);
            }
            Marshal.ReleaseComObject(startingOutputPin);

            return 0;
        }
开发者ID:dgis,项目名称:CodeTV,代码行数:97,代码来源:WDMCrossbar.cs

示例2: RebuildPin

    public int RebuildPin(IFilterGraph pGraph, IPin pPin)
    {
      //Set codec bool to false
      ResetCodecBool();

      IPin pinTo;
      if (pPin != null)
      {
        int hr = pPin.ConnectedTo(out pinTo);
        if (hr >= 0 && pinTo != null)
        {
          PinInfo pInfo;
          pinTo.QueryPinInfo(out pInfo);
          FilterInfo fInfo;
          pInfo.filter.QueryFilterInfo(out fInfo);
          if (pPin != null)
          {
            RebuildMediaType(pPin);
            Log.Debug("VideoPlayer9: Rebuild LAV Delegate Info filter Name - {0}", fInfo.achName);

            if (MediatypeVideo)
            {
              //Video Part
              if (h264Codec)
              {
                if (fInfo.achName == filterConfig.VideoH264)
                {
                  RebuildRelease(pInfo, fInfo, pinTo, pPin);
                  return 1;
                }
              }
              else if (vc1Codec)
              {
                if (fInfo.achName == filterConfig.VideoVC1)
                {
                  RebuildRelease(pInfo, fInfo, pinTo, pPin);
                  return 1;
                }
              }
              else if (vc1ICodec)
              {
                if (fInfo.achName == filterConfig.VideoVC1I)
                {
                  RebuildRelease(pInfo, fInfo, pinTo, pPin);
                  return 1;
                }
              }
              else if (xvidCodec)
              {
                if (fInfo.achName == filterConfig.VideoXVID)
                {
                  RebuildRelease(pInfo, fInfo, pinTo, pPin);
                  return 1;
                }
              }
              else if (fInfo.achName == filterConfig.Video)
              {
                RebuildRelease(pInfo, fInfo, pinTo, pPin);
                return 1;
              }
              iChangedMediaTypes = 2;
              DoGraphRebuild();
              Log.Debug("VideoPlayer9: Rebuild LAV Delegate filter Video");
              RebuildRelease(pInfo, fInfo, pinTo, pPin);
              return 1;
            }
            else if (MediatypeAudio)
            {
              //Audio Part 
              if (aacCodec)
              {
                if (fInfo.achName == filterConfig.AudioAAC)
                {
                  RebuildRelease(pInfo, fInfo, pinTo, pPin);
                  return 1;
                }
              }
              if (aacCodecLav && fInfo.achName == LAV_AUDIO)
              {
                if (fInfo.achName == filterConfig.AudioAAC)
                {
                  RebuildRelease(pInfo, fInfo, pinTo, pPin);
                  return 1;
                }
              }
              else if ((!aacCodecLav || !aacCodec) && fInfo.achName == filterConfig.Audio)
              {
                RebuildRelease(pInfo, fInfo, pinTo, pPin);
                return 1;
              }
              iChangedMediaTypes = 1;
              DoGraphRebuild();
              Log.Debug("VideoPlayer9: Rebuild LAV Delegate filter Audio");
              RebuildRelease(pInfo, fInfo, pinTo, pPin);
              return 1;
            }
            else if (MediatypeSubtitle)
            {
              RebuildRelease(pInfo, fInfo, pinTo, pPin);
              return -1;
//.........这里部分代码省略.........
开发者ID:HeinA,项目名称:MediaPortal-1,代码行数:101,代码来源:VideoPlayerVMR9.cs

示例3: EnumerateDownstreamFromPin

        /// <summary>
        /// Find all the filters connected downstream from the specified pin,
        /// following all branches.
        /// </summary>
        /// <param name="pin"></param>
        /// <returns></returns>
        private List<IBaseFilter> EnumerateDownstreamFromPin(IPin pin)
        {
            //Find the input pin that the target pin is connected to.
            IPin connectedToInput;
            try {
                pin.ConnectedTo(out connectedToInput);
            }
            catch (COMException) {
                //not connected
                return new List<IBaseFilter>();
            }

            // Map that pin to the next filter.
            _PinInfo pInfo;
            connectedToInput.QueryPinInfo(out pInfo);
            IBaseFilter connectedFilter = pInfo.pFilter;

            //Add the filter to the list.
            List<IBaseFilter> returnList = new List<IBaseFilter>();
            returnList.Add(connectedFilter);

            //Enumerate output pins of the filter
            ArrayList outPins = Filter.GetPins(Filter.GetPins(connectedFilter), _PinDirection.PINDIR_OUTPUT);

            foreach (IPin p in outPins) {
                //recurse over each pin
                returnList.AddRange(EnumerateDownstreamFromPin(p));
            }

            return returnList;
        }
开发者ID:joke1410,项目名称:conferencexp,代码行数:37,代码来源:Graphs.cs

示例4: IsMatchingPin

		private bool IsMatchingPin(IPin pin, PinDirection direction, Guid mediaType)
		{
			PinDirection pinDirection;
			int hr = pin.QueryDirection(out pinDirection);
			DsError.ThrowExceptionForHR(hr);

			if (pinDirection != direction)
				// The pin lacks direction
				return false;

			IPin connectedPin;
			hr = pin.ConnectedTo(out connectedPin);
			if ((uint)hr != 0x80040209 /* Pin is not connected */)
				DsError.ThrowExceptionForHR(hr);

			if (connectedPin != null)
			{
				// The pin is already connected
				Marshal.ReleaseComObject(connectedPin);
				return false;
			}

			IEnumMediaTypes mediaTypesEnum;
			hr = pin.EnumMediaTypes(out mediaTypesEnum);
			DsError.ThrowExceptionForHR(hr);

			AMMediaType[] mediaTypes = new AMMediaType[1];

			while (mediaTypesEnum.Next(1, mediaTypes, IntPtr.Zero) == 0)
			{
				Guid majorType = mediaTypes[0].majorType;
				DsUtils.FreeAMMediaType(mediaTypes[0]);

				if (majorType == mediaType)
				{
					// We have found the pin we were looking for
					return true;
				}
			}

			return false;
		}
开发者ID:hpavlov,项目名称:video.directshowvideocapture,代码行数:42,代码来源:DirectShowCapture.cs

示例5: DisconnectPin

        public static bool DisconnectPin(IGraphBuilder graphBuilder, IPin pin)
        {
            IPin other;
            int hr = pin.ConnectedTo(out other);
            bool allDisconnected = true;
            PinInfo info;
            pin.QueryPinInfo(out info);
            DsUtils.FreePinInfo(info);

            if (hr == 0 && other != null)
            {
                other.QueryPinInfo(out info);
                if (!DisconnectAllPins(graphBuilder, info.filter))
                {
                    allDisconnected = false;
                }
                hr = pin.Disconnect();
                if (hr != 0)
                {
                    allDisconnected = false;

                }
                hr = other.Disconnect();
                if (hr != 0)
                {
                    allDisconnected = false;

                }
                DsUtils.FreePinInfo(info);
                Marshal.ReleaseComObject(other);
            }
            else
            {

            }
            return allDisconnected;
        }
开发者ID:jiailiuyan,项目名称:WPF-MediaKit,代码行数:37,代码来源:DirectShowUtil.cs

示例6: RemoveDownStreamFilters

 public static void RemoveDownStreamFilters(IGraphBuilder graphBuilder, IPin pin)
 {
   IPin pinConnected;
   pin.ConnectedTo(out pinConnected);
   if (pinConnected == null)
   {
     return;
   }
   PinInfo info;
   pinConnected.QueryPinInfo(out info);
   if (info.filter != null)
   {
     RemoveDownStreamFilters(graphBuilder, info.filter, true);
   }
   DsUtils.FreePinInfo(info);
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:16,代码来源:DirectShowUtil.cs

示例7: HasConnection

 private static bool HasConnection(IPin pin)
 {
   IPin pinInConnected;
   int hr = pin.ConnectedTo(out pinInConnected);
   if (hr != 0 || pinInConnected == null)
   {
     return false;
   }
   else
   {
     ReleaseComObject(pinInConnected);
     return true;
   }
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:14,代码来源:DirectShowUtil.cs

示例8: DisconnectPin

 public static bool DisconnectPin(IGraphBuilder graphBuilder, IPin pin)
 {
   IPin other;
   int hr = pin.ConnectedTo(out other);
   bool allDisconnected = true;
   PinInfo info;
   pin.QueryPinInfo(out info);
   DsUtils.FreePinInfo(info);
   Log.Info("Disconnecting pin {0}", info.name);
   if (hr == 0 && other != null)
   {
     other.QueryPinInfo(out info);
     if (!DisconnectAllPins(graphBuilder, info.filter))
     {
       allDisconnected = false;
     }
     hr = pin.Disconnect();
     if (hr != 0)
     {
       allDisconnected = false;
       Log.Error("Error disconnecting: {0:x}", hr);
     }
     hr = other.Disconnect();
     if (hr != 0)
     {
       allDisconnected = false;
       Log.Error("Error disconnecting other: {0:x}", hr);
     }
     DsUtils.FreePinInfo(info);
     ReleaseComObject(other);
   }
   else
   {
     Log.Info("  Not connected");
   }
   return allDisconnected;
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:37,代码来源:DirectShowUtil.cs

示例9: DisconnectPin

    /// <summary>
    /// Disconnects a single Pin.
    /// </summary>
    /// <param name="graphBuilder">IGraphBuilder</param>
    /// <param name="pin">Pin to disconnect</param>
    /// <returns>True if successful</returns>
    bool DisconnectPin(IGraphBuilder graphBuilder, IPin pin)
    {
      IntPtr other_ptr;
      int hr = pin.ConnectedTo(out other_ptr);
      bool allDisconnected = true;
      if (hr == 0 && other_ptr != IntPtr.Zero)
      {
        IPin other = Marshal.GetObjectForIUnknown(other_ptr) as IPin;
        PinInfo info;
        pin.QueryPinInfo(out info);
        ServiceRegistration.Get<ILogger>().Info("Disconnecting pin {0}", info.name);
        FilterGraphTools.FreePinInfo(info);

        other.QueryPinInfo(out info);
        if (!DisconnectAllPins(graphBuilder, info.filter))
          allDisconnected = false;

        FilterGraphTools.FreePinInfo(info);

        hr = pin.Disconnect();
        if (hr != 0)
        {
          allDisconnected = false;
          ServiceRegistration.Get<ILogger>().Error("Error disconnecting: {0:x}", hr);
        }
        hr = other.Disconnect();
        if (hr != 0)
        {
          allDisconnected = false;
          ServiceRegistration.Get<ILogger>().Error("Error disconnecting other: {0:x}", hr);
        }
        Marshal.ReleaseComObject(other);
      }
      else
      {
        ServiceRegistration.Get<ILogger>().Info("  Not connected");
      }
      return allDisconnected;
    }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:45,代码来源:GraphRebuilder.cs

示例10: UnRender

        private void UnRender(IPin pinOutOrigin)
        {
            int hr;
            //hr = pinOutOrigin.Disconnect();
            IPin pinOutEnd = null;
            hr = pinOutOrigin.ConnectedTo(out pinOutEnd);
            if (pinOutEnd != null)
            {
                try
                {
                    PinInfo pInfo = new PinInfo();
                    hr = pinOutEnd.QueryPinInfo(out pInfo);
                    if (hr >= 0)
                    {
                        if (pInfo.filter != null)
                        {
                            try
                            {
                                IEnumPins ppEnum;
                                hr = pInfo.filter.EnumPins(out ppEnum);
                                if (hr >= 0)
                                {
                                    try
                                    {
                                        // Walk the pins looking for a match
                                        IPin[] pPins = new IPin[1];
                                        //22 int lFetched;
                                        //22 while ((ppEnum.Next(1, pPins, out lFetched) >= 0) && (lFetched == 1))
                                        while (ppEnum.Next(1, pPins, IntPtr.Zero) >= 0)
                                        {
                                            try
                                            {
                                                // Read the direction
                                                PinDirection ppindir;
                                                hr = pPins[0].QueryDirection(out ppindir);
                                                if (hr >= 0)
                                                {
                                                    // Is it the right direction?
                                                    if (ppindir == PinDirection.Output)
                                                    {
                                                        if (pPins[0] != null)
                                                        {
                                                            UnRender(pPins[0]);
                                                        }
                                                    }
                                                }
                                            }
                                            finally
                                            {
                                                Marshal.ReleaseComObject(pPins[0]);
                                            }
                                        }
                                    }
                                    finally
                                    {
                                        Marshal.ReleaseComObject(ppEnum);
                                    }
                                }

                                hr = graphBuilder.RemoveFilter(pInfo.filter);
                            }
                            finally
                            {
                                Marshal.ReleaseComObject(pInfo.filter);
                            }
                        }
                    }
                }
                finally
                {
                    Marshal.ReleaseComObject(pinOutEnd);
                }
            }
        }
开发者ID:dgis,项目名称:CodeTV,代码行数:74,代码来源:GraphBuilderPlayer.cs

示例11: LogPinInfo

    /// <summary>
    /// Logs the pin info.
    /// </summary>
    /// <param name="pin">The pin.</param>
    /// <returns></returns>
    public static string LogPinInfo(IPin pin)
    {
      if (pin == null)
        return " pin==null ";
      PinInfo pinInfo;
      IPin connectedToPin;
      if (pin.ConnectedTo(out connectedToPin) != 0)
        connectedToPin = null;

      bool connected = connectedToPin != null;
      if (connected)
        Release.ComObject(connectedToPin);

      int hr = pin.QueryPinInfo(out pinInfo);
      if (hr == 0)
      {
        if (pinInfo.filter != null)
          Release.ComObject(pinInfo.filter);
      }
      return String.Format("name:{0} [{3}/{4}] Direction:{1} Connected:{2}", pinInfo.name, pinInfo.dir, connected,
                           getRefCount(pin), getRefCountCOM(pin));
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:27,代码来源:FilterGraphTools.cs

示例12: ConnectPin

    /// <summary>
    /// helper function to connect 2 filters
    /// </summary>
    /// <param name="graphBuilder">graph builder interface</param>
    /// <param name="pinSource">souce pin</param>
    /// <param name="filterDest">destination filter</param>
    /// <param name="destPinIndex">input pin index</param>
    public static bool ConnectPin(IGraphBuilder graphBuilder, IPin pinSource, IBaseFilter filterDest, int destPinIndex)
    {
      IPin pin;
      pinSource.ConnectedTo(out pin);
      if (pin != null)
      {
        Release.ComObject("Connect Pin", pin);
        return false;
      }
      IPin pinDest = DsFindPin.ByDirection(filterDest, PinDirection.Input, destPinIndex);
      if (pinDest == null)
        return false;

      int hr = graphBuilder.Connect(pinSource, pinDest);
      if (hr != 0)
      {
        Release.ComObject("Connect Pin", pinDest);
        return false;
      }
      Release.ComObject("Connect Pin", pinDest);
      return true;
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:29,代码来源:FilterGraphTools.cs


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