gstreamer crashes after NewDecodedPad
Mirko
mirkogheinkel at gmail.com
Thu Jun 7 08:51:31 PDT 2012
hi all,
i just translated a python app to dotnet but even if i translate the code
line by line, it crashes after NewDecodedPad.
I already wrote a little player using playbin2 for to ensure, gstreamer
works with .net 2008 without getting any problem.
does anybody have a hint what could have gone wrong here ?
thank you in advance !
private void button1_Click(object sender, EventArgs e)
{
Gst.Application.Init();
Gst.BasePlugins.DecodeBin2 decodebin2;
playerApp.player = new Pipeline("player");
playerApp.source = new Gst.App.AppSrc("source");
playerApp.source.NeedData += new
Gst.App.NeedDataHandler(appsrc_NeedData);
decodebin2 =
(Gst.BasePlugins.DecodeBin2)ElementFactory.Make("decodebin2", "decodebin2");
decodebin2.NewDecodedPad += new
Gst.BasePlugins.DecodeBin2.NewDecodedPadHandler(decodebin2_NewDecodedPad);
playerApp.audiosink = ElementFactory.Make("autoaudiosink",
"audio-output");
playerApp.videosink = ElementFactory.Make("glimagesink",
"video-output") as Gst.Video.VideoSink;
playerApp.queue_a = ElementFactory.Make("queue", "queue_a");
playerApp.queue_v = ElementFactory.Make("queue", "queue_v");
playerApp.player.Add(playerApp.source, decodebin2,
playerApp.audiosink, playerApp.videosink, playerApp.queue_a,
playerApp.queue_v, null);
Element.Link(playerApp.source, decodebin2);
Element.Link(playerApp.queue_v, playerApp.videosink);
Element.Link(playerApp.queue_a, playerApp.audiosink);
playerApp.player.Bus.AddSignalWatch();
playerApp.player.Bus.SyncMessage += new
SyncMessageHandler(Bus_SyncMessage);
playerApp.player.Bus.Message += new MessageHandler(Bus_Message);
playerApp.player.SetState(Gst.State.Playing);
}
void decodebin2_NewDecodedPad(object o,
Gst.BasePlugins.DecodeBin2.NewDecodedPadArgs args)
{
//caps = pad.get_caps()[0].get_name()
//if caps.startswith('video'):
// #print 'setting video pad'
// pad.link(self.queuev.get_pad("sink"))
//elif caps.startswith('audio'):
// #print 'setting audio pad'
// pad.link(self.queuea.get_pad("sink"))
Caps caps = args.Pad.Caps;
if (caps.ToString().Contains("video"))
{
// after linking this pad, it crashes
Pad p = playerApp.queue_v.GetStaticPad("sink");
if (p.IsLinked)
return;
args.Pad.Link(p);
}
else
{
Pad p = playerApp.queue_a.GetStaticPad("sink");
if (p.IsLinked)
return;
args.Pad.Link(p);
}
}
void appsrc_NeedData(object o, Gst.App.NeedDataArgs args)
{
// this is called 2x (ok)
string s = lstSegments.Dequeue();
if (s == null) return;
byte[] data = File.ReadAllBytes(s);
Gst.Buffer buffer = new Gst.Buffer(data);
playerApp.source.PushBuffer(buffer);
}
void Bus_SyncMessage(object o, SyncMessageArgs args)
{
if (args.Message.Structure.Name.Contains("prepare-xwindow"))
{
Gst.Interfaces.XOverlayAdapter overlayAdapter = new
Gst.Interfaces.XOverlayAdapter(playerApp.videosink.Handle);
overlayAdapter.XwindowId = (ulong)this.Handle;
}
}
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/gstreamer-crashes-after-NewDecodedPad-tp4655221.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list