gStreamer pipeline construction failure.
Robin Tucker
r.tucker at thermoteknix.com
Tue Mar 13 07:41:39 PDT 2012
Hi,
We've just started trying out gStreamer-Sharp to see if we can create
pipelines with a view to writing a media player component for our C#
software. Some pipelines can be created, linked and run no problem, but
others fail. Anyway I have a repro-case below that fails to link from
an avidemux element into an mpeg4 element programmatically, although it
works on the command line. Is there something really basic we're doing
incorrectly here?
We also don't seem to be able to get logging up and running from the
software either, although obviously the command-line displays it. Is this
possible?
Thanks for any help you can give.
Robin
using System.Windows.Forms;
using Gst;
using Gst.Interfaces;
namespace Test_gStreamer
{
public partial class MainForm : Form
{
#region Private Variables
// Pipeline.
private Gst.Pipeline MyPipeline;
// Elements.
private Gst.Element MyFileSource, MyDemux, MyMpeg4, MyDrawSink;
// Overlay adapter.
private XOverlayAdapter MySinkAdapter;
#endregion
public MainForm()
{
InitializeComponent();
// Initialise gStreamer.
Gst.Application.Init();
// Create new pipeline.
MyPipeline = new Gst.Pipeline();
Pipeline pipeline = new Pipeline("pipeline");
// Construct pipeline filescr -> avidemux -> mpeg4 ->
directdrawsink
MyFileSource = ElementFactory.Make("filesrc", "filesrc");
MyFileSource["location"] = "c:\\test.mp4";
MyDemux = ElementFactory.Make("avidemux", "avidemux");
MyMpeg4 = ElementFactory.Make("ffdec_mpeg4", "ffdec_mpeg4");
MyDrawSink = ElementFactory.Make("directdrawsink",
"directdrawsink");
// Output to our window.
MySinkAdapter = new XOverlayAdapter(MyDrawSink.Handle);
MySinkAdapter.XwindowId = (ulong)this.Handle;
// Add and link pipeline.
MyPipeline.Add(MyFileSource, MyDemux, MyMpeg4, MyDrawSink);
if (!MyFileSource.Link(MyDemux))
{
// Failed.
}
if (!MyDemux.Link(MyMpeg4))
{
// FAILS HERE
}
if (!MyMpeg4.Link(MyDrawSink))
{
// Failed.
}
// Play video.
MyPipeline.SetState(Gst.State.Playing);
}
}
}
More information about the gstreamer-devel
mailing list