本文整理汇总了C#中IBaseFilter.IsNull方法的典型用法代码示例。如果您正苦于以下问题:C# IBaseFilter.IsNull方法的具体用法?C# IBaseFilter.IsNull怎么用?C# IBaseFilter.IsNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBaseFilter
的用法示例。
在下文中一共展示了IBaseFilter.IsNull方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConnectFilters
/// <summary>
/// Connect pins from two filters
/// </summary>
/// <param name="graphBuilder">the IGraphBuilder interface of the graph</param>
/// <param name="upFilter">the upstream filter</param>
/// <param name="sourcePinName">the upstream filter pin name</param>
/// <param name="downFilter">the downstream filter</param>
/// <param name="destPinName">the downstream filter pin name</param>
/// <param name="useIntelligentConnect">indicate if the method should use DirectShow's Intelligent Connect</param>
/// <exception cref="System.ArgumentNullException">Thrown if graphBuilder, upFilter or downFilter are null</exception>
/// <exception cref="System.ArgumentException">Thrown if pin names are not found in filters</exception>
/// <exception cref="System.Runtime.InteropServices.COMException">Thrown if pins can't connect</exception>
/// <remarks>
/// If useIntelligentConnect is true, this method can add missing filters between the two pins.<br/>
/// If useIntelligentConnect is false, this method works only if the two media types are compatible.
/// </remarks>
public static void ConnectFilters(IGraphBuilder graphBuilder, IBaseFilter upFilter, string sourcePinName, IBaseFilter downFilter, string destPinName, bool useIntelligentConnect)
{
if (graphBuilder.IsNull())
throw new ArgumentNullException("graphBuilder");
if (upFilter.IsNull())
throw new ArgumentNullException("upFilter");
if (downFilter.IsNull())
throw new ArgumentNullException("downFilter");
IPin sourcePin, destPin;
sourcePin = DsFindPin.ByName(upFilter, sourcePinName);
if (sourcePin.IsNull())
throw new ArgumentException("The source filter has no pin called : " + sourcePinName, sourcePinName);
destPin = DsFindPin.ByName(downFilter, destPinName);
if (destPin.IsNull())
throw new ArgumentException("The downstream filter has no pin called : " + destPinName, destPinName);
try
{
ConnectFilters(graphBuilder, sourcePin, destPin, useIntelligentConnect);
}
finally
{
Marshal.ReleaseComObject(sourcePin);
Marshal.ReleaseComObject(destPin);
}
}
示例2: ShowFilterPropertyPage
public static void ShowFilterPropertyPage(IBaseFilter filter, IntPtr parent)
{
int hr = 0;
FilterInfo filterInfo;
DsCAUUID caGuid;
object[] objs;
if (filter.IsNull())
throw new ArgumentNullException("filter");
if (HasPropertyPages(filter))
{
hr = filter.QueryFilterInfo(out filterInfo);
DsError.ThrowExceptionForHR(hr);
if (filterInfo.pGraph.NotNull())
Marshal.ReleaseComObject(filterInfo.pGraph);
hr = (filter as ISpecifyPropertyPages).GetPages(out caGuid);
DsError.ThrowExceptionForHR(hr);
try
{
objs = new object[1];
objs[0] = filter;
NativeMethods.OleCreatePropertyFrame(
parent, 0, 0,
filterInfo.achName,
objs.Length, objs,
caGuid.cElems, caGuid.pElems,
0, 0,
IntPtr.Zero
);
}
finally
{
Marshal.FreeCoTaskMem(caGuid.pElems);
}
}
}
示例3: DisconnectPins
public static void DisconnectPins(IBaseFilter filter)
{
int hr = 0;
if (filter.IsNull())
throw new ArgumentNullException("filter");
IEnumPins enumPins;
IPin[] pins = new IPin[1];
hr = filter.EnumPins(out enumPins);
DsError.ThrowExceptionForHR(hr);
try
{
while (enumPins.Next(pins.Length, pins, IntPtr.Zero) == 0)
{
try
{
hr = pins[0].Disconnect();
DsError.ThrowExceptionForHR(hr);
}
finally
{
Marshal.ReleaseComObject(pins[0]);
}
}
}
finally
{
Marshal.ReleaseComObject(enumPins);
}
}
示例4: HasPropertyPages
/// <summary>
/// Check if a DirectShow filter can display Bits Pages
/// </summary>
/// <param name="filter">A DirectShow Filter</param>
/// <exception cref="System.ArgumentNullException">Thrown if filter is null</exception>
/// <seealso cref="ShowFilterPropertyPage"/>
/// <returns>true if the filter has Bits Pages, false if not</returns>
/// <remarks>
/// This method is intended to be used with <see cref="ShowFilterPropertyPage">ShowFilterPropertyPage</see>
/// </remarks>
public static bool HasPropertyPages(IBaseFilter filter)
{
if (filter.IsNull())
throw new ArgumentNullException("filter");
return ((filter as ISpecifyPropertyPages).NotNull());
}
示例5: RenderPin
public static bool RenderPin(IGraphBuilder graphBuilder, IBaseFilter source, string pinName)
{
int hr = 0;
if (graphBuilder.IsNull())
throw new ArgumentNullException("graphBuilder");
if (source.IsNull())
throw new ArgumentNullException("source");
IPin pin = DsFindPin.ByName(source, pinName);
if (pin.NotNull())
{
hr = graphBuilder.Render(pin);
Marshal.ReleaseComObject(pin);
return (hr >= 0);
}
return false;
}