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


C# IPin.ConnectionMediaType方法代码示例

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


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

示例1: logMediaTypes

        private void logMediaTypes(IPin pin)
        {
            IEnumMediaTypes mediaTypes = null;
            AMMediaType[] mediaType = new AMMediaType[1];

            AMMediaType connectedMediaType = new AMMediaType();
            reply = pin.ConnectionMediaType(connectedMediaType);

            reply = pin.EnumMediaTypes(out mediaTypes);
            if (reply != 0)
            {
                LogMessage("Media types cannot be determined at this time (not connected yet?)");
                return;
            }

            while (mediaTypes.Next(mediaType.Length, mediaType, IntPtr.Zero) == 0)
            {
                foreach (AMMediaType currentMediaType in mediaType)
                {
                    PinInfo pinInfo;
                    reply = pin.QueryPinInfo(out pinInfo);
                    DsError.ThrowExceptionForHR(reply);

                    string majorType = TranslateMediaMajorType(currentMediaType.majorType);
                    string subType = TranslateMediaSubType(currentMediaType.subType);

                    string connectedComment;

                    if (currentMediaType.majorType == connectedMediaType.majorType && currentMediaType.subType == connectedMediaType.subType)
                        connectedComment = "** Connected **";
                    else
                        connectedComment = string.Empty;

                    LogMessage("Media type: " +
                        majorType + " ; " +
                        subType + " " +
                        currentMediaType.fixedSizeSamples + " " +
                        currentMediaType.sampleSize + " " +
                        connectedComment);
                }
            }
        }
开发者ID:esurharun,项目名称:TSDumper,代码行数:42,代码来源:DirectShowGraph.cs

示例2: ChangePinFormat

        private void ChangePinFormat(IPin pin, int samplesPerSec, bool forceMono)
        {
            AMMediaType outputMediaType = new AMMediaType();
            pin.ConnectionMediaType(outputMediaType);
            var formatEx = Marshal.PtrToStructure(outputMediaType.formatPtr, typeof(WaveFormatEx)) as WaveFormatEx;

            if (samplesPerSec != 0 && samplesPerSec < formatEx.nSamplesPerSec)
                formatEx.nSamplesPerSec = samplesPerSec;

            if (forceMono)
                formatEx.nChannels = 1;

            formatEx.nBlockAlign = (short)(formatEx.nChannels * 2); // * 2 for 16 bit
            formatEx.nAvgBytesPerSec = formatEx.nSamplesPerSec * formatEx.nBlockAlign;

            Marshal.StructureToPtr(formatEx, outputMediaType.formatPtr, true);
            IAMStreamConfig streamConfig = (IAMStreamConfig)pin;
            streamConfig.SetFormat(outputMediaType);
        }
开发者ID:Nanook,项目名称:TheGHOST,代码行数:19,代码来源:Xbadpcm.cs


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