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


C# IPin类代码示例

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


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

示例1: GetPinCategory

        /// <summary>
        /// Returns the PinCategory of the specified pin.  Usually a member of PinCategory.  Not all pins have a category.
        /// </summary>
        /// <param name="pPin"></param>
        /// <returns>Guid indicating pin category or Guid.Empty on no category.  Usually a member of PinCategory</returns>
        public static Guid GetPinCategory(IPin pPin)
        {
            Guid guidRet = Guid.Empty;

            // Memory to hold the returned guid
            int iSize = Marshal.SizeOf(typeof(Guid));
            IntPtr ipOut = Marshal.AllocCoTaskMem(iSize);

            try
            {
                int hr;
                int cbBytes;
                Guid g = PropSetID.Pin;

                // Get an IKsPropertySet from the pin
                IKsPropertySet pKs = pPin as IKsPropertySet;

                if (pKs != null)
                {
                    // Query for the Category
                    hr = pKs.Get(g, (int)AMPropertyPin.Category, IntPtr.Zero, 0, ipOut, iSize, out cbBytes);
                    DsError.ThrowExceptionForHR(hr);

                    // Marshal it to the return variable
                    guidRet = (Guid)Marshal.PtrToStructure(ipOut, typeof(Guid));
                }
            }
            finally
            {
                Marshal.FreeCoTaskMem(ipOut);
                ipOut = IntPtr.Zero;
            }

            return guidRet;
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:40,代码来源:DsUtils.cs

示例2: GetPin

        public static IPin GetPin(this IBaseFilter filter, PinDirection dir, int num)
        {
            IPin[] pin = new IPin[1];
            IEnumPins pinsEnum = null;

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

                while (pinsEnum.Next(1, pin, out n) == 0)
                {
                    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:JacindaChen,项目名称:TronCell,代码行数:26,代码来源:CaptureExtensions.cs

示例3: interface

		internal IPin		Pin;			// audio mixer interface (COM object)



		// -------------------- Constructors/Destructors ----------------------

		/// <summary> Constructor. This class cannot be created directly. </summary>
		internal AudioSource( IPin pin )
		{
			if ( (pin as IAMAudioInputMixer) == null )
				throw new NotSupportedException( "The input pin does not support the IAMAudioInputMixer interface" );
			this.Pin = pin;
			this.name = getName( pin );
		}
开发者ID:rajeper,项目名称:ikarus-osd,代码行数:14,代码来源:AudioSource.cs

示例4: GetMediaTypes

        /// <summary>
        /// Gets iSC's available _AMMediaTypes, without freeing pbFormat
        /// Caller should call MediaType.Free(_AMMediaType[]) when done
        /// </summary>
        public static _AMMediaType[] GetMediaTypes(IPin pin)
        {
            IEnumMediaTypes iEnum;
            pin.EnumMediaTypes(out iEnum);

            ArrayList alMTs = new ArrayList();

            IntPtr[] ptrs = new IntPtr[1];
            uint fetched;

            iEnum.Next(1, ptrs, out fetched);

            while(fetched == 1)
            {
                _AMMediaType mt = (_AMMediaType)Marshal.PtrToStructure(ptrs[0], typeof(_AMMediaType));
                alMTs.Add(mt);

                Marshal.FreeCoTaskMem(ptrs[0]);
                ptrs[0] = IntPtr.Zero;

                iEnum.Next(1, ptrs, out fetched);
            }

            _AMMediaType[] mts = new _AMMediaType[alMTs.Count];
            alMTs.CopyTo(mts);

            return mts;
        }
开发者ID:JayBeavers,项目名称:WPF-MediaKit,代码行数:32,代码来源:Pins.cs

示例5: GetPinCategory

        public static Guid GetPinCategory(IPin pPin)
        {
            var guidRet = Guid.Empty;
            var iSize = Marshal.SizeOf(typeof(Guid));
            var ipOut = Marshal.AllocCoTaskMem(iSize);

            try
            {
                var g = PropSetID.Pin;
                var pKs = pPin as IKsPropertySet;
                if (pKs != null)
                {
                    int cbBytes;
                    var hr = pKs.Get(g, (int)AMPropertyPin.Category, IntPtr.Zero, 0, ipOut, iSize, out cbBytes);
                    DsError.ThrowExceptionForHR(hr);
                    guidRet = (Guid)Marshal.PtrToStructure(ipOut, typeof(Guid));
                }
            }
            finally
            {
                Marshal.FreeCoTaskMem(ipOut);
            }

            return guidRet;
        }
开发者ID:pingmeaschandru,项目名称:LiveMeeting,代码行数:25,代码来源:DsUtils.cs

示例6: GetPin

        // Get pin of the filter
        public IPin GetPin(PinDirection dir, int num)
        {
            IPin[] pin = new IPin[1];

            IEnumPins pinsEnum = null;

            // enum filter pins
            if (m_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:Wiladams,项目名称:NewTOAPIA,代码行数:32,代码来源:Filter.cs

示例7: GetMinimumFreq

 public AmMediaType GetMinimumFreq(IPin OutputPin)
 {
     AmMediaType[] types = OutputPin.GetAllMediaTypes();
     IAMStreamConfig cfg = (IAMStreamConfig)OutputPin;
     AmMediaType currentType = cfg.GetFormat();
     WaveFormatEx currentWave = currentType.GetStruct<WaveFormatEx>();
     ShowMsg(String.Format(
         "CurrentOut: bps:{0} bit; ch:{1}, freq:{2} Hz",
         currentWave.wBitsPerSample, currentWave.nChannels, currentWave.nSamplesPerSec
         ));
     AmMediaType minimum = currentType;
     foreach (AmMediaType type in types)
     {
         WaveFormatEx wave = type.GetStruct<WaveFormatEx>();
         ShowMsg(String.Format(
             "bps:{0} bit; ch:{1}, freq:{2} Hz",
             wave.wBitsPerSample, wave.nChannels, wave.nSamplesPerSec
             ));
         if (wave.wFormatTag == currentWave.wFormatTag &&
             wave.nChannels == currentWave.nChannels &&
             wave.wBitsPerSample == currentWave.wBitsPerSample &&
             wave.nSamplesPerSec < currentWave.nSamplesPerSec)
         {
             minimum = type;
             currentWave = minimum.GetStruct<WaveFormatEx>();
         }
     }
     ShowMsg(String.Format(
         "Selected: bps:{0} bit; ch:{1}, freq:{2} Hz",
         currentWave.wBitsPerSample, currentWave.nChannels, currentWave.nSamplesPerSec
         ));
     return minimum;
 }
开发者ID:YaStark,项目名称:ShazamO,代码行数:33,代码来源:DSConverter.cs

示例8: CrossbarHelper

        public CrossbarHelper(IPin startingVideoInputPin)
        {
            foreach (PhysicalConnectorType type in Enum.GetValues(typeof(PhysicalConnectorType)))
                this.pinNameByPhysicalConnectorType[type] = StringFromPinType(type);

            int hr = BuildRoutingList(startingVideoInputPin, new Routing(), 0 /* Depth */);
        }
开发者ID:dgis,项目名称:CodeTV,代码行数:7,代码来源:WDMCrossbar.cs

示例9: CreateAudioCompressor

        public static IBaseFilter CreateAudioCompressor(DisposalCleanup dc, IGraphBuilder graph, IPin outPin,
                                                        AudioFormat settings)
        {
            if (dc == null) throw new ArgumentNullException("dc");
            if (graph == null) throw new ArgumentNullException("graph");
            if (outPin == null) throw new ArgumentNullException("outPin");
            if (settings == null) throw new ArgumentNullException("settings");

            int hr = 0;

            using (AudioCompressor compressor = AudioCompressorFactory.Create(settings))
            {
                IBaseFilter compressorFilter = compressor.Filter;
                dc.Add(compressorFilter);

                hr = graph.AddFilter(compressorFilter, settings.AudioCompressor);
                DsError.ThrowExceptionForHR(hr);

                FilterGraphTools.ConnectFilters(graph, outPin, compressorFilter, true);

                // set the media type on the output pin of the compressor
                if (compressor.MediaType != null)
                {
                    FilterGraphTools.SetFilterFormat(compressor.MediaType, compressorFilter);
                }

                return compressorFilter;
            }
        }
开发者ID:naik899,项目名称:VideoMaker,代码行数:29,代码来源:StandardFilters.cs

示例10: ConnectedTo

		public int ConnectedTo(out IPin pin)
		{
			// temporal
			pin = null;
			//throw new NotImplementedException();
			return 0;
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:7,代码来源:Interfaces.cs

示例11: GetName

        /// <summary> Retrieve the friendly name of a connectorType. </summary>
        private string GetName(IPin pin)
        {
            string str = "Unknown pin";
            PinInfo pinInfo = new PinInfo();

            // Direction matches, so add pin name to listbox
            int errorCode = pin.QueryPinInfo(out pinInfo);
            if (errorCode == 0)
            {
                str = pinInfo.name ?? "";
            }
            else
            {
                Marshal.ThrowExceptionForHR(errorCode);
            }

            // The pininfo structure contains a reference to an IBaseFilter,
            // so you must release its reference to prevent resource a leak.
            if (pinInfo.filter != null)
            {
                Marshal.ReleaseComObject(pinInfo.filter);
            }
            pinInfo.filter = null;
            return str;
        }
开发者ID:RajibTheKing,项目名称:DesktopClient,代码行数:26,代码来源:AudioSource.cs

示例12: AudioSource

 internal AudioSource(IPin pin)
 {
     if (!(pin is IAMAudioInputMixer))
     {
         throw new NotSupportedException("The input pin does not support the IAMAudioInputMixer interface");
     }
     this.Pin = pin;
     base.name = this.GetName(pin);
 }
开发者ID:RajibTheKing,项目名称:DesktopClient,代码行数:9,代码来源:AudioSource.cs

示例13: GetValue

        public object GetValue(IPin pin)
        {
            if (Dispatcher == null)
            {
                return pin.GetValue();
            }

            return Dispatcher.Invoke(() => pin.GetValue());
        }
开发者ID:misupov,项目名称:Turbina,代码行数:9,代码来源:Node.cs

示例14: VideoOutPinConfiguration

 public VideoOutPinConfiguration( IBaseFilter filter, IPin pin, int format_id, VideoInfoHeader header )
 {
     this.filter = filter;
     this.pin = pin;
     this.width = header.BmiHeader.Width;
     this.height = header.BmiHeader.Height;
     this.fps = 10000000 / header.AvgTimePerFrame;
     this.format_id = format_id;
 }
开发者ID:pbalint,项目名称:Playground,代码行数:9,代码来源:VideoOutPinConfiguration.cs

示例15: FindPin

        public static IPin FindPin(IBaseFilter filter, PinDirection direction, Guid mediaType, Guid pinCategory, string preferredName)
        {
            if (Guid.Empty != pinCategory)
            {
                int idx = 0;

                do
                {
                    IPin pinByCategory = DsFindPin.ByCategory(filter, pinCategory, idx);

                    if (pinByCategory != null)
                    {
                        if (IsMatchingPin(pinByCategory, direction, mediaType))
                            return PrintInfoAndReturnPin(filter, pinByCategory, direction, mediaType, pinCategory, "found by category");

                        Marshal.ReleaseComObject(pinByCategory);
                    }
                    else
                        break;

                    idx++;
                }
                while (true);
            }

            if (!string.IsNullOrEmpty(preferredName))
            {
                IPin pinByName = DsFindPin.ByName(filter, preferredName);
                if (pinByName != null && IsMatchingPin(pinByName, direction, mediaType))
                    return PrintInfoAndReturnPin(filter, pinByName, direction, mediaType, pinCategory, "found by name");

                Marshal.ReleaseComObject(pinByName);
            }

            IEnumPins pinsEnum;
            IPin[] pins = new IPin[1];

            int hr = filter.EnumPins(out pinsEnum);
            DsError.ThrowExceptionForHR(hr);

            while (pinsEnum.Next(1, pins, IntPtr.Zero) == 0)
            {
                IPin pin = pins[0];
                if (pin != null)
                {
                    if (IsMatchingPin(pin, direction, mediaType))
                        return PrintInfoAndReturnPin(filter, pin, direction, mediaType, pinCategory, "found by direction and media type");

                    Marshal.ReleaseComObject(pin);
                }
            }

            return null;
        }
开发者ID:hpavlov,项目名称:occurec,代码行数:54,代码来源:DsHelper.cs


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