mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-04 06:29:31 +00:00
Set pipeline to null state in the end and use the real NeedData event of appsrc
This commit is contained in:
parent
103aea2d7d
commit
7613c99e54
1 changed files with 4 additions and 3 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue