当前位置: 首页>>代码示例>>C#>>正文


C# Pipeline.GetState方法代码示例

本文整理汇总了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 ();
    }
开发者ID:draek,项目名称:cil-bindings,代码行数:53,代码来源:GtkVideoPlayer.cs


注:本文中的Pipeline.GetState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。