本文整理汇总了C#中IGraphBuilder类的典型用法代码示例。如果您正苦于以下问题:C# IGraphBuilder类的具体用法?C# IGraphBuilder怎么用?C# IGraphBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IGraphBuilder类属于命名空间,在下文中一共展示了IGraphBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: SetupFilterGraph
protected override void SetupFilterGraph(IFilterGraph graph)
{
_audioEngine = new X3DAudioEngine();
_graph = graph as IGraphBuilder;
base.SetupFilterGraph(graph);
SetupAudio();
}
开发者ID:Inner-room,项目名称:VrPlayer,代码行数:7,代码来源:MediaGraphPlayer.cs
示例3: RenderAsfWriterWithProfile
public static IBaseFilter RenderAsfWriterWithProfile(DisposalCleanup dc, IGraphBuilder graph, string profileData,
string outputFile)
{
if (dc == null) throw new ArgumentNullException("dc");
if (graph == null) throw new ArgumentNullException("graph");
if (string.IsNullOrEmpty(profileData)) throw new ArgumentNullException("profileData");
if (string.IsNullOrEmpty(outputFile)) throw new ArgumentNullException("outputFile");
int hr = 0;
var asfWriterFilter = (IBaseFilter) new WMAsfWriter();
dc.Add(asfWriterFilter);
hr = graph.AddFilter(asfWriterFilter, Resources.DefaultAsfWriterName);
DsError.ThrowExceptionForHR(hr);
// Create an appropriate IWMProfile from the data
IWMProfileManager profileManager = ProfileManager.CreateInstance();
dc.Add(profileManager);
IntPtr wmProfile = profileManager.LoadProfileByData(profileData);
dc.Add(wmProfile);
// Set the profile on the writer
var configWriter = (IConfigAsfWriter2) asfWriterFilter;
configWriter.ConfigureFilterUsingProfile(wmProfile);
hr = ((IFileSinkFilter) asfWriterFilter).SetFileName(outputFile, null);
DsError.ThrowExceptionForHR(hr);
return asfWriterFilter;
}
开发者ID:naik899,项目名称:VideoMaker,代码行数:31,代码来源:StandardFilters.cs
示例4: PlayCinematic
// Starts playing a new cinematic
public void PlayCinematic(string file, int x, int y, int w, int h)
{
// Lame bugfix: DirectShow and Fullscreen doesnt like eachother
if (CVars.Instance.Get("r_fs", "0", CVarFlags.ARCHIVE).Integer == 1)
{
if (AlterGameState)
{
playing = true;
StopCinematic();
}
return;
}
// Check if file exists
if (FileCache.Instance.Contains(file))
file = FileCache.Instance.GetFile(file).FullName;
else
{
if (AlterGameState)
{
playing = true;
StopCinematic();
}
Common.Instance.WriteLine("PlayCinematic: Could not find video: {0}", file);
return;
}
// Have the graph builder construct its the appropriate graph automatically
this.graphBuilder = (IGraphBuilder)new FilterGraph();
int hr = graphBuilder.RenderFile(file, null);
DsError.ThrowExceptionForHR(hr);
mediaControl = (IMediaControl)this.graphBuilder;
mediaEventEx = (IMediaEventEx)this.graphBuilder;
videoWindow = this.graphBuilder as IVideoWindow;
basicVideo = this.graphBuilder as IBasicVideo;
// Setup the video window
hr = this.videoWindow.put_Owner(Renderer.Instance.form.Handle);
DsError.ThrowExceptionForHR(hr);
hr = this.videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings | WindowStyle.ClipChildren);
DsError.ThrowExceptionForHR(hr);
// Set the video size
//int lWidth, lHeight;
//hr = this.basicVideo.GetVideoSize(out lWidth, out lHeight);
hr = this.videoWindow.SetWindowPosition(x, y, w, h);
videoWindow.put_FullScreenMode((CVars.Instance.Get("r_fs", "0", CVarFlags.ARCHIVE).Integer == 1) ? OABool.True : OABool.False);
DsError.ThrowExceptionForHR(hr);
// Run the graph to play the media file
hr = this.mediaControl.Run();
DsError.ThrowExceptionForHR(hr);
playing = true;
if (AlterGameState)
Client.Instance.state = CubeHags.common.ConnectState.CINEMATIC;
Common.Instance.WriteLine("Playing cinematic: {0}", file);
EventCode code;
}
开发者ID:maesse,项目名称:CubeHags,代码行数:61,代码来源:Cinematic.cs
示例5: AddFilterFromClsid
public static IBaseFilter AddFilterFromClsid(IGraphBuilder graphBuilder, Guid clsid, string name)
{
int hr = 0;
IBaseFilter filter = null;
if (graphBuilder == null)
throw new ArgumentNullException("graphBuilder");
try
{
Type type = Type.GetTypeFromCLSID(clsid);
filter = (IBaseFilter)Activator.CreateInstance(type);
hr = graphBuilder.AddFilter(filter, name);
DsError.ThrowExceptionForHR(hr);
}
catch
{
if (filter != null)
{
Marshal.ReleaseComObject(filter);
filter = null;
}
}
return filter;
}
开发者ID:Rainking720,项目名称:MediaBrowser.Theater,代码行数:27,代码来源:FilterGraphTools.cs
示例6: GetInterface
private void GetInterface()
{
object o;
int hr;
m_pGraph = (IGraphBuilder)new FilterGraph();
IBaseFilter pSource;
hr = m_pGraph.AddSourceFilter(@"C:\SourceForge\mflib\Test\Media\AspectRatio4x3.wmv", null, out pSource);
DsError.ThrowExceptionForHR(hr);
IBaseFilter pEVR = (IBaseFilter)new EnhancedVideoRenderer();
hr = m_pGraph.AddFilter(pEVR, "EVR");
DsError.ThrowExceptionForHR(hr);
ICaptureGraphBuilder2 cgb;
cgb = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
hr = cgb.SetFiltergraph(m_pGraph);
DsError.ThrowExceptionForHR(hr);
hr = cgb.RenderStream(null, MediaType.Video, pSource, null, pEVR);
DsError.ThrowExceptionForHR(hr);
IMFGetService gs = pEVR as IMFGetService;
hr = gs.GetService(MFServices.MR_VIDEO_MIXER_SERVICE, typeof(IMFVideoProcessor).GUID, out o);
MFError.ThrowExceptionForHR(hr);
m_vp = o as IMFVideoProcessor;
}
开发者ID:GoshaDE,项目名称:SuperMFLib,代码行数:27,代码来源:IMFVideoProcessorTest.cs
示例7: EnableFFDShowSubtitles
public static void EnableFFDShowSubtitles(IGraphBuilder graphBuilder)
{
// no instance of engine yet created or no ffdshow api, try to find it
IBaseFilter baseFilter = null;
DirectShowUtil.FindFilterByClassID(graphBuilder, FFDShowAPI.FFDShowVideoGuid, out baseFilter);
if (baseFilter == null)
DirectShowUtil.FindFilterByClassID(graphBuilder, FFDShowAPI.FFDShowVideoDXVAGuid, out baseFilter);
if (baseFilter == null)
DirectShowUtil.FindFilterByClassID(graphBuilder, FFDShowAPI.FFDShowVideoRawGuid, out baseFilter);
if (baseFilter != null)
{
IffdshowDec ffdshowDec = baseFilter as IffdshowDec;
if (ffdshowDec != null)
{
// use a temporary instance of the API, as it is only used here, to disable subs
FFDShowAPI tempffdshowAPI = new FFDShowAPI((object)baseFilter);
tempffdshowAPI.DoShowSubtitles = true;
Log.Info("FFDshow interfaces found -> Subtitles disabled");
tempffdshowAPI.Dispose();
}
else
{
DirectShowUtil.ReleaseComObject(baseFilter);
}
}
}
开发者ID:MediaPortal,项目名称:MediaPortal-1,代码行数:27,代码来源:FFDShowEngine.cs
示例8: ProfileAndMachineParser
public ProfileAndMachineParser(IGraphBuilder graphBuilder, XmlNode structureMapNode, XmlMementoCreator creator)
{
_profileBuilder = graphBuilder.GetProfileBuilder();
_graphBuilder = graphBuilder;
_structureMapNode = structureMapNode;
_creator = creator;
}
开发者ID:hp4711,项目名称:structuremap,代码行数:7,代码来源:ProfileAndMachineParser.cs
示例9: AddFilterById
public static IBaseFilter AddFilterById(IGraphBuilder graph, Guid guid, string name)
{
Ensure.IsNotNull(Log, graph, "graph is null");
IBaseFilter filter = null;
try
{
var type = Type.GetTypeFromCLSID(guid);
filter = (IBaseFilter)Activator.CreateInstance(type);
var hr = graph.AddFilter(filter, name);
DsError.ThrowExceptionForHR(hr);
}
catch (Exception ex)
{
if (filter != null)
{
graph.RemoveFilter(filter);
Marshal.ReleaseComObject(filter);
filter = null;
}
Log.Fatal(string.Format("Filter {0} is not added to the graph", name) + ex);
}
return filter;
}
开发者ID:markTwen,项目名称:TStreamSource,代码行数:28,代码来源:DShowUtils.cs
示例10: AddGraphToRot
/// <summary>Adds a graph to the ROT.</summary>
/// <param name="graph">The graph to be added.</param>
/// <returns>A cookie that can be used to remove this graph from the ROT.</returns>
private static RunningObjectTableCookie AddGraphToRot(IGraphBuilder graph)
{
if (graph == null) throw new ArgumentNullException("graph");
IRunningObjectTable rot = null;
IMoniker moniker = null;
try
{
// Get the ROT.
rot = GetRunningObjectTable(0);
// Create a moniker for the grpah
int pid;
using (Process p = Process.GetCurrentProcess())
{
pid = p.Id;
}
IntPtr unkPtr = Marshal.GetIUnknownForObject(graph);
string item = string.Format("FilterGraph {0} pid {1}", ((int)unkPtr).ToString("x8"), pid.ToString("x8"));
Marshal.Release(unkPtr);
moniker = CreateItemMoniker("!", item);
// Registers the graph in the running object table
int cookieValue = rot.Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, graph, moniker);
return new RunningObjectTableCookie(cookieValue);
}
finally
{
// Releases the COM objects
if (moniker != null) while (Marshal.ReleaseComObject(moniker) > 0) ;
if (rot != null) while (Marshal.ReleaseComObject(rot) > 0) ;
}
}
开发者ID:spokanedj,项目名称:remotepotato,代码行数:35,代码来源:GraphPublisher.cs
示例11: ConnectFilter
public static int ConnectFilter(IGraphBuilder graph, IBaseFilter up, IBaseFilter down)
{
IPin pinSrc = null;
int i = 0;
while ( (pinSrc = DsFindPin.ByDirection(up, PinDirection.Output, i++) ) != null )
{
IPin pinDest = null;
int j = 0;
while((pinDest = DsFindPin.ByDirection(down, PinDirection.Input, j++)) != null)
{
try
{
ConnectFilters(graph, pinSrc, pinDest, true);
}
catch(Exception e)
{
Marshal.FinalReleaseComObject(pinDest);
continue;
}
//�ɹ�
Marshal.FinalReleaseComObject(pinSrc);
Marshal.FinalReleaseComObject(pinDest);
return 0;
}
Marshal.FinalReleaseComObject(pinSrc);
}
return -1;
}
开发者ID:crazyender,项目名称:Console-Player,代码行数:29,代码来源:Interface.cs
示例12: Build
public override void Build(IGraphBuilder builder)
{
foreach(var v in this)
{
v.Build(builder); //thats it :)
}
//get the last item
}
开发者ID:dbremner,项目名称:Cortex,代码行数:8,代码来源:Block.cs
示例13: attachInstances
private void attachInstances(PluginFamily family, XmlElement familyElement, IGraphBuilder builder)
{
familyElement.ForEachChild(INSTANCE_NODE).Do(element =>
{
InstanceMemento memento = _mementoCreator.CreateMemento(element);
family.AddInstance(memento);
});
}
开发者ID:hp4711,项目名称:structuremap,代码行数:8,代码来源:FamilyParser.cs
示例14: Build
public override void Build(IGraphBuilder builder)
{
//we already gave the proper links so just act as a forwarder
Condition.Build(builder);
OnTrue.Build(builder);
OnFalse.Build(builder);
//OnTrue and OnFalse
}
开发者ID:DrItanium,项目名称:ImageProcessingApplication,代码行数:8,代码来源:IfStatements.cs
示例15: Split
/// <summary>
/// Divides the supplied graph to its connected subgraphs.
/// </summary>
public static IGraph[] Split(IGraph initial, IGraphBuilder builder)
{
// A list with the nodes awaiting to be processed
NodeCollection nodes = initial.Nodes.Clone() as NodeCollection;
// A list with the subgraphs
IGraph subgraph = null;
ArrayList subgraphs = new ArrayList();
while (nodes.Count > 0)
{
INode node = nodes[0];
nodes.RemoveAt(0);
subgraph = builder.Create();
subgraph.Nodes.Add(node);
int i = 0;
while (i < subgraph.Nodes.Count)
{
node = subgraph.Nodes[i];
foreach (ILink link in node.InLinks)
{
if (!subgraph.Nodes.Contains(link.Origin))
{
subgraph.Nodes.Add(link.Origin);
nodes.Remove(link.Origin);
}
if (!subgraph.Links.Contains(link))
subgraph.Links.Add(link);
}
foreach (ILink link in node.OutLinks)
{
if (!subgraph.Nodes.Contains(link.Destination))
{
subgraph.Nodes.Add(link.Destination);
nodes.Remove(link.Destination);
}
if (!subgraph.Links.Contains(link))
subgraph.Links.Add(link);
}
i++;
}
subgraphs.Add(subgraph);
}
IGraph[] result = new IGraph[subgraphs.Count];
for (int i = 0; i < subgraphs.Count; i++)
result[i] = subgraphs[i] as IGraph;
return result;
}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:61,代码来源:GraphSplitter.cs
示例16: Parse
public void Parse(IGraphBuilder builder)
{
var familyParser = new FamilyParser(builder);
forEachNode(DEFAULT_INSTANCE).Do(familyParser.ParseDefaultElement);
forEachNode(ADD_INSTANCE_NODE).Do(familyParser.ParseInstanceElement);
ParseProfiles(builder);
}
开发者ID:satish860,项目名称:StructureMap3,代码行数:9,代码来源:ConfigurationParser.cs
示例17: ResultController
public ResultController(IUserProfileBusinessLogic userProfileBusinessLogic, IUserIngredientBusinessLogic userIngredientBusinessLogic, IUserContext userContext, IGraphBuilder graphBuilder, IUserWeightBusinessLogic userWeightBusinessLogic, IGraphLineOptionViewTypeConverter graphLineOptionViewTypeConverter)
{
this.graphLineOptionViewTypeConverter = graphLineOptionViewTypeConverter;
this.userIngredientBusinessLogic = userIngredientBusinessLogic;
this.userContext = userContext;
this.graphBuilder = graphBuilder;
this.userWeightBusinessLogic = userWeightBusinessLogic;
this.userProfileBusinessLogic = userProfileBusinessLogic;
}
开发者ID:yodiz,项目名称:CarbonFitness,代码行数:9,代码来源:ResultController.cs
示例18: Build
public override void Build(IGraphBuilder builder)
{
//do nothing
//we can do the linkage here
if(OnFalseHook != null)
builder.Link(Index, OnFalseHook.First().Index, "[label = \"f\"]");
if(OnTrueHook != null)
builder.Link(Index, OnTrueHook.First().Index, "[label = \"t\"]");
}
开发者ID:dbremner,项目名称:Cortex,代码行数:9,代码来源:BinaryOperation.cs
示例19: Open
public void Open(string file)
{
/* Creates the GraphBuilder COM object */
m_graph = new FilterGraphNoThread() as IGraphBuilder;
if (m_graph == null)
throw new Exception("Could not create a graph");
IBaseFilter renderer = CreateVideoMixingRenderer9(m_graph, 1);
var filterGraph = m_graph as IFilterGraph2;
if (filterGraph == null)
throw new Exception("Could not QueryInterface for the IFilterGraph2");
IBaseFilter sourceFilter;
/* Have DirectShow find the correct source filter for the Uri */
int hr = filterGraph.AddSourceFilter(file, file, out sourceFilter);
DsError.ThrowExceptionForHR(hr);
/* We will want to enum all the pins on the source filter */
IEnumPins pinEnum;
hr = sourceFilter.EnumPins(out pinEnum);
DsError.ThrowExceptionForHR(hr);
IntPtr fetched = IntPtr.Zero;
IPin[] pins = { null };
/* Counter for how many pins successfully rendered */
int pinsRendered = 0;
/* Loop over each pin of the source filter */
while (pinEnum.Next(pins.Length, pins, fetched) == 0)
{
if (filterGraph.RenderEx(pins[0],
AMRenderExFlags.None,
IntPtr.Zero) >= 0)
pinsRendered++;
Marshal.ReleaseComObject(pins[0]);
}
Marshal.ReleaseComObject(pinEnum);
Marshal.ReleaseComObject(sourceFilter);
if (pinsRendered == 0)
throw new Exception("Could not render any streams from the source Uri");
m_mediaControl = m_graph as IMediaControl;
}
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:55,代码来源:MediaPlayer.cs
示例20: RenderWavDestination
public static IBaseFilter RenderWavDestination(DisposalCleanup dc, IGraphBuilder graph)
{
if (dc == null) throw new ArgumentNullException("dc");
if (graph == null) throw new ArgumentNullException("graph");
IBaseFilter wavDest =
FilterGraphTools.AddFilterFromClsid(graph, WavDestinationFilterId, Resources.DefaultWavDestinationName);
dc.Add(wavDest);
return wavDest;
}
开发者ID:pusp,项目名称:o2platform,代码行数:11,代码来源:StandardFilters.cs
注:本文中的IGraphBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论