无法获得 boost::process 以找到 gstreamer 插件

问题描述

我正在尝试使用 boost::process 调用 gst-launch 加载 gstreamer 插件

当我通过命令行加载插件时,一切正常:

gst-launch-1.0 videotestsrc ! privacyprotector ! fakesink

如果我使用可执行文件的完整路径,它也能正常工作:

bp::child c("/opt/intel/openvino/data_processing/gstreamer/bin/gst-launch-1.0 videotestsrc ! privacyprotector ! fakesink",ec);

但是如果我尝试在路径中找到可执行文件并将参数作为单独的参数发送到 bp::child,那么 gstreamer 将无法找到插件

bp::child c(bp::search_path("gst-launch-1.0"),bp::args("videotestsrc ! privacyprotector ! fakesink"),ec);

是否有我遗漏的特定于参数处理的内容

解决方法

我认为参数必须是一个向量:

所以,试试

Live On Wandbox

#include <boost/process.hpp>
#include <iostream>
namespace bp = boost::process;

int main() {
    std::error_code ec;

    bp::child c(
        bp::search_path("gst-launch-1.0"),bp::args = {"videotestsrc","!","privacyprotector","fakesink"},ec);

    c.wait();
    std::cout << ec.message() << ": " << c.exit_code();
}

在我的系统上打印:

WARNING: erroneous pipeline: no element "privacyprotector"
Success: 1