# 运行 HTTP 用例

Source: [https://docs.qualcomm.com/doc/80-70022-50SC/topic/run-http-use-cases.html](https://docs.qualcomm.com/doc/80-70022-50SC/topic/run-http-use-cases.html)

使用通过 HTTP 远程连接的控制应用程序来控制 GStD 框架。

## 前提条件

- 启用 `wlan0`有关说明，请参阅[使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70022-254/how_to.html#use-ssh)。
- 系统重启后，Wi-Fi 应启动并运行。

        ifconfig   // Note down wlan0_IPCopy to clipboard
- 请选择未使用的端口，配置 HTTP 用例：

        vi /etc/default/gstd
             OPTARGS=" --enable-http-protocol --http-address=<wlan0_IP_address> --http-port=5002"       // Replace the port 5002 if the port is not free; For <wlan0_IP_address>, enter your device WLAN IP address
        
             XDG_RUNTIME_DIR=/dev/socket/weston
        
             WAYLAND_DISPLAY=wayland-1
        
        systemctl daemon-reload
        systemctl restart gstdCopy to clipboard
- 下载 [Postman](https://www.postman.com/downloads/) 以运行 HTTP 用例。

##  单流编码

1. 创建 pipeline - POST：

        http://<wlan0_IP_address>:5002/pipelines?name=pipeline_http_enc1&description=qtiqmmfsrc name=camsrc ! video,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=4 output-io-mode=5 ! h264parse ! queue ! mp4mux ! queue ! filesink location=/tmp/http_enc1.mp4Copy to clipboard
2. 控制 pipeline：
    - 播放 pipeline - PUT：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_enc1/state?name=playingCopy to clipboard
    - 发送 EOS - POST：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_enc1/event?name=eosCopy to clipboard
    - 停止 pipeline - PUT：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_enc1/state?name=nullCopy to clipboard

## 多流编码

1. 创建 pipeline - POST

        http://<wlan0_IP_address>:5002/pipelines?name=pipeline_http_enc2&description=qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=4 output-io-mode=5 ! queue ! h264parse ! mp4mux ! queue ! filesink location=/tmp/http_mux1.mp4 camsrc. ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=4 output-io-mode=5 ! queue ! h264parse ! mp4mux ! queue ! filesink location=/tmp/http_mux2.mp4Copy to clipboard
2. 控制 pipeline：
    - 播放 pipeline - PUT：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_enc2/state?name=playingCopy to clipboard
    - 发送 EOS - POST：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_enc2/event?name=eosCopy to clipboard
    - 停止 pipeline - PUT：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_enc2/state?name=nullCopy to clipboard

## 单显示器

1. 创建 pipeline - POST：

        http://<wlan0_IP_address>:5002/pipelines?name=pipeline_http_dis1&description=qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! waylandsink fullscreen=true async=true sync=falseCopy to clipboard
2. 控制 pipeline：
    - 播放 pipeline - PUT：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_dis1/state?name=playingCopy to clipboard
    - 发送 EOS - POST：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_dis1/event?name=eosCopy to clipboard
    - 停止 pipeline - PUT：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_dis1/state?name=nullCopy to clipboard

## 多显示器

1. 创建 pipeline - POST：

        http://<wlan0_IP_address>:5002/pipelines?name=pipeline_http_dis2&description=qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! waylandsink x=0 y=0 width=500 height=400 async=true sync=false camsrc. ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! waylandsink x=510 y=0 width=500 height=400 async=true sync=falseCopy to clipboard
2. 控制 pipeline：
    - 播放 pipeline - PUT：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_dis2/state?name=playingCopy to clipboard
    - 发送 EOS - POST：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_dis2/event?name=eosCopy to clipboard
    - 停止 pipeline - PUT：

            http://<wlan0_IP_address>:5002/pipelines/pipeline_http_dis2/state?name=nullCopy to clipboard

**Parent Topic:** [GStD 框架](https://docs.qualcomm.com/doc/80-70022-50SC/topic/gstreamer-daemon.html)

Last Published: Nov 05, 2025

[Previous Topic
运行 TCP 用例](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/tcp-use-cases.md) [Next Topic
通过 MQTT 启用消息支持](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/mqtt-configuration.md)