本文整理汇总了C#中Pipeline.GetState方法的典型用法代码示例。如果您正苦于以下问题:C# Pipeline.GetState方法的具体用法?C# Pipeline.GetState怎么用?C# Pipeline.GetState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pipeline
的用法示例。
在下文中一共展示了Pipeline.GetState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ButtonOpenClicked
void ButtonOpenClicked(object sender, EventArgs args)
{
FileChooserDialog dialog = new FileChooserDialog ("Open", this, FileChooserAction.Open, new object[] { "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept });
dialog.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
if (dialog.Run () == (int)ResponseType.Accept)
{
_pipelineOK = false;
if (_pipeline != null)
{
_pipeline.SetState (Gst.State.Null);
_pipeline.Dispose ();
}
_scale.Value = 0;
_pipeline = new Pipeline (string.Empty);
Element playbin = ElementFactory.Make ("playbin", "playbin");
XvImageSink sink = XvImageSink.Make ("sink");
if (_pipeline == null)
Console.WriteLine ("Unable to create pipeline");
if (playbin == null)
Console.WriteLine ("Unable to create element 'playbin'");
if (sink == null)
Console.WriteLine ("Unable to create element 'sink'");
_pipeline.Add (playbin);
XOverlayAdapter sinkadapter = new XOverlayAdapter (sink);
sinkadapter.XwindowId = gdk_x11_drawable_get_xid (_da.GdkWindow.Handle);
playbin.SetProperty ("video-sink", sink);
playbin.SetProperty ("uri", "file://" + dialog.Filename);
StateChangeReturn sret = _pipeline.SetState (Gst.State.Playing);
if (sret == StateChangeReturn.Async)
{
State state, pending;
sret = _pipeline.GetState (out state, out pending, Clock.Second * 5);
}
if (sret == StateChangeReturn.Success)
_pipelineOK = true;
else
Console.WriteLine ("State change failed for {0} ({1})\n", dialog.Filename, sret);
}
dialog.Destroy ();
}