# GStreamer 守护进程

Source: [https://docs.qualcomm.com/doc/80-70014-50Y/topic/gstreamer-daemon.html](https://docs.qualcomm.com/doc/80-70014-50Y/topic/gstreamer-daemon.html)

GStreamer 守护进程（GStD）是一个简化创建自定义 GStreamer 程序任务的进程。它还消除了从头开始编写程序所需的样板代码。

GStD 独立运行，并在各种 IPC 机制上公开公共接口，以便其他进程与守护进程通信并控制守护进程。GStD 背后的设计遵循模型-视图-控制器（MVC）架构。

## GStD 项目

GStD 项目包括核心、GstdClient 和 IPC 接口。

GStD 提供内核和 IPC 端点。| GStD 设计组件 | 说明 |
| --- | --- |
| 核心 | 保存 GStreamer 守护进程 pipeline 的当前状态及其各自的状态、每个 pipeline 中的组件以及每个组件的属性等。 |
| IPC | <ul class="ul" id="gstreamer-daemon__ul_fqq_hdm_qbc"><br>                                    <li class="li">允许客户端程序使用进程间通信机制（如 TCP、HTTP、DBus、套接字等）更改 GStD 核心的状态。</li><br><br>                                    <li class="li">使自定义程序能够修改 GStD 内核的状态。例如：IPC 可用于执行以下操作：<ul class="ul" id="gstreamer-daemon__ul_adx_2dm_qbc"><br>                                            <li class="li">创建新 pipeline。</li><br><br>                                            <li class="li">将状态设置为播放。</li><br><br>                                            <li class="li">在 pipeline runtime 更改组件属性。</li><br><br>                                        </ul><br></li><br><br>                                </ul> |

自定义程序提供视图和客户端逻辑。| 定制应用设计 | 说明 |
| --- | --- |
| 查看 | <ul class="ul" id="gstreamer-daemon__ul_nnv_xdm_qbc"><br>                                    <li class="li">提供 GStD 核心状态的视觉反馈。</li><br><br>                                    <li class="li">表示图形用户界面、网页、命令行程序。</li><br><br>                                    <li class="li">使您能够查看由模型更新的视图。</li><br><br>                                </ul> |
| 客户端逻辑 | <ul class="ul" id="gstreamer-daemon__ul_okb_b2m_qbc"><br>                                    <li class="li">提供程序的自定义功能。</li><br><br>                                    <li class="li">使您能够使用 IPC 修改 GStD 内核或模型，并通过 GUI/视图接收反馈。</li><br><br>                                </ul> |

GStreamer 客户端（GstdClient）随项目一起分发。它是一个基于命令行的程序，通过 TCP 与 GStD 进行通信。

- GstdClient 允许您创建和启动 pipeline。
- 与 gst-launch 不同，GstdClient 允许您拥有多个活动 pipeline，这些 pipeline 能够控制 pipeline 并在创建 pipeline 后接收反馈。

有关 GStD 的详细信息，请参阅 [https://developer.ridgerun.com/wiki/index.php/GStreamer_Daemon](https://developer.ridgerun.com/wiki/index.php/GStreamer_Daemon)

## 运行 GStD

1. 启动 GStD：

        gstd
        # This will start the process in the background. Using 'gstd &' is not required becauses gstd daemonizes itself by default.
        
        # To run gstd in foreground
        gstd -D
        
        # To view a list of all supported options,
        gstd --help-all
        Copy to clipboard
2. 启动 GstdClient：

        gst-client
        # gstd prompt will appear like,
        # gstd>
        # In the prompt, we can interact with the server creating/playing pipelines, etc.
        
        # To list all the possible commands
        gstd> help
        
        # Alternatively, instead of opening gstd prompt, can give the command as argument to gst-client
        gst-client list-pipelines
        Copy to clipboard

- **[本地用例](https://docs.qualcomm.com/doc/80-70014-50Y/topic/local-use-cases.html)**
- **[TCP 用例](https://docs.qualcomm.com/doc/80-70014-50Y/topic/tcp-use-cases.html)**
- **[HTTP 用例](https://docs.qualcomm.com/doc/80-70014-50Y/topic/run-http-use-cases.html)**

Last Published: Nov 11, 2025

[Previous Topic
ML pipeline 的高效数据/控制流](https://docs.qualcomm.com/bundle/publicresource/80-70014-50Y/topics/efficient-data-control-flow.md) [Next Topic
本地用例](https://docs.qualcomm.com/bundle/publicresource/80-70014-50Y/topics/local-use-cases.md)