本文整理汇总了C#中Pipeline.SetState方法的典型用法代码示例。如果您正苦于以下问题:C# Pipeline.SetState方法的具体用法?C# Pipeline.SetState怎么用?C# Pipeline.SetState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pipeline
的用法示例。
在下文中一共展示了Pipeline.SetState方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: Main
public static void Main (string [] args) {
Application.Init();
if (args.Length != 1) {
Console.Error.WriteLine ("usage: mono queueexample.exe <filename>\n");
return;
}
Element pipeline = new Pipeline ("pipeline");
Element filesrc = ElementFactory.Make ("filesrc", "disk_source");
filesrc.SetProperty ("location", args[0]);
Element decode = ElementFactory.Make ("mad", "decode");
Element queue = ElementFactory.Make ("queue", "queue");
Element audiosink = ElementFactory.Make ("alsasink", "play_audio");
Bin bin = (Bin) pipeline;
bin.AddMany (filesrc, decode, queue, audiosink);
Element.LinkMany (filesrc, decode, queue, audiosink);
pipeline.SetState (State.Playing);
EventLoop (pipeline);
pipeline.SetState (State.Null);
}
示例4: Main
public static void Main(string [] args)
{
Application.Init ();
Pipeline pipeline = new Pipeline ("pipeline");
Element source = ElementFactory.Make ("filesrc", "source");
typefind = TypeFindElement.Make ("typefind");
Element sink = ElementFactory.Make ("fakesink", "sink");
source.SetProperty ("location", args[0]);
typefind.HaveType += OnHaveType;
pipeline.AddMany (source, typefind, sink);
source.Link (typefind);
typefind.Link (sink);
pipeline.SetState (State.Paused);
pipeline.SetState (State.Null);
source.Dispose ();
typefind.Dispose ();
sink.Dispose ();
pipeline.Dispose ();
}
示例5: 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();
}
示例6: 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);
}
示例7: 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 ();
}
示例8: 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);
}