1

I'm trying to load a gstreamer plugin using boost::process to call gst-launch.

When I load the plugin via the command line everything works well:

gst-launch-1.0 videotestsrc ! privacyprotector ! fakesink

If I use the full path to the executable, it also works well:

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

But if I try to find the executable in the path and send the parameters as a separate parameter to bp::child, then gstreamer is unable to find the plugin:

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

Is there anything specific to parameter handling I'm missing?

ruipacheco
  • 15,025
  • 19
  • 82
  • 138

1 Answers1

1

I think the arguments need to be a vector:

So, try

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();
}

Which, on my system prints:

WARNING: erroneous pipeline: no element "privacyprotector"
Success: 1
sehe
  • 374,641
  • 47
  • 450
  • 633