From 09768306073494699640aa43084153e908b54d26 Mon Sep 17 00:00:00 2001 From: langhuihui <178529795@qq.com> Date: Mon, 24 Apr 2023 13:17:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8B=89=E6=B5=81=E7=9A=84=E5=A4=B4?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=8C=85?= =?UTF-8?q?=E5=90=AB=E9=9F=B3=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + pull.go | 5 +++++ 3 files changed, 50 insertions(+) create mode 100644 README.en.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..beccadf --- /dev/null +++ b/README.en.md @@ -0,0 +1,44 @@ +_[简体中文](https://github.com/Monibuca/plugin-hdl) | English_ +# HDL Plugin + +The main function of the HDL plugin is to provide access to the HTTP-FLV protocol. + +## Plugin Address + +https://github.com/Monibuca/plugin-hdl + +## Plugin Introduction +```go +import ( + _ "m7s.live/plugin/hdl/v4" +) +``` + +## Default Plugin Configuration + +```yaml +hdl: + http: # Refer to global configuration for format + publish: # Refer to global configuration for format + subscribe: # Refer to global configuration for format + pull: # Format: https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE +``` + +## Plugin Features + +### Pulling HTTP-FLV Streams from M7S + +If the live/test stream already exists in M7S, then HTTP-FLV protocol can be used for playback. If the listening port is not configured, then the global HTTP port is used (default 8080). + +```bash +ffplay http://localhost:8080/hdl/live/test.flv +``` + +### M7S Pull HTTP-FLV Streams from Remote + +The available API is: +`/hdl/api/pull?target=[HTTP-FLV address]&streamPath=[stream identifier]&save=[whether to save configuration (leave blank if not)]` + +### Get a List of All HDL Streams + +`/hdl/api/list` \ No newline at end of file diff --git a/README.md b/README.md index 6ff7bff..eb019d5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +_[English](https://github.com/Monibuca/plugin-hdl/blob/v4/README.en.md) | 简体中文_ # HDL插件 HDL插件主要功能是提供HTTP-FLV协议的访问 diff --git a/pull.go b/pull.go index 0e60033..8f69a05 100644 --- a/pull.go +++ b/pull.go @@ -58,6 +58,11 @@ func (puller *HDLPuller) Connect() (err error) { if _, err = io.ReadFull(puller, head); err == nil { if head[0] != 'F' || head[1] != 'L' || head[2] != 'V' { err = codec.ErrInvalidFLV + } else { + configCopy := hdlConfig.GetPublishConfig() + configCopy.PubAudio = head[4]&0x04 != 0 + configCopy.PubVideo = head[4]&0x01 != 0 + puller.Config = &configCopy } } }