本文整理汇总了C#中IPin.QueryId方法的典型用法代码示例。如果您正苦于以下问题:C# IPin.QueryId方法的具体用法?C# IPin.QueryId怎么用?C# IPin.QueryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPin
的用法示例。
在下文中一共展示了IPin.QueryId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
public int Connect(IPin pReceivePin, AMMediaType pmt)
{
Monitor.Enter(this);
int hr = S_OK;
pin = null;
pintype = null;
allocator = null;
string id = "Unnamed pin";
pReceivePin.QueryId(out id);
PinInfo pi = new PinInfo();
hr = pReceivePin.QueryPinInfo(out pi);
if (hr == S_OK)
{
FilterInfo fi = new FilterInfo();
hr = pi.filter.QueryFilterInfo(out fi);
if (hr == S_OK)
{
id += (" (" + fi.achName);
}
Guid guid;
hr = pi.filter.GetClassID(out guid);
if (hr == S_OK)
{
id += (", " + guid.ToString());
}
id += ")";
}
try
{
AMMediaType amt = null;
if (pmt != null)
{
amt = pmt;
}
else
#if false
{
IEnumMediaTypes ie;
hr = pReceivePin.EnumMediaTypes(out ie);
int fetched;
int alloc = Marshal.SizeOf(typeof(AMMediaType));
IntPtr mtypePtr = Marshal.AllocCoTaskMem(alloc);
while (ie.Next(1, mtypePtr, out fetched) == S_OK)
{
amt = new AMMediaType();
Marshal.PtrToStructure(mtypePtr, amt);
hr = pReceivePin.QueryAccept(amt);
if (hr == S_OK)
{
break;
}
DsUtils.FreeAMMediaType(amt);
amt = null;
}
if (fetched == 0)
{
amt = null;
}
Marshal.FreeCoTaskMem(mtypePtr);
}
if (amt == null)
#endif
{
amt = mediatype;
}
hr = pReceivePin.QueryAccept(amt);
if (hr == S_FALSE)
{
log.InfoFormat("No media type for pin '{0}'", id);
Monitor.Exit(this);
return VFW_E_NO_ACCEPTABLE_TYPES;
}
hr = pReceivePin.ReceiveConnection(this, amt);
if (hr == VFW_E_TYPE_NOT_ACCEPTED)
{
log.InfoFormat("No connection to pin '{0}'", id);
Monitor.Exit(this);
return VFW_E_NO_ACCEPTABLE_TYPES;
}
DsError.ThrowExceptionForHR(hr);
pin = pReceivePin;
pintype = amt;
}
catch (Exception e)
{
LogUtil.ExceptionLog.ErrorFormat("Caught exception in connect ({0}): {1}{2}", id, e.Message, e.StackTrace);
pin = null;
pintype = null;
allocator = null;
Monitor.Exit(this);
return VFW_E_NO_TRANSPORT;
}
Monitor.Exit(this);
log.InfoFormat("Connected to pin '{0}'", id);
return S_OK;
}