本文整理汇总了C#中IPin类的典型用法代码示例。如果您正苦于以下问题:C# IPin类的具体用法?C# IPin怎么用?C# IPin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPin类属于命名空间,在下文中一共展示了IPin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: getName
/// <summary> Retrieve the friendly name of a connectorType. </summary>
private string getName(IPin pin)
{
string s = "Unknown pin";
PinInfo pinInfo = new PinInfo();
// Direction matches, so add pin name to listbox
int hr = pin.QueryPinInfo(out pinInfo);
Marshal.ThrowExceptionForHR(hr);
s = pinInfo.name + "";
// 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 (s);
}
开发者ID:simongh,项目名称:DirectShow.Capture,代码行数:19,代码来源:AudioSource.cs
示例17: PinViewModel
public PinViewModel(NodeViewModel nodeViewModel, IPin pin, IControlTypesResolver controlTypesResolver)
{
ControlTypesResolver = controlTypesResolver;
NodeViewModel = nodeViewModel;
Pin = pin;
Name = pin.Name;
Type = pin.Type;
Point = new CanvasPoint();
var changablePin = pin as INotifyPropertyChanged;
if (changablePin != null)
{
changablePin.PropertyChanged += OnPinPropertyChanged;
_disposable = Disposable.Create(() => changablePin.PropertyChanged -= OnPinPropertyChanged);
}
UpdateValue();
}
开发者ID:misupov,项目名称:Turbina,代码行数:18,代码来源:PinViewModel.cs
示例18: AddedToGraph
public override void AddedToGraph(FilgraphManager fgm) {
IGraphBuilder gb = (IGraphBuilder)fgm;
//Add the Blackmagic Decoder filter and connect it.
try {
bfDecoder = Filter.CreateBaseFilterByName("Blackmagic Design Decoder (DMO)");
gb.AddFilter(bfDecoder, "Blackmagic Design Decoder (DMO)");
IPin decoderInput;
bfDecoder.FindPin("in0", out decoderInput);
bfDecoder.FindPin("out0", out decoderOutput);
captureOutput = GetPin(filter, _PinDirection.PINDIR_OUTPUT, Pin.PIN_CATEGORY_CAPTURE, Guid.Empty, false, 0);
gb.Connect(captureOutput, decoderInput);
}
catch {
throw new ApplicationException("Failed to add the BlackMagic Decoder filter to the graph");
}
base.AddedToGraph(fgm);
}
开发者ID:psyCHOder,项目名称:conferencexp,代码行数:19,代码来源:CustomFilters.cs
示例19: IsMatchingPin
private static 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,项目名称:occurec,代码行数:42,代码来源:DsHelper.cs
示例20: getName
private string getName(IPin pin)
{
string str = "Unknown pin";
PinInfo pInfo = new PinInfo();
int errorCode = pin.QueryPinInfo(out pInfo);
if (errorCode == 0)
{
str = pInfo.name ?? "";
}
else
{
Marshal.ThrowExceptionForHR(errorCode);
}
if (pInfo.filter != null)
{
Marshal.ReleaseComObject(pInfo.filter);
}
pInfo.filter = null;
return str;
}
开发者ID:alienwow,项目名称:CSharpProjects,代码行数:20,代码来源:AudioSource.cs
注:本文中的IPin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论