本文整理汇总了C#中IGraphBuilder.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphBuilder.Disconnect方法的具体用法?C# IGraphBuilder.Disconnect怎么用?C# IGraphBuilder.Disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGraphBuilder
的用法示例。
在下文中一共展示了IGraphBuilder.Disconnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToGraph
public static IBaseFilter AddToGraph(IGraphBuilder graphBuilder)
{
IBaseFilter vob = null;
DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.DirectVobSubAutoload, out vob);
if (vob == null)
{
//Try the "normal" filter then.
DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.DirectVobSubNormal, out vob);
}
//if the directvobsub filter has not been added to the graph. (i.e. with evr)
//we add a bit more intelligence to determine if subtitles are enabled.
//and if subtitles are present for the video / movie then we add it if necessary to the graph.
if (vob == null)
{
Log.Info("VideoPlayerVMR9: No VobSub filter in the current graph");
//the filter has not been added lets check if it should be added or not.
//add the filter to the graph
vob = DirectShowUtil.AddFilterToGraph(graphBuilder, "DirectVobSub");
if (vob == null)
{
Log.Warn("VideoPlayerVMR9: DirectVobSub filter not found! You need to install VSFilter");
return null;
}
else
{
Log.Debug("VideoPlayerVMR9: VobSub filter added to graph");
}
}
else // VobSub already loaded
{
return vob;
}
// Check if Haali Media Splitter is in the graph.
IBaseFilter hms = null;
DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.HaaliGuid, out hms);
if (hms == null)
DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.MPCMatroska, out hms);
if (hms == null)
DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.MPCMatroskaSource, out hms);
if (hms == null)
DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.LAVFilter, out hms);
if (hms == null)
DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.LAVFilterSource, out hms);
if (hms != null)
{
IPin pinSubTo = null;
// It is. Connect it' subtitle output pin (if any) to Vobsub's subtitle input.
pinSubTo = DirectShowUtil.FindPin(hms, PinDirection.Output, "Subtitle");
if (pinSubTo == null)
{
while (true)
{
IPin freeSubtitle = DirectShowUtil.FindFirstFreePinSub(hms, PinDirection.Output, "");
IPin freeVobSub = DirectShowUtil.FindFirstFreePin(vob, PinDirection.Input, "Input");
if (freeSubtitle != null && freeVobSub != null)
{
Log.Debug("VideoPlayerVMR9: Connecting Matroska's subtitle output to VobSub's input.");
graphBuilder.Connect(freeSubtitle, freeVobSub);
DirectShowUtil.ReleaseComObject(freeSubtitle);
freeSubtitle = null;
DirectShowUtil.ReleaseComObject(freeVobSub);
freeVobSub = null;
}
else
break;
}
}
DirectShowUtil.ReleaseComObject(hms);
hms = null;
if (pinSubTo != null)
{
Log.Debug("VideoPlayerVMR9: Connecting Haali's subtitle output to VobSub's input.");
// Try to render pins
IPin pinVobSubSub = DirectShowUtil.FindPin(vob, PinDirection.Input, "Input");
// If pinSubTo is already connected (disconnect it)
graphBuilder.Disconnect(pinSubTo);
graphBuilder.Connect(pinSubTo, pinVobSubSub);
DirectShowUtil.ReleaseComObject(pinSubTo);
pinSubTo = null;
DirectShowUtil.ReleaseComObject(pinVobSubSub);
pinVobSubSub = null;
}
}
// Now check if vobsub's video input is not connected.
// Check only if vmr9 is connected (render was successful).
VMR9Util Vmr9 = VMR9Util.g_vmr9;
if (Vmr9.IsVMR9Connected)
{
Log.Debug("VideoPlayerVMR9: Connect VobSub's video pins");
IPin pinVobSubVideoIn = DsFindPin.ByDirection(vob, PinDirection.Input, 0);
IPin pinVobSubVideoOut = DsFindPin.ByDirection(vob, PinDirection.Output, 0);
// This is the pin that we will connect to vobsub's input.
IPin pinVideoTo = Vmr9.PinConnectedTo;
//.........这里部分代码省略.........