Set pipeline to null state in the end and use the real NeedData event of appsrc

This commit is contained in:
Sebastian Dröge 2009-06-21 10:28:05 +02:00
parent 103aea2d7d
commit 7613c99e54

View file

@ -18,7 +18,7 @@ public class AppSrcDemo
{ {
static MainLoop loop; static MainLoop loop;
static Gst.App.AppSrc appsrc; static Gst.App.AppSrc appsrc;
static Pipeline pipeline; static Pipeline pipeline;
public static void Main (string[] args) public static void Main (string[] args)
{ {
@ -39,16 +39,17 @@ public class AppSrcDemo
appsrc.Caps = Gst.Video.VideoUtil.FormatNewCaps(Gst.Video.VideoFormat.BGRA, 640, 480, 4, 1, 1, 1); appsrc.Caps = Gst.Video.VideoUtil.FormatNewCaps(Gst.Video.VideoFormat.BGRA, 640, 480, 4, 1, 1, 1);
// Connect the handlers // Connect the handlers
GLib.Signal.Lookup(appsrc, "need-data").AddDelegate(new EventHandler(PushAppData)); appsrc.NeedData += PushAppData;
pipeline.Bus.AddSignalWatch(); pipeline.Bus.AddSignalWatch();
pipeline.Bus.Message += MessageHandler; pipeline.Bus.Message += MessageHandler;
// Run, loop, run! // Run, loop, run!
pipeline.SetState(State.Playing); pipeline.SetState(State.Playing);
loop.Run(); loop.Run();
pipeline.SetState(State.Null);
} }
static void PushAppData(object o, EventArgs e) static void PushAppData(object o, Gst.App.NeedDataArgs args)
{ {
ulong mseconds = 0; ulong mseconds = 0;
if (appsrc.Clock != null) if (appsrc.Clock != null)