Vala gstreamer链接失败

时间:2015-01-18 19:21:01

标签: linux gstreamer pipeline vala

我在vala中播放mjpeg流时遇到问题。

我构建了我的管道,它只使用两个元素(videotestsrc和cluttersink),但是如果我想添加更多,我得到一个“内部数据流错误”和“流媒体任务暂停,原因没有链接(-1) )”。 如果我手动运行管道,它可以工作:

gst-launch souphttpsrc location=http://mjpeg.sanford.io/count.mjpeg !  multipartdemux ! jpegdec ! autovideosink

这是我的流媒体课程:

public class Stream : Clutter.Actor {

    Clutter.Texture video;

    public dynamic Gst.Element playbin;


    public Gst.Pipeline pipeline;
    public  Gst.Element demux;
    public  Gst.Element jpegdec;
    public  Gst.Element outputsink;

    public  dynamic Gst.Element src;
    public  dynamic Gst.Element video_sink;

    public Stream(){

        print("stream");
        video = new Clutter.Texture ();

        this.pipeline = new Gst.Pipeline("videopipeline");
        this.src = Gst.ElementFactory.make ("souphttpsrc","httpsrc");
        this.demux = Gst.ElementFactory.make ("multipartdemux","demux");
        this.jpegdec = Gst.ElementFactory.make ("jpegdec","jpegdec");
        this.outputsink = Gst.ElementFactory.make("autovideosink","output");    
        this.video_sink = Gst.ElementFactory.make ("cluttersink", "source");

        this.video_sink.texture = video;

        this.src.set("location","http://mjpeg.sanford.io/count.mjpeg");


        this.pipeline.add_many(this.src,this.demux,this.jpegdec,this.outputsink,this.video_sink);
        this.src.link(this.demux);
        this.demux.link(this.jpegdec);
        this.jpegdec.link(this.outputsink);
        this.outputsink.link(this.video_sink);

        this.add_child (video);

        this.pipeline.set_state(Gst.State.PLAYING);

    }





}

以下是完整的错误日志: http://pastebin.com/b9GnA5ke

1 个答案:

答案 0 :(得分:1)

您不能将两个接收器元素连接到jpegdec。如果你需要这样做,你应该使用" tee"元素,同时确保使用添加"队列"到发球台的每个分支。

从jpegdec到cluttersink也可能存在上限问题。我按如下方式构建它:

souphttpsrc !  multipartdemux ! jpegdec ! tee name=t ! queue ! videoconvert ! autovideosink

t. ! queue ! videoconvert ! cluttersink