如何通过名称获取 gstreamer 管道?

How can I get a gstreamer pipeline by name?

如果在我的服务器上创建管道 GstElement *pipeline = gst_pipeline_new (session_id); 每当用户访问 http://myurl.com/new?session_id=123&file_path=/vids/vid.mp4 (mp4 videos are streamed to a RTMP server), how can I use the name of the pipeline "123" to set the pipeline state to not playing when the user visits http://myurl.com/to_not_playin?session_id=123? Each visit to http://myurl.com/new 在新线程中启动 gstreamer(因为我的网络服务器是异步的并且我希望多个用户使用该平台)然后创建并链接不同的 elements/pads。

在 GStreamer 中无法通过名称获取管道,如果需要,您应该自己存储 name -> pipeline 映射。

如何在 GStreamer 管道上设置名称:

gst_element_set_name(pipeline, "gbxpipeline");

如何在消息处理程序中获取命名管道:

if (!strcmp("gbxpipeline", strcmp(GST_MESSAGE_SRC_NAME(msg))) {
    // You've got your pipeline!
}

参考:https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-set-name