Browse Source

refactor(plugin): rename rtsp source to video source

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang 2 years ago
parent
commit
0e1b3159fe

+ 1 - 1
.github/workflows/build_packages.yaml

@@ -186,7 +186,7 @@ jobs:
           - sources/random
           - sources/zmq
           - sources/sql
-          - sources/rtsp
+          - sources/video
           - functions/accumulateWordCount
           - functions/countPlusOne
           - functions/echo

+ 1 - 1
Makefile

@@ -90,7 +90,7 @@ PLUGINS := sinks/file \
 	sources/random \
 	sources/zmq \
 	sources/sql \
-	sources/rtsp \
+	sources/video \
 	sinks/tdengine \
 	functions/accumulateWordCount \
 	functions/countPlusOne \

+ 4 - 4
docs/directory.json

@@ -234,8 +234,8 @@
 									"path": "rules/sources/plugin/random"
 								},
 								{
-									"title": "RTSP 视频源",
-									"path": "rules/sources/plugin/rtsp"
+									"title": "视频源",
+									"path": "rules/sources/plugin/video"
 								}
 							]
 						}
@@ -819,8 +819,8 @@
 									"path": "rules/sources/plugin/random"
 								},
 								{
-									"title": "RTSP source",
-									"path": "rules/sources/plugin/rtsp"
+									"title": "Video source",
+									"path": "rules/sources/plugin/video"
 								}
 							]
 						}

+ 10 - 10
docs/en_US/rules/sources/plugin/rtsp.md

@@ -1,25 +1,25 @@
-# RTSP Source
+# Video Source
 
 <span style="background:green;color:white;">stream source</span>
 <span style="background:green;color:white">scan table source</span>
 
-The source will query rtsp video streams by `ffmpeg` command to get images.
+The source will query video streams such as RTSP encoded stream by `ffmpeg` command to get images.
 
 ## Compile & deploy plugin
 
 ```shell
 # cd $eKuiper_src
-# go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/sources/Rtsp.so extensions/sources/rtsp/rtsp.go
-# cp plugins/sources/Rtsp.so $eKuiper_install/plugins/sources
-# cp plugins/sources/rtsp.json $eKuiper_install/etc/sources
-# cp plugins/sources/rtsp.yaml $eKuiper_install/etc/sources
+# go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/sources/Video.so extensions/sources/video/video.go
+# cp plugins/sources/Video.so $eKuiper_install/plugins/sources
+# cp plugins/sources/video.json $eKuiper_install/etc/sources
+# cp plugins/sources/video.yaml $eKuiper_install/etc/sources
 ```
 
 Restart the eKuiper server to activate the plugin.
 
 ## Configuration
 
-The configuration for this source is `$ekuiper/etc/sources/rtsp.yaml`. The format is as below:
+The configuration for this source is `$ekuiper/etc/sources/video.yaml`. The format is as below:
 
 ```yaml
 default:
@@ -35,11 +35,11 @@ dedup:
 ```
 ### Global configurations
 
-Use can specify the global rtsp source settings here. The configuration items specified in `default` section will be taken as default settings for the source when running this source.
+Use can specify the global video source settings here. The configuration items specified in `default` section will be taken as default settings for the source when running this source.
 
 ### url
 
-The url address for the video streaming
+The url address for the video streaming.
 
 ### interval
 
@@ -55,7 +55,7 @@ If you have a specific connection that need to overwrite the default settings, y
 ```
 demo (
 		...
-	) WITH (FORMAT="JSON", CONF_KEY="ext", TYPE="rtsp");
+	) WITH (FORMAT="JSON", CONF_KEY="ext", TYPE="video");
 ```
 
 The configuration keys "ext" will be used.

+ 9 - 9
docs/zh_CN/rules/sources/plugin/rtsp.md

@@ -1,25 +1,25 @@
-# RTSP 
+# 视频
 
 <span style="background:green;color:white;">stream source</span>
 <span style="background:green;color:white">scan table source</span>
 
-RTSP 源会通过 `ffmpeg` 命令查询 RTSP 视频流获取图片
+视频源会通过 `ffmpeg` 命令查询视频流,例如 RTSP 视频流获取图片
 
 ## 编译和部署插件
 
 ```shell
 # cd $eKuiper_src
-# go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/sources/Rtsp.so extensions/sources/rtsp/rtsp.go
-# cp plugins/sources/Rtsp.so $eKuiper_install/plugins/sources
-# cp plugins/sources/rtsp.json $eKuiper_install/etc/sources
-# cp plugins/sources/rtsp.yaml $eKuiper_install/etc/sources
+# go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/sources/Video.so extensions/sources/video/video.go
+# cp plugins/sources/Video.so $eKuiper_install/plugins/sources
+# cp plugins/sources/video.json $eKuiper_install/etc/sources
+# cp plugins/sources/video.yaml $eKuiper_install/etc/sources
 ```
 
 重新启动 eKuiper 服务器以激活插件。
 
 ## 配置
 
-该源的配置为 `$ekuiper/etc/sources/rtsp.yaml`。格式如下:
+该源的配置为 `$ekuiper/etc/sources/video.yaml`。格式如下:
 
 ```yaml
 default:
@@ -38,7 +38,7 @@ dedup:
 
 ### url
 
-RTSP 视频源地址
+视频源地址
 
 ### interval
 
@@ -54,7 +54,7 @@ RTSP 视频源地址
 ```
 demo (
 		...
-	) WITH (FORMAT="JSON", CONF_KEY="ext", TYPE="rtsp");
+	) WITH (FORMAT="JSON", CONF_KEY="ext", TYPE="video");
 ```
 
 配置键 "ext" 将被使用。

+ 1 - 1
extensions/sources/rtsp/install.sh

@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright 2021 EMQ Technologies Co., Ltd.
+# Copyright 2021-2022 EMQ Technologies Co., Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.

+ 9 - 9
extensions/sources/rtsp/rtsp.go

@@ -27,12 +27,12 @@ import (
 const RTSP_DEFAULT_INTERVAL = 10000
 const FRAMENUMBER = 5
 
-type RTSPPullSource struct {
+type VideoPullSource struct {
 	url      string
 	interval int
 }
 
-func (rps *RTSPPullSource) Configure(_ string, props map[string]interface{}) error {
+func (rps *VideoPullSource) Configure(_ string, props map[string]interface{}) error {
 
 	if u, ok := props["url"]; ok {
 		if p, ok := u.(string); ok {
@@ -53,18 +53,18 @@ func (rps *RTSPPullSource) Configure(_ string, props map[string]interface{}) err
 	return nil
 }
 
-func (rps *RTSPPullSource) Open(ctx api.StreamContext, consumer chan<- api.SourceTuple, errCh chan<- error) {
+func (rps *VideoPullSource) Open(ctx api.StreamContext, consumer chan<- api.SourceTuple, errCh chan<- error) {
 	rps.initTimerPull(ctx, consumer, errCh)
 }
 
-func (rps *RTSPPullSource) Close(ctx api.StreamContext) error {
+func (rps *VideoPullSource) Close(ctx api.StreamContext) error {
 	logger := ctx.GetLogger()
-	logger.Infof("Closing rtsp pull source")
+	logger.Infof("Closing video pull source")
 
 	return nil
 }
 
-func (rps *RTSPPullSource) initTimerPull(ctx api.StreamContext, consumer chan<- api.SourceTuple, _ chan<- error) {
+func (rps *VideoPullSource) initTimerPull(ctx api.StreamContext, consumer chan<- api.SourceTuple, _ chan<- error) {
 	ticker := time.NewTicker(time.Millisecond * time.Duration(rps.interval))
 	logger := ctx.GetLogger()
 	defer ticker.Stop()
@@ -91,7 +91,7 @@ func (rps *RTSPPullSource) initTimerPull(ctx api.StreamContext, consumer chan<-
 	}
 }
 
-func (rps *RTSPPullSource) readFrameAsJpeg(ctx api.StreamContext) *bytes.Buffer {
+func (rps *VideoPullSource) readFrameAsJpeg(ctx api.StreamContext) *bytes.Buffer {
 	logger := ctx.GetLogger()
 	buf := bytes.NewBuffer(nil)
 	err := ffmpeg.Input(rps.url).
@@ -106,6 +106,6 @@ func (rps *RTSPPullSource) readFrameAsJpeg(ctx api.StreamContext) *bytes.Buffer
 	return buf
 }
 
-func Rtsp() api.Source {
-	return &RTSPPullSource{}
+func Video() api.Source {
+	return &VideoPullSource{}
 }

+ 6 - 6
extensions/sources/rtsp/rtsp.json

@@ -9,12 +9,12 @@
 			"website": "https://www.emqx.io"
 		},
 		"helpUrl": {
-			"en_US": "https://github.com/lf-edge/ekuiper/tree/master/docs/en_US/rules/sources/plugin/rtsp.md",
-			"zh_CN": "https://github.com/lf-edge/ekuiper/tree/master/docs/zh_CN/rules/sources/plugin/rtsp.md"
+			"en_US": "https://github.com/lf-edge/ekuiper/tree/master/docs/en_US/rules/sources/plugin/video.md",
+			"zh_CN": "https://github.com/lf-edge/ekuiper/tree/master/docs/zh_CN/rules/sources/plugin/video.md"
 		},
 		"description": {
-			"en_US": "eKuiper provides plug in support for RTSP source stream, which can pull images from RTSP server",
-			"zh_CN": "eKuiper 为提取 RTSP 源中的图片流提供了插件支持,该支持可从 RTSP 服务器提取图片消息并输入 eKuiper 处理管道。"
+			"en_US": "eKuiper provides plug in support for video stream, which can pull images from a video stream",
+			"zh_CN": "eKuiper 为提取视频源中的图片流提供了插件支持,该支持可从视频流提取图片消息并输入 eKuiper 处理管道。"
 		}
 	},
 	"properties": {
@@ -61,8 +61,8 @@
 		"category": "source",
 		"icon": "iconPath",
 		"label": {
-			"en_US": "RTSP PULL",
-			"zh_CN": "RTSP PULL"
+			"en_US": "Video",
+			"zh_CN": "视频"
 		}
 	}
 }

+ 1 - 1
extensions/sources/rtsp/rtsp.yaml

@@ -1,4 +1,4 @@
-#Global RTSP configurations
+#Global video source configurations
 default:
   # url of the request server address
   # username password, can be this format: rtsp://xxxxxx:xxxxxx@192.168.0.64:554/h265/ch1/main/av_stream