根据描述创建 QtGStreamer 管道的问题

Issue with creating QtGStreamer pipeline from description

我正在使用 Qt GStreamer 包装器并尝试创建如下管道:

QGst::ElementPtr bin = 
    QGst::Bin::fromDescription("videotestsrc ! videoscale 
    ! video/x-raw,width=100,height=100");

然而,当我 运行 这个时,我得到错误:

GStreamer-CRITICAL **: gst_bin_add: assertion 'GST_IS_ELEMENT (element)' failed
terminate called after throwing an instance of 'QGlib::Error'
what():  no element "video"

我认为 "/" 存在一些问题,但不确定如何解决。

gstreamer 管道具有:

gst-launch-1.0 -v  videotestsrc ! videoscale ! video/x-raw,width=100,height=100 
! xvimagesink -e --gst-debug-level=3 sync=false

工作正常。

我尝试转义引号,例如:

QGst::ElementPtr bin = 
    QGst::Bin::fromDescription(\""videotestsrc ! videoscale 
    ! video/x-raw,width=100,height=100\"");

但这给出了:

terminate called after throwing an instance of 'QGlib::Error'
what():  specified empty bin "bin", not allowed

在 GStreamer 中,这是 caps(元素功能)的语法:

video/x-raw,width=100,height=100

解析器期望它位于两个元素之间以确定它们应该如何连接。它本身不是一个元素。如果你想让管道解析,你可以在最后添加一个 identity 。这将产生一些未确定色彩空间的原始 100x100 视频帧。

您可能已经知道,在您连接一个水槽之前,该管道不会做任何事情。