【问题标题】:GStreamer pipeline crashes in ValaVala 中的 GStreamer 管道崩溃
【发布时间】:2014-11-25 16:57:34
【问题描述】:

我在 Vala 的应用程序中使用 GStreamer 来播放 .mp4 视频。我正在尝试从教程制作管道:filesrc -> decodebin -> pulsesink,但我的应用程序总是崩溃。这是我的代码:

this.pipeline = new Pipeline ("mypipeline");
this.src = ElementFactory.make ("filesrc", "video");
src.set("location", downloadFileName);
this.decode = ElementFactory.make ("decodebin", "decode");
this.sink = ElementFactory.make ("autoaudiosink", "sink");
this.pipeline.add_many (this.src, this.decode,  this.sink);

if (this.src == null)
    error("Gstreamer element init error 1");
if (this.decode == null)
    error("Gstreamer element init error 2");
if (this.sink == null)
    error("Gstreamer element init error 3");

if (!this.src.link (this.decode))
    error("GStreamer linking problems.");
if (!this.decode.link (this.sink))
    error("GStreamer linking problems 2.");

this.pipeline.set_state (State.PLAYING);

而且我的应用程序总是因“GStreamer 链接问题 2”而崩溃​​。

gst-launch-1.0 filesrc location=<filename> ! decodebin ! pulsesink

工作正常,所以我认为这是与 Vala 相关的问题(当然是我的实际文件名)。

你能告诉我我做错了什么吗?

【问题讨论】:

    标签: video gstreamer vala


    【解决方案1】:

    你应该在 decodebin 和 sink 之间放置一个 videoconvert,还要确保你调用了 gst_init(我猜你做了,但检查一下也无妨)。

    编辑:这里的实际问题是,一旦 decodebin 在内部构建了它的内部元素链,它就会暴露它的源 pad,这发生在从 READY 到 PAUSED 的转换中。这意味着您需要连接到它的“pad-added”信号,并在您提供的回调中进行连接。我确信谷歌搜索“gstreamer pad-added”会产生有趣的信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-02
      • 1970-01-01
      • 2016-09-02
      • 2013-10-28
      • 2017-08-29
      • 1970-01-01
      相关资源
      最近更新 更多