gpt4 book ai didi

c - 从 GstElement 管道启动 GstRTSPServer

转载 作者:行者123 更新时间:2023-12-03 17:34:43 29 4
gpt4 key购买 nike

我正在用 C 做一个 Gstreamer 1.0 应用程序。
管道是根据运行时的用户配置和系统“状态”构建的。
因此,我使用了多个 GstElements,这些 GstElements 稍后添加并链接到“GstElement 管道”。
这是一个更好地理解的最小示例:

GstElement *pipeline = gst_pipeline_new("mypipeline");
...
GstElement *src = gst_element_factory_make("videotestsrc", NULL);
...
gst_bin_add_many(GST_BIN(pipeline), src, enc, pay, NULL);
gst_element_link_many(src, enc, pay, NULL);
...

这个管道应该由 GstRTSPMediaFactory 启动.我在这里面临的问题是 gst_rtsp_media_factory_set_launch 函数只接受 const gchar *管道。

因此我的问题是,如果你们中的任何人都知道其中任何一个的功能
  • 改造 GstElement *pipelineconst gchar*表示(有点反向 gst_parse )
  • 或从 GstElement *pipeline 启动 GstRTSPMediaFactory (请参阅下面的编辑#1)

  • 任何帮助深表感谢!谢谢你。

    编辑 #1:

    来自 gst-rtsp-server documentation :

    The default implementation of GstRTSPMediaFactory allows you to easily create GStreamer pipelines using the gst-launch syntax. It is possible to create a GstRTSPMediaFactory subclass that uses different methods for constructing pipelines.



    因此,从 GstElement 启动 GstRTSPMediaFactory 在技术上是可能的。这种方法的附加问题:有人知道这样的 GstRTSPMediaFactory 子类实现吗?

    最佳答案

    是的,gst-rtsp-server存储库有 an example在其子文件夹示例中。总结一下:创建 GstRTSPMediaFactory 的子类并覆盖 create_element()虚方法。

    顺便说一句,这也意味着您之前提供的 2 个选项不正确;

    • transforming the GstElement pipeline to a const gchar representation (kinda reverse gst_parse)


    这是不可能的,因为与声明式启动 API 相比,程序化 API 更具表现力,并且允许您执行更多操作(即使是一个简单的示例:注册回调)。

    • or launching the GstRTSPMediaFactory from a GstElement *pipeline (see edit #1 below)


    你的想法正好相反:当 GStreamer RTSP 服务器收到开始播放的请求时,它将使用 GstRTSPMediaFactory推出 GstPipeline基于您的 get_element()执行。反之亦然,每个管道都启动自己的 RTSP 服务器。

    关于c - 从 GstElement 管道启动 GstRTSPServer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47269193/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com