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


C# Pipeline.Add方法代码示例

本文整理汇总了C#中Pipeline.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Pipeline.Add方法的具体用法?C# Pipeline.Add怎么用?C# Pipeline.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pipeline的用法示例。


在下文中一共展示了Pipeline.Add方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_apply_each_filter_in_order_added

		public void Should_apply_each_filter_in_order_added()
		{
			var pipeline = new Pipeline<int, string>();
			pipeline.Add(new AddToInput(2));
			pipeline.Add(new AppendToOutput("@"));
			pipeline.Finally(x => x + "!");

			var output = pipeline.Execute(2);

			Assert.That(output, Is.EqualTo("[email protected]"));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:11,代码来源:PipelineFuncTests.cs

示例2: Should_throw_exception_when_chain_goes_too_far

		public void Should_throw_exception_when_chain_goes_too_far()
		{
			var pipeline = new Pipeline<int, string>();
			pipeline.Add(new AddToInput(3));

			Assert.Throws<EndOfChainException>(() => pipeline.Execute(2));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:7,代码来源:FinallyTests.cs

示例3: Main

  public static void Main (string[] args) {
    Application.Init();
    loop = new MainLoop();

    // Construct all the elements
    pipeline = new Pipeline();
    appsrc = new Gst.App.AppSrc ("AppSrcDemo");
    Element color = ElementFactory.Make ("ffmpegcolorspace");
    Element sink = ElementFactory.Make ("autovideosink");

    // Link the elements
    pipeline.Add (appsrc, color, sink);
    Element.Link (appsrc, color, sink);

    // Set the caps on the AppSrc to RGBA, 640x480, 4 fps, square pixels
    Gst.Video.VideoFormat fmt = (BitConverter.IsLittleEndian) ? Gst.Video.VideoFormat.BGRA : Gst.Video.VideoFormat.ARGB;
    appsrc.Caps = Gst.Video.VideoUtil.FormatNewCaps (fmt, 640, 480, 4, 1, 1, 1);

    // Connect the handlers
    appsrc.NeedData += PushAppData;
    pipeline.Bus.AddSignalWatch();
    pipeline.Bus.Message += MessageHandler;

    // Run, loop, run!
    pipeline.SetState (State.Playing);
    loop.Run();
    pipeline.SetState (State.Null);
  }
开发者ID:jwzl,项目名称:ossbuild,代码行数:28,代码来源:AppSrc.cs

示例4: TestBufferOwnership

  public void TestBufferOwnership () {
    MyTransformIp.Register ();

    Pipeline pipeline = new Pipeline ();
    Element src = ElementFactory.Make ("fakesrc");
    src["num-buffers"] = 10;
    Element transform = new MyTransformIp ();
    Element sink = ElementFactory.Make ("fakesink");

    pipeline.Add (src, transform, sink);
    Element.Link (src, transform, sink);

    Gst.GLib.MainLoop loop = new Gst.GLib.MainLoop ();

    pipeline.Bus.AddWatch (delegate (Bus bus, Message message) {
                             switch (message.Type) {
                             case MessageType.Error:
                                 Enum err;
                                 string msg;

                                 message.ParseError (out err, out msg);
                                 Assert.Fail (String.Format ("Error message: {0}", msg));
                                 loop.Quit ();
                                 break;
                               case MessageType.Eos:
                                   loop.Quit ();
                                   break;
                                 }
                                 return true;
                               });

    pipeline.SetState (State.Playing);
    loop.Run ();
    pipeline.SetState (State.Null);
  }
开发者ID:jwzl,项目名称:ossbuild,代码行数:35,代码来源:BaseTransformTest.cs

示例5: Should_not_require_final_function_when_chain_short_circuits

		public void Should_not_require_final_function_when_chain_short_circuits()
		{
			var pipeline = new Pipeline<int, string>();
			pipeline.Add(new ShortCircuit());

			var output = pipeline.Execute(2);

			Assert.That(output, Is.EqualTo("2"));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:9,代码来源:FinallyTests.cs

示例6: Filter_can_modify_output

		public void Filter_can_modify_output()
		{
			var pipeline = new Pipeline<int, string>();
			pipeline.Add(new AppendToOutput("#"));
			pipeline.Finally(x => x + "!");

			var output = pipeline.Execute(2);

			Assert.That(output, Is.EqualTo("2!#"));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:10,代码来源:PipelineFuncTests.cs

示例7: Main

  public static void Main (string [] args) {
    Application.Init();

    Pipeline pipeline = new Pipeline ("pipeline");
    FileSrc source = FileSrc.Make ("source");
    typefind = TypeFindElement.Make ("typefind");
    FakeSink sink = FakeSink.Make ("sink");

    source.Location = args[0];

    typefind.HaveType += OnHaveType;

    pipeline.Add (source, typefind, sink);
    source.Link (typefind);
    typefind.Link (sink);

    pipeline.SetState (State.Paused);
    pipeline.SetState (State.Null);

    pipeline.Dispose();
  }
开发者ID:jwzl,项目名称:ossbuild,代码行数:21,代码来源:TypeFind.cs

示例8: Main

  static void Main (string[] args) {
    Gst.Application.Init ();
    TransformSample.Register ();

    Pipeline pipeline = new Pipeline ();
    Element videotestsrc = ElementFactory.Make ("videotestsrc");
    Element transform = new TransformSample ();
    Element ffmpegcolorspace = ElementFactory.Make ("ffmpegcolorspace");
    Element videosink = ElementFactory.Make ("autovideosink");

    pipeline.Add (videotestsrc, transform, ffmpegcolorspace, videosink);
    Element.Link (videotestsrc, transform, ffmpegcolorspace, videosink);

    Gst.GLib.MainLoop loop = new Gst.GLib.MainLoop ();

    pipeline.Bus.AddSignalWatch();
    pipeline.Bus.Message += delegate (object sender, MessageArgs margs) {
      Message message = margs.Message;

      switch (message.Type) {
        case MessageType.Error:
          Enum err;
          string msg;

          message.ParseError (out err, out msg);
          System.Console.WriteLine (String.Format ("Error message: {0}", msg));
          loop.Quit ();
          break;
        case MessageType.Eos:
          loop.Quit ();
          break;
      }
    };

    pipeline.SetState (State.Playing);
    loop.Run ();
    pipeline.SetState (State.Null);
  }
开发者ID:jwzl,项目名称:ossbuild,代码行数:38,代码来源:TransformSample.cs

示例9: ConstructPipeline

  private void ConstructPipeline() {
    pipeline = new Pipeline ("pipeline");

    filesrc = ElementFactory.Make ("filesrc", "filesrc") as FileSrc;
    filesink = ElementFactory.Make ("filesink", "filesink") as FileSink;
    audioconvert = ElementFactory.Make ("audioconvert", "audioconvert");
    encoder = ElementFactory.Make ("wavenc", "wavenc");
    decodebin = ElementFactory.Make ("decodebin2", "decodebin") as DecodeBin2;
    decodebin.NewDecodedPad += OnNewDecodedPad;

    pipeline.Add (filesrc, decodebin, audioconvert, encoder, filesink);

    filesrc.Link (decodebin);
    audioconvert.Link (encoder);
    encoder.Link (filesink);

    pipeline.Bus.AddWatch (new BusFunc (OnBusMessage));
  }
开发者ID:jwzl,项目名称:ossbuild,代码行数:18,代码来源:DecodeBinTranscoder.cs

示例10: 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

示例11: Run

    public static void Run () {

      MySrc.Register ();
      MySink.Register ();

      MySrc mysrc = Gst.ElementFactory.Make ("mysrc") as MySrc;
      MySink mysink = Gst.ElementFactory.Make ("mysink") as MySink;

      Gst.Pipeline pipeline = new Pipeline ("pipeline");
      pipeline.Add (mysrc, mysink);
      Assert.IsTrue (mysrc.Link (mysink));

      loop = new MainLoop ();

      pipeline.Bus.AddWatch (new BusFunc (BusCb));
      pipeline.SetState (Gst.State.Playing);

      loop.Run ();

      pipeline.SetState (Gst.State.Null);
    }
开发者ID:jwzl,项目名称:ossbuild,代码行数:21,代码来源:ElementTest.cs


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