mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-09-27 05:35:57 +08:00
feat: remove settings dir
This commit is contained in:
23
api.go
23
api.go
@@ -783,29 +783,6 @@ func (s *Server) GetConfig(_ context.Context, req *pb.GetConfigRequest) (res *pb
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Server) ModifyConfig(_ context.Context, req *pb.ModifyConfigRequest) (res *pb.SuccessResponse, err error) {
|
||||
var conf *config.Config
|
||||
if req.Name == "global" {
|
||||
conf = &s.Config
|
||||
defer s.SaveConfig()
|
||||
} else {
|
||||
p, ok := s.Plugins.Get(req.Name)
|
||||
if !ok {
|
||||
err = pkg.ErrNotFound
|
||||
return
|
||||
}
|
||||
defer p.SaveConfig()
|
||||
conf = &p.Config
|
||||
}
|
||||
var modified map[string]any
|
||||
err = yaml.Unmarshal([]byte(req.Yaml), &modified)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
conf.ParseModifyFile(modified)
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Server) GetRecordList(ctx context.Context, req *pb.ReqRecordList) (resp *pb.ResponseList, err error) {
|
||||
if s.DB == nil {
|
||||
err = pkg.ErrNoDB
|
||||
|
434
doc_CN/fmp4_technology_overview.md
Normal file
434
doc_CN/fmp4_technology_overview.md
Normal file
@@ -0,0 +1,434 @@
|
||||
# 基于HLS v7的fMP4技术实现与应用
|
||||
|
||||
## 作者前言
|
||||
|
||||
作为Monibuca流媒体服务器的开发者,我们一直在寻求提供更高效、更灵活的流媒体解决方案。随着Web前端技术的发展,特别是Media Source Extensions (MSE) 的广泛应用,我们逐渐认识到传统的流媒体传输方案已难以满足现代应用的需求。在探索与实践中,我们发现fMP4(fragmented MP4)技术能够很好地连接传统媒体格式与现代Web技术,为用户提供更流畅的视频体验。
|
||||
|
||||
Monibuca项目在MP4插件的实现中,我们面临着如何将已录制的MP4文件高效转换为支持MSE播放的格式这一挑战。通过深入研究HLS v7协议和fMP4容器格式,我们最终实现了一套完整的解决方案,支持MP4到fMP4的实时转换、多段MP4的无缝合并,以及针对前端MSE播放的优化。本文将分享我们在这一过程中的技术探索和实现思路。
|
||||
|
||||
## 引言
|
||||
|
||||
随着流媒体技术的发展,视频分发方式不断演进。从传统的整体式下载到渐进式下载,再到现在广泛使用的自适应码率流媒体技术,每一步演进都极大地提升了用户体验。本文将探讨基于HLS v7的fMP4(fragmented MP4)技术实现,以及它如何与现代Web前端中的媒体源扩展(Media Source Extensions, MSE)结合,打造高效流畅的视频播放体验。
|
||||
|
||||
## HLS协议演进与fMP4的引入
|
||||
|
||||
### 传统HLS与其局限性
|
||||
|
||||
HTTP Live Streaming (HLS)是由Apple公司开发的HTTP自适应比特率流媒体通信协议。在早期版本中,HLS主要使用TS(Transport Stream)切片作为媒体容器格式。虽然TS格式具有良好的容错性和流式传输特性,但也存在一些局限性:
|
||||
|
||||
1. 相比于MP4等容器格式,TS文件体积较大
|
||||
2. 每个TS切片都需要包含完整的初始化信息,导致冗余
|
||||
3. 与Web技术栈的其他部分集成度不高
|
||||
|
||||
### HLS v7与fMP4
|
||||
|
||||
HLS v7版本引入了对fMP4(fragmented MP4)切片的支持,这是HLS协议的一个重大进步。fMP4作为媒体容器格式相比TS具有以下优势:
|
||||
|
||||
1. 文件体积更小,传输效率更高
|
||||
2. 与DASH等其他流媒体协议共享相同的底层容器格式,有利于统一技术栈
|
||||
3. 更好地支持现代编解码器
|
||||
4. 与MSE(Media Source Extensions)有更好的兼容性
|
||||
|
||||
在HLS v7中,通过在播放列表中使用`#EXT-X-MAP`标签指定初始化片段,可以实现fMP4切片的无缝播放。
|
||||
|
||||
## MP4文件结构与fMP4的基本原理
|
||||
|
||||
### 传统MP4结构
|
||||
|
||||
传统的MP4文件遵循ISO Base Media File Format(ISO BMFF)规范,主要由以下几个部分组成:
|
||||
|
||||
1. **ftyp** (File Type Box): 指示文件的格式和兼容性信息
|
||||
2. **moov** (Movie Box): 包含媒体的元数据信息,如轨道信息、编解码器参数等
|
||||
3. **mdat** (Media Data Box): 包含实际的媒体数据
|
||||
|
||||
在传统MP4中,`moov`通常位于文件开头或结尾,包含了整个视频的所有元信息和索引数据。这种结构对于流式传输不友好,因为播放器需要先获取完整的`moov`才能开始播放。
|
||||
|
||||
以下是MP4文件的box结构示意图:
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
MP4[MP4文件] --> FTYP[ftyp box]
|
||||
MP4 --> MOOV[moov box]
|
||||
MP4 --> MDAT[mdat box]
|
||||
MOOV --> MVHD[mvhd: 电影头信息]
|
||||
MOOV --> TRAK1[trak: 视频轨道]
|
||||
MOOV --> TRAK2[trak: 音频轨道]
|
||||
TRAK1 --> TKHD1[tkhd: 轨道头信息]
|
||||
TRAK1 --> MDIA1[mdia: 媒体信息]
|
||||
TRAK2 --> TKHD2[tkhd: 轨道头信息]
|
||||
TRAK2 --> MDIA2[mdia: 媒体信息]
|
||||
MDIA1 --> MDHD1[mdhd: 媒体头信息]
|
||||
MDIA1 --> HDLR1[hdlr: 处理器信息]
|
||||
MDIA1 --> MINF1[minf: 媒体信息容器]
|
||||
MDIA2 --> MDHD2[mdhd: 媒体头信息]
|
||||
MDIA2 --> HDLR2[hdlr: 处理器信息]
|
||||
MDIA2 --> MINF2[minf: 媒体信息容器]
|
||||
MINF1 --> STBL1[stbl: 采样表]
|
||||
MINF2 --> STBL2[stbl: 采样表]
|
||||
STBL1 --> STSD1[stsd: 采样描述]
|
||||
STBL1 --> STTS1[stts: 时间戳信息]
|
||||
STBL1 --> STSC1[stsc: 块到采样映射]
|
||||
STBL1 --> STSZ1[stsz: 采样大小]
|
||||
STBL1 --> STCO1[stco: 块偏移]
|
||||
STBL2 --> STSD2[stsd: 采样描述]
|
||||
STBL2 --> STTS2[stts: 时间戳信息]
|
||||
STBL2 --> STSC2[stsc: 块到采样映射]
|
||||
STBL2 --> STSZ2[stsz: 采样大小]
|
||||
STBL2 --> STCO2[stco: 块偏移]
|
||||
```
|
||||
|
||||
### fMP4的结构特点
|
||||
|
||||
fMP4(fragmented MP4)对传统MP4格式进行了重构,主要特点是:
|
||||
|
||||
1. 将媒体数据分割成多个片段(fragments)
|
||||
2. 每个片段包含自己的元数据和媒体数据
|
||||
3. 文件结构更适合流式传输
|
||||
|
||||
fMP4的主要组成部分:
|
||||
|
||||
1. **ftyp**: 与传统MP4相同,位于文件开头
|
||||
2. **moov**: 包含整体的轨道信息,但不包含具体的样本信息
|
||||
3. **moof** (Movie Fragment Box): 包含特定片段的元数据
|
||||
4. **mdat**: 包含与前面的moof相关联的媒体数据
|
||||
|
||||
以下是fMP4文件的box结构示意图:
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
FMP4[fMP4文件] --> FTYP[ftyp box]
|
||||
FMP4 --> MOOV[moov box]
|
||||
FMP4 --> MOOF1[moof 1: 片段1元数据]
|
||||
FMP4 --> MDAT1[mdat 1: 片段1媒体数据]
|
||||
FMP4 --> MOOF2[moof 2: 片段2元数据]
|
||||
FMP4 --> MDAT2[mdat 2: 片段2媒体数据]
|
||||
FMP4 -.- MOOFN[moof n: 片段n元数据]
|
||||
FMP4 -.- MDATN[mdat n: 片段n媒体数据]
|
||||
|
||||
MOOV --> MVHD[mvhd: 电影头信息]
|
||||
MOOV --> MVEX[mvex: 电影扩展]
|
||||
MOOV --> TRAK1[trak: 视频轨道]
|
||||
MOOV --> TRAK2[trak: 音频轨道]
|
||||
|
||||
MVEX --> TREX1[trex 1: 轨道扩展]
|
||||
MVEX --> TREX2[trex 2: 轨道扩展]
|
||||
|
||||
MOOF1 --> MFHD1[mfhd: 片段头]
|
||||
MOOF1 --> TRAF1[traf: 轨道片段]
|
||||
|
||||
TRAF1 --> TFHD1[tfhd: 轨道片段头]
|
||||
TRAF1 --> TFDT1[tfdt: 轨道片段基准时间]
|
||||
TRAF1 --> TRUN1[trun: 轨道运行信息]
|
||||
```
|
||||
|
||||
这种结构允许播放器在接收到初始的`ftyp`和`moov`后,可以立即开始处理后续接收到的`moof`+`mdat`片段,非常适合流式传输和实时播放。
|
||||
|
||||
## MP4到fMP4的转换原理
|
||||
|
||||
MP4到fMP4的转换过程可以通过以下时序图来说明:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant MP4 as 源MP4文件
|
||||
participant Demuxer as MP4解析器
|
||||
participant Muxer as fMP4封装器
|
||||
participant fMP4 as 目标fMP4文件
|
||||
|
||||
MP4->>Demuxer: 读取MP4文件
|
||||
Note over Demuxer: 解析文件结构
|
||||
Demuxer->>Demuxer: 提取ftyp信息
|
||||
Demuxer->>Demuxer: 解析moov box
|
||||
Demuxer->>Demuxer: 提取tracks信息<br>(视频、音频轨道)
|
||||
Demuxer->>Muxer: 传递tracks元数据
|
||||
|
||||
Muxer->>fMP4: 写入ftyp box
|
||||
Muxer->>Muxer: 创建适合流式传输的moov
|
||||
Muxer->>Muxer: 添加mvex扩展
|
||||
Muxer->>fMP4: 写入moov box
|
||||
|
||||
loop 对每个媒体样本
|
||||
Demuxer->>MP4: 读取样本数据
|
||||
Demuxer->>Muxer: 传递样本
|
||||
Muxer->>Muxer: 创建moof box<br>(包含时间和位置信息)
|
||||
Muxer->>Muxer: 创建mdat box<br>(包含实际媒体数据)
|
||||
Muxer->>fMP4: 写入moof+mdat对
|
||||
end
|
||||
|
||||
Note over fMP4: 完成转换
|
||||
```
|
||||
|
||||
从上图可以看出,转换过程主要包含三个关键步骤:
|
||||
|
||||
1. **解析源MP4文件**:读取并解析原始MP4文件的结构,提取出视频轨、音频轨的相关信息,包括编解码器类型、帧率、分辨率等元数据。
|
||||
|
||||
2. **创建fMP4的初始化部分**:构建文件头和初始化部分,包括ftyp和moov box,它们作为初始化段(initialization segment),包含了解码器需要的所有信息,但不包含实际的媒体样本数据。
|
||||
|
||||
3. **为每个样本创建片段**:逐个读取原始MP4中的样本数据,然后为每个样本(或一组样本)创建对应的moof和mdat box对。
|
||||
|
||||
这种转换方式使得原本只适合下载后播放的MP4文件变成了适合流式传输的fMP4格式。
|
||||
|
||||
## MP4多段合并技术
|
||||
|
||||
### 用户需求:时间范围录像下载
|
||||
|
||||
在视频监控、课程回放和直播录制等场景中,用户经常需要下载特定时间范围内的录像内容。例如,一个安防系统的操作员可能只需要导出包含特定事件的视频片段,或者一个教育平台的学生可能只想下载课程中的重点部分。然而,由于系统通常按照固定时长(如30分钟或1小时)或特定事件(如直播开始/结束)来分割录制文件,用户需要的时间范围往往横跨多个独立的MP4文件。
|
||||
|
||||
在Monibuca项目中,我们针对这一需求,开发了基于时间范围查询和多文件合并的解决方案。用户只需指定所需内容的起止时间,系统会:
|
||||
|
||||
1. 查询数据库,找出所有与指定时间范围重叠的录像文件
|
||||
2. 从每个文件中提取相关的时间片段
|
||||
3. 将这些片段无缝合并为单个下载文件
|
||||
|
||||
这种方式极大地提升了用户体验,使其能够精确获取所需内容,而不必下载和浏览大量无关的视频内容。
|
||||
|
||||
### 数据库设计与时间范围查询
|
||||
|
||||
为支持时间范围查询,我们的录像文件元数据在数据库中包含以下关键字段:
|
||||
|
||||
- 流路径(StreamPath):标识视频源
|
||||
- 开始时间(StartTime):录像片段的开始时间
|
||||
- 结束时间(EndTime):录像片段的结束时间
|
||||
- 文件路径(FilePath):实际录像文件的存储位置
|
||||
- 文件类型(Type):文件格式,如"mp4"
|
||||
|
||||
当用户请求特定时间范围的录像时,系统执行类似以下的查询:
|
||||
|
||||
```sql
|
||||
SELECT * FROM record_streams
|
||||
WHERE stream_path = ? AND type = 'mp4'
|
||||
AND start_time <= ? AND end_time >= ?
|
||||
```
|
||||
|
||||
这将返回所有与请求时间范围有交集的录像片段,然后系统需要从中提取相关部分并合并。
|
||||
|
||||
### 多段MP4合并的技术挑战
|
||||
|
||||
合并多个MP4文件并非简单的文件拼接,而是需要处理以下技术挑战:
|
||||
|
||||
1. **时间戳连续性**:确保合并后视频的时间戳连续,没有跳跃或重叠
|
||||
2. **编解码一致性**:处理不同MP4文件可能使用不同编码参数的情况
|
||||
3. **元数据合并**:正确合并各文件的moov box信息
|
||||
4. **精确剪切**:从每个文件中精确提取用户指定时间范围的内容
|
||||
|
||||
在实际应用中,我们实现了两种合并策略:普通MP4合并和fMP4合并。这两种策略各有优势,适用于不同的应用场景。
|
||||
|
||||
### 普通MP4合并流程
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant User as 用户
|
||||
participant API as API服务
|
||||
participant DB as 数据库
|
||||
participant MP4s as 多个MP4文件
|
||||
participant Muxer as MP4封装器
|
||||
participant Output as 输出MP4文件
|
||||
|
||||
User->>API: 请求时间范围录像<br>(stream, startTime, endTime)
|
||||
API->>DB: 查询指定范围的录像记录
|
||||
DB-->>API: 返回符合条件的录像列表
|
||||
|
||||
loop 对每个MP4文件
|
||||
API->>MP4s: 读取文件
|
||||
MP4s->>Muxer: 解析文件结构
|
||||
Muxer->>Muxer: 解析轨道信息
|
||||
Muxer->>Muxer: 提取媒体样本
|
||||
Muxer->>Muxer: 调整时间戳保持连续性
|
||||
Muxer->>Muxer: 记录样本信息和偏移量
|
||||
Note over Muxer: 跳过时间范围外的样本
|
||||
end
|
||||
|
||||
Muxer->>Output: 写入ftyp box
|
||||
Muxer->>Output: 写入调整后的样本数据
|
||||
Muxer->>Muxer: 创建包含所有样本信息的moov
|
||||
Muxer->>Output: 写入合并后的moov box
|
||||
Output-->>User: 向用户提供合并后的文件
|
||||
```
|
||||
|
||||
这种方式下,合并过程主要是将不同MP4文件的媒体样本连续排列,并调整时间戳确保连续性。最后,重新生成一个包含所有样本信息的`moov` box。这种方法的优点是兼容性好,几乎所有播放器都能正常播放合并后的文件,适合用于下载和离线播放场景。
|
||||
|
||||
特别值得注意的是,在代码实现中,我们会处理参数中时间范围与实际录像时间的重叠关系,只提取用户真正需要的内容:
|
||||
|
||||
```go
|
||||
if i == 0 {
|
||||
startTimestamp := startTime.Sub(stream.StartTime).Milliseconds()
|
||||
var startSample *box.Sample
|
||||
if startSample, err = demuxer.SeekTime(uint64(startTimestamp)); err != nil {
|
||||
tsOffset = 0
|
||||
continue
|
||||
}
|
||||
tsOffset = -int64(startSample.Timestamp)
|
||||
}
|
||||
|
||||
// 在最后一个文件中,超出结束时间的帧会被跳过
|
||||
if i == streamCount-1 && int64(sample.Timestamp) > endTime.Sub(stream.StartTime).Milliseconds() {
|
||||
break
|
||||
}
|
||||
```
|
||||
|
||||
### fMP4合并流程
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant User as 用户
|
||||
participant API as API服务
|
||||
participant DB as 数据库
|
||||
participant MP4s as 多个MP4文件
|
||||
participant Muxer as fMP4封装器
|
||||
participant Output as 输出fMP4文件
|
||||
|
||||
User->>API: 请求时间范围录像<br>(stream, startTime, endTime)
|
||||
API->>DB: 查询指定范围的录像记录
|
||||
DB-->>API: 返回符合条件的录像列表
|
||||
|
||||
Muxer->>Output: 写入ftyp box
|
||||
Muxer->>Output: 写入初始moov box<br>(包含mvex)
|
||||
|
||||
loop 对每个MP4文件
|
||||
API->>MP4s: 读取文件
|
||||
MP4s->>Muxer: 解析文件结构
|
||||
Muxer->>Muxer: 解析轨道信息
|
||||
Muxer->>Muxer: 提取媒体样本
|
||||
|
||||
loop 对每个样本
|
||||
Note over Muxer: 检查样本是否在目标时间范围内
|
||||
Muxer->>Muxer: 调整时间戳
|
||||
Muxer->>Muxer: 创建moof+mdat对
|
||||
Muxer->>Output: 写入moof+mdat对
|
||||
end
|
||||
end
|
||||
|
||||
Output-->>User: 向用户提供合并后的文件
|
||||
```
|
||||
|
||||
fMP4的合并更加灵活,每个样本都被封装成独立的`moof`+`mdat`片段,保持了可独立解码的特性,更有利于流式传输和随机访问。这种方式特别适合与MSE和HLS结合,为实时流媒体播放提供支持,让用户能够在浏览器中直接高效地播放合并后的内容,而无需等待整个文件下载完成。
|
||||
|
||||
### 合并中的编解码兼容性处理
|
||||
|
||||
在多段录像合并过程中,我们面临的一个关键挑战是处理不同文件可能存在的编码参数差异。例如,在长时间录制过程中,摄像头可能因环境变化调整了视频分辨率,或者编码器可能重新初始化导致编码参数变化。
|
||||
|
||||
为了解决这一问题,Monibuca实现了一个智能的轨道版本管理系统,通过比较编码器特定数据(ExtraData)来识别变化:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Muxer as 合并器
|
||||
participant Track as 轨道管理器
|
||||
participant History as 轨道历史版本
|
||||
|
||||
loop 对每个新轨道
|
||||
Muxer->>Track: 检查轨道编码参数
|
||||
Track->>History: 比较已有轨道版本
|
||||
alt 发现匹配的轨道版本
|
||||
History-->>Track: 返回现有轨道
|
||||
Track-->>Muxer: 使用已有轨道
|
||||
else 无匹配版本
|
||||
Track->>Track: 创建新轨道版本
|
||||
Track->>History: 添加到历史版本库
|
||||
Track-->>Muxer: 使用新轨道
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
这种设计确保了即使原始录像中存在编码参数变化,合并后的文件也能保持正确的解码参数,为用户提供流畅的播放体验。
|
||||
|
||||
### 性能优化
|
||||
|
||||
在处理大型视频文件或大量并发请求时,合并过程的性能是一个重要考量。我们采取了以下优化措施:
|
||||
|
||||
1. **流式处理**:逐帧处理样本,避免将整个文件加载到内存
|
||||
2. **并行处理**:对多个独立任务(如文件解析)采用并行处理
|
||||
3. **智能缓存**:缓存常用的编码参数和文件元数据
|
||||
4. **按需读取**:仅读取和处理目标时间范围内的样本
|
||||
|
||||
这些优化使得系统能够高效处理大规模的录像合并请求,即使是跨越数小时或数天的长时间录像,也能在合理的时间内完成处理。
|
||||
|
||||
多段MP4合并功能极大地增强了Monibuca作为流媒体服务器的灵活性和用户体验,使用户能够精确获取所需的录像内容,无论原始录像如何分段存储。
|
||||
|
||||
## 媒体源扩展(MSE)与fMP4的兼容实现
|
||||
|
||||
### MSE技术概述
|
||||
|
||||
媒体源扩展(Media Source Extensions, MSE)是一种JavaScript API,允许网页开发者直接操作媒体流数据。它使得自定义的自适应比特率流媒体播放器可以完全在浏览器中实现,无需依赖外部插件。
|
||||
|
||||
MSE的核心工作原理是:
|
||||
1. 创建一个MediaSource对象
|
||||
2. 创建一个或多个SourceBuffer对象
|
||||
3. 将媒体片段追加到SourceBuffer中
|
||||
4. 浏览器负责解码和播放这些片段
|
||||
|
||||
### fMP4与MSE的完美适配
|
||||
|
||||
fMP4格式与MSE有着天然的兼容性,主要体现在:
|
||||
|
||||
1. fMP4的每个片段都可以独立解码
|
||||
2. 初始化段和媒体段的清晰分离符合MSE的缓冲区管理模型
|
||||
3. 时间戳的精确控制使得无缝拼接成为可能
|
||||
|
||||
以下时序图展示了fMP4如何与MSE配合工作:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Client as 浏览器客户端
|
||||
participant Server as 服务器
|
||||
participant MSE as MediaSource API
|
||||
participant Video as HTML5 Video元素
|
||||
|
||||
Client->>Video: 创建video元素
|
||||
Client->>MSE: 创建MediaSource对象
|
||||
Client->>Video: 设置video.src = URL.createObjectURL(mediaSource)
|
||||
MSE-->>Client: sourceopen事件
|
||||
|
||||
Client->>MSE: 创建SourceBuffer
|
||||
Client->>Server: 请求初始化段(ftyp+moov)
|
||||
Server-->>Client: 返回初始化段
|
||||
Client->>MSE: appendBuffer(初始化段)
|
||||
|
||||
loop 播放过程
|
||||
Client->>Server: 请求媒体段(moof+mdat)
|
||||
Server-->>Client: 返回媒体段
|
||||
Client->>MSE: appendBuffer(媒体段)
|
||||
MSE-->>Video: 解码并渲染帧
|
||||
end
|
||||
```
|
||||
|
||||
在Monibuca的实现中,我们针对MSE进行了特殊优化:为每一帧创建独立的moof和mdat。这种实现方式尽管会增加一些开销,但提供了极高的灵活性,特别适合于低延迟的实时流媒体场景和精确的帧级操作。
|
||||
|
||||
## HLS与fMP4在实际应用中的集成
|
||||
|
||||
在实际应用中,我们将fMP4技术与HLS v7协议结合,实现了基于时间范围的点播功能。系统可以根据用户指定的时间范围,从数据库中查找对应的MP4记录,然后生成fMP4格式的HLS播放列表:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Client as 客户端
|
||||
participant Server as HLS服务
|
||||
participant DB as 数据库
|
||||
participant MP4Plugin as MP4插件
|
||||
|
||||
Client->>Server: 请求fMP4.m3u8<br>带时间范围参数
|
||||
Server->>DB: 查询指定时间范围的MP4记录
|
||||
DB-->>Server: 返回记录列表
|
||||
|
||||
Server->>Server: 创建HLS v7播放列表<br>Version: 7
|
||||
loop 对每个记录
|
||||
Server->>Server: 计算时长
|
||||
Server->>Server: 添加媒体片段URL<br>/mp4/download/{stream}.fmp4?id={id}
|
||||
end
|
||||
|
||||
Server->>Server: 添加#EXT-X-ENDLIST标记
|
||||
Server-->>Client: 返回HLS播放列表
|
||||
|
||||
loop 对每个片段
|
||||
Client->>MP4Plugin: 请求fMP4片段
|
||||
MP4Plugin->>MP4Plugin: 转换为fMP4格式
|
||||
MP4Plugin-->>Client: 返回fMP4片段
|
||||
end
|
||||
```
|
||||
|
||||
通过这种方式,我们在保持兼容现有HLS客户端的同时,利用了fMP4格式的优势,提供了更高效的流媒体服务。
|
||||
|
||||
## 结论
|
||||
|
||||
fMP4作为一种现代媒体容器格式,结合了MP4的高效压缩和流媒体传输的灵活性,非常适合现代Web应用中的视频分发需求。通过与HLS v7和MSE技术的结合,可以实现更高效、更灵活的流媒体服务。
|
||||
|
||||
在Monibuca项目的实践中,我们通过实现MP4到fMP4的转换、多段MP4文件的合并,以及针对MSE优化fMP4片段生成,成功构建了一套完整的流媒体解决方案。这些技术的应用使得我们的系统能够提供更好的用户体验,包括更快的启动时间、更平滑的画质切换以及更低的带宽消耗。
|
||||
|
||||
随着视频技术的不断发展,fMP4作为连接传统媒体格式与现代Web技术的桥梁,将继续在流媒体领域发挥重要作用。而Monibuca项目也将持续探索和优化这一技术,为用户提供更优质的流媒体服务。
|
1869
pb/global.pb.go
1869
pb/global.pb.go
File diff suppressed because it is too large
Load Diff
@@ -1192,66 +1192,6 @@ func local_request_Api_GetFormily_0(ctx context.Context, marshaler runtime.Marsh
|
||||
|
||||
}
|
||||
|
||||
func request_Api_ModifyConfig_0(ctx context.Context, marshaler runtime.Marshaler, client ApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ModifyConfigRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Yaml); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
||||
}
|
||||
|
||||
protoReq.Name, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
|
||||
}
|
||||
|
||||
msg, err := client.ModifyConfig(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Api_ModifyConfig_0(ctx context.Context, marshaler runtime.Marshaler, server ApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ModifyConfigRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Yaml); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
||||
}
|
||||
|
||||
protoReq.Name, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
|
||||
}
|
||||
|
||||
msg, err := server.ModifyConfig(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Api_GetPullProxyList_0(ctx context.Context, marshaler runtime.Marshaler, client ApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq emptypb.Empty
|
||||
var metadata runtime.ServerMetadata
|
||||
@@ -1904,7 +1844,6 @@ func local_request_Api_DeleteRecord_0(ctx context.Context, marshaler runtime.Mar
|
||||
// UnaryRPC :call ApiServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterApiHandlerFromEndpoint instead.
|
||||
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
|
||||
func RegisterApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ApiServer) error {
|
||||
|
||||
mux.Handle("GET", pattern_Api_SysInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
@@ -2582,31 +2521,6 @@ func RegisterApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Api_ModifyConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/global.Api/ModifyConfig", runtime.WithHTTPPathPattern("/api/config/modify/{name}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Api_ModifyConfig_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Api_ModifyConfig_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Api_GetPullProxyList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -3038,21 +2952,21 @@ func RegisterApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
|
||||
// RegisterApiHandlerFromEndpoint is same as RegisterApiHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterApiHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.NewClient(endpoint, opts...)
|
||||
conn, err := grpc.DialContext(ctx, endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
@@ -3070,7 +2984,7 @@ func RegisterApiHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ApiClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ApiClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "ApiClient" to call the correct interceptors. This client ignores the HTTP middlewares.
|
||||
// "ApiClient" to call the correct interceptors.
|
||||
func RegisterApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ApiClient) error {
|
||||
|
||||
mux.Handle("GET", pattern_Api_SysInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
@@ -3667,28 +3581,6 @@ func RegisterApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Api_ModifyConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/global.Api/ModifyConfig", runtime.WithHTTPPathPattern("/api/config/modify/{name}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Api_ModifyConfig_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Api_ModifyConfig_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Api_GetPullProxyList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -4121,8 +4013,6 @@ var (
|
||||
|
||||
pattern_Api_GetFormily_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "config", "formily", "name"}, ""))
|
||||
|
||||
pattern_Api_ModifyConfig_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "config", "modify", "name"}, ""))
|
||||
|
||||
pattern_Api_GetPullProxyList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "proxy", "pull", "list"}, ""))
|
||||
|
||||
pattern_Api_GetPullProxyList_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "device", "list"}, ""))
|
||||
@@ -4213,8 +4103,6 @@ var (
|
||||
|
||||
forward_Api_GetFormily_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Api_ModifyConfig_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Api_GetPullProxyList_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Api_GetPullProxyList_1 = runtime.ForwardResponseMessage
|
||||
|
@@ -152,12 +152,7 @@ service api {
|
||||
get: "/api/config/formily/{name}"
|
||||
};
|
||||
}
|
||||
rpc ModifyConfig (ModifyConfigRequest) returns (SuccessResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/config/modify/{name}"
|
||||
body: "yaml"
|
||||
};
|
||||
}
|
||||
|
||||
rpc GetPullProxyList (google.protobuf.Empty) returns (PullProxyListResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/proxy/pull/list"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v5.28.3
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.19.1
|
||||
// source: global.proto
|
||||
|
||||
package pb
|
||||
@@ -16,52 +16,8 @@ import (
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Api_SysInfo_FullMethodName = "/global.api/SysInfo"
|
||||
Api_DisabledPlugins_FullMethodName = "/global.api/DisabledPlugins"
|
||||
Api_Summary_FullMethodName = "/global.api/Summary"
|
||||
Api_Shutdown_FullMethodName = "/global.api/Shutdown"
|
||||
Api_Restart_FullMethodName = "/global.api/Restart"
|
||||
Api_TaskTree_FullMethodName = "/global.api/TaskTree"
|
||||
Api_StopTask_FullMethodName = "/global.api/StopTask"
|
||||
Api_RestartTask_FullMethodName = "/global.api/RestartTask"
|
||||
Api_StreamList_FullMethodName = "/global.api/StreamList"
|
||||
Api_WaitList_FullMethodName = "/global.api/WaitList"
|
||||
Api_StreamInfo_FullMethodName = "/global.api/StreamInfo"
|
||||
Api_PauseStream_FullMethodName = "/global.api/PauseStream"
|
||||
Api_ResumeStream_FullMethodName = "/global.api/ResumeStream"
|
||||
Api_SetStreamSpeed_FullMethodName = "/global.api/SetStreamSpeed"
|
||||
Api_SeekStream_FullMethodName = "/global.api/SeekStream"
|
||||
Api_GetSubscribers_FullMethodName = "/global.api/GetSubscribers"
|
||||
Api_AudioTrackSnap_FullMethodName = "/global.api/AudioTrackSnap"
|
||||
Api_VideoTrackSnap_FullMethodName = "/global.api/VideoTrackSnap"
|
||||
Api_ChangeSubscribe_FullMethodName = "/global.api/ChangeSubscribe"
|
||||
Api_GetStreamAlias_FullMethodName = "/global.api/GetStreamAlias"
|
||||
Api_SetStreamAlias_FullMethodName = "/global.api/SetStreamAlias"
|
||||
Api_StopPublish_FullMethodName = "/global.api/StopPublish"
|
||||
Api_StopSubscribe_FullMethodName = "/global.api/StopSubscribe"
|
||||
Api_GetConfigFile_FullMethodName = "/global.api/GetConfigFile"
|
||||
Api_UpdateConfigFile_FullMethodName = "/global.api/UpdateConfigFile"
|
||||
Api_GetConfig_FullMethodName = "/global.api/GetConfig"
|
||||
Api_GetFormily_FullMethodName = "/global.api/GetFormily"
|
||||
Api_ModifyConfig_FullMethodName = "/global.api/ModifyConfig"
|
||||
Api_GetPullProxyList_FullMethodName = "/global.api/GetPullProxyList"
|
||||
Api_AddPullProxy_FullMethodName = "/global.api/AddPullProxy"
|
||||
Api_RemovePullProxy_FullMethodName = "/global.api/RemovePullProxy"
|
||||
Api_UpdatePullProxy_FullMethodName = "/global.api/UpdatePullProxy"
|
||||
Api_GetPushProxyList_FullMethodName = "/global.api/GetPushProxyList"
|
||||
Api_AddPushProxy_FullMethodName = "/global.api/AddPushProxy"
|
||||
Api_RemovePushProxy_FullMethodName = "/global.api/RemovePushProxy"
|
||||
Api_UpdatePushProxy_FullMethodName = "/global.api/UpdatePushProxy"
|
||||
Api_GetRecording_FullMethodName = "/global.api/GetRecording"
|
||||
Api_GetTransformList_FullMethodName = "/global.api/GetTransformList"
|
||||
Api_GetRecordList_FullMethodName = "/global.api/GetRecordList"
|
||||
Api_GetRecordCatalog_FullMethodName = "/global.api/GetRecordCatalog"
|
||||
Api_DeleteRecord_FullMethodName = "/global.api/DeleteRecord"
|
||||
)
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// ApiClient is the client API for Api service.
|
||||
//
|
||||
@@ -94,7 +50,6 @@ type ApiClient interface {
|
||||
UpdateConfigFile(ctx context.Context, in *UpdateConfigFileRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
GetConfig(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error)
|
||||
GetFormily(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error)
|
||||
ModifyConfig(ctx context.Context, in *ModifyConfigRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
GetPullProxyList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PullProxyListResponse, error)
|
||||
AddPullProxy(ctx context.Context, in *PullProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
RemovePullProxy(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
@@ -119,9 +74,8 @@ func NewApiClient(cc grpc.ClientConnInterface) ApiClient {
|
||||
}
|
||||
|
||||
func (c *apiClient) SysInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SysInfoResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SysInfoResponse)
|
||||
err := c.cc.Invoke(ctx, Api_SysInfo_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/SysInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -129,9 +83,8 @@ func (c *apiClient) SysInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc
|
||||
}
|
||||
|
||||
func (c *apiClient) DisabledPlugins(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DisabledPluginsResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DisabledPluginsResponse)
|
||||
err := c.cc.Invoke(ctx, Api_DisabledPlugins_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/DisabledPlugins", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -139,9 +92,8 @@ func (c *apiClient) DisabledPlugins(ctx context.Context, in *emptypb.Empty, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) Summary(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SummaryResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SummaryResponse)
|
||||
err := c.cc.Invoke(ctx, Api_Summary_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/Summary", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -149,9 +101,8 @@ func (c *apiClient) Summary(ctx context.Context, in *emptypb.Empty, opts ...grpc
|
||||
}
|
||||
|
||||
func (c *apiClient) Shutdown(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_Shutdown_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/Shutdown", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -159,9 +110,8 @@ func (c *apiClient) Shutdown(ctx context.Context, in *RequestWithId, opts ...grp
|
||||
}
|
||||
|
||||
func (c *apiClient) Restart(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_Restart_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/Restart", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -169,9 +119,8 @@ func (c *apiClient) Restart(ctx context.Context, in *RequestWithId, opts ...grpc
|
||||
}
|
||||
|
||||
func (c *apiClient) TaskTree(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TaskTreeResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(TaskTreeResponse)
|
||||
err := c.cc.Invoke(ctx, Api_TaskTree_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/TaskTree", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -179,9 +128,8 @@ func (c *apiClient) TaskTree(ctx context.Context, in *emptypb.Empty, opts ...grp
|
||||
}
|
||||
|
||||
func (c *apiClient) StopTask(ctx context.Context, in *RequestWithId64, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_StopTask_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/StopTask", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -189,9 +137,8 @@ func (c *apiClient) StopTask(ctx context.Context, in *RequestWithId64, opts ...g
|
||||
}
|
||||
|
||||
func (c *apiClient) RestartTask(ctx context.Context, in *RequestWithId64, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_RestartTask_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/RestartTask", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -199,9 +146,8 @@ func (c *apiClient) RestartTask(ctx context.Context, in *RequestWithId64, opts .
|
||||
}
|
||||
|
||||
func (c *apiClient) StreamList(ctx context.Context, in *StreamListRequest, opts ...grpc.CallOption) (*StreamListResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StreamListResponse)
|
||||
err := c.cc.Invoke(ctx, Api_StreamList_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/StreamList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -209,9 +155,8 @@ func (c *apiClient) StreamList(ctx context.Context, in *StreamListRequest, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) WaitList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StreamWaitListResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StreamWaitListResponse)
|
||||
err := c.cc.Invoke(ctx, Api_WaitList_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/WaitList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -219,9 +164,8 @@ func (c *apiClient) WaitList(ctx context.Context, in *emptypb.Empty, opts ...grp
|
||||
}
|
||||
|
||||
func (c *apiClient) StreamInfo(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*StreamInfoResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StreamInfoResponse)
|
||||
err := c.cc.Invoke(ctx, Api_StreamInfo_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/StreamInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -229,9 +173,8 @@ func (c *apiClient) StreamInfo(ctx context.Context, in *StreamSnapRequest, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) PauseStream(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_PauseStream_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/PauseStream", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -239,9 +182,8 @@ func (c *apiClient) PauseStream(ctx context.Context, in *StreamSnapRequest, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) ResumeStream(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_ResumeStream_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/ResumeStream", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -249,9 +191,8 @@ func (c *apiClient) ResumeStream(ctx context.Context, in *StreamSnapRequest, opt
|
||||
}
|
||||
|
||||
func (c *apiClient) SetStreamSpeed(ctx context.Context, in *SetStreamSpeedRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_SetStreamSpeed_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/SetStreamSpeed", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -259,9 +200,8 @@ func (c *apiClient) SetStreamSpeed(ctx context.Context, in *SetStreamSpeedReques
|
||||
}
|
||||
|
||||
func (c *apiClient) SeekStream(ctx context.Context, in *SeekStreamRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_SeekStream_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/SeekStream", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -269,9 +209,8 @@ func (c *apiClient) SeekStream(ctx context.Context, in *SeekStreamRequest, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) GetSubscribers(ctx context.Context, in *SubscribersRequest, opts ...grpc.CallOption) (*SubscribersResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SubscribersResponse)
|
||||
err := c.cc.Invoke(ctx, Api_GetSubscribers_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetSubscribers", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -279,9 +218,8 @@ func (c *apiClient) GetSubscribers(ctx context.Context, in *SubscribersRequest,
|
||||
}
|
||||
|
||||
func (c *apiClient) AudioTrackSnap(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*TrackSnapShotResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(TrackSnapShotResponse)
|
||||
err := c.cc.Invoke(ctx, Api_AudioTrackSnap_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/AudioTrackSnap", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -289,9 +227,8 @@ func (c *apiClient) AudioTrackSnap(ctx context.Context, in *StreamSnapRequest, o
|
||||
}
|
||||
|
||||
func (c *apiClient) VideoTrackSnap(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*TrackSnapShotResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(TrackSnapShotResponse)
|
||||
err := c.cc.Invoke(ctx, Api_VideoTrackSnap_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/VideoTrackSnap", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -299,9 +236,8 @@ func (c *apiClient) VideoTrackSnap(ctx context.Context, in *StreamSnapRequest, o
|
||||
}
|
||||
|
||||
func (c *apiClient) ChangeSubscribe(ctx context.Context, in *ChangeSubscribeRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_ChangeSubscribe_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/ChangeSubscribe", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -309,9 +245,8 @@ func (c *apiClient) ChangeSubscribe(ctx context.Context, in *ChangeSubscribeRequ
|
||||
}
|
||||
|
||||
func (c *apiClient) GetStreamAlias(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StreamAliasListResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StreamAliasListResponse)
|
||||
err := c.cc.Invoke(ctx, Api_GetStreamAlias_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetStreamAlias", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -319,9 +254,8 @@ func (c *apiClient) GetStreamAlias(ctx context.Context, in *emptypb.Empty, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) SetStreamAlias(ctx context.Context, in *SetStreamAliasRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_SetStreamAlias_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/SetStreamAlias", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -329,9 +263,8 @@ func (c *apiClient) SetStreamAlias(ctx context.Context, in *SetStreamAliasReques
|
||||
}
|
||||
|
||||
func (c *apiClient) StopPublish(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_StopPublish_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/StopPublish", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -339,9 +272,8 @@ func (c *apiClient) StopPublish(ctx context.Context, in *StreamSnapRequest, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) StopSubscribe(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_StopSubscribe_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/StopSubscribe", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -349,9 +281,8 @@ func (c *apiClient) StopSubscribe(ctx context.Context, in *RequestWithId, opts .
|
||||
}
|
||||
|
||||
func (c *apiClient) GetConfigFile(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetConfigFileResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetConfigFileResponse)
|
||||
err := c.cc.Invoke(ctx, Api_GetConfigFile_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetConfigFile", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -359,9 +290,8 @@ func (c *apiClient) GetConfigFile(ctx context.Context, in *emptypb.Empty, opts .
|
||||
}
|
||||
|
||||
func (c *apiClient) UpdateConfigFile(ctx context.Context, in *UpdateConfigFileRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_UpdateConfigFile_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/UpdateConfigFile", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -369,9 +299,8 @@ func (c *apiClient) UpdateConfigFile(ctx context.Context, in *UpdateConfigFileRe
|
||||
}
|
||||
|
||||
func (c *apiClient) GetConfig(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetConfigResponse)
|
||||
err := c.cc.Invoke(ctx, Api_GetConfig_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetConfig", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -379,19 +308,8 @@ func (c *apiClient) GetConfig(ctx context.Context, in *GetConfigRequest, opts ..
|
||||
}
|
||||
|
||||
func (c *apiClient) GetFormily(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetConfigResponse)
|
||||
err := c.cc.Invoke(ctx, Api_GetFormily_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *apiClient) ModifyConfig(ctx context.Context, in *ModifyConfigRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_ModifyConfig_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetFormily", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -399,9 +317,8 @@ func (c *apiClient) ModifyConfig(ctx context.Context, in *ModifyConfigRequest, o
|
||||
}
|
||||
|
||||
func (c *apiClient) GetPullProxyList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PullProxyListResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(PullProxyListResponse)
|
||||
err := c.cc.Invoke(ctx, Api_GetPullProxyList_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetPullProxyList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -409,9 +326,8 @@ func (c *apiClient) GetPullProxyList(ctx context.Context, in *emptypb.Empty, opt
|
||||
}
|
||||
|
||||
func (c *apiClient) AddPullProxy(ctx context.Context, in *PullProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_AddPullProxy_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/AddPullProxy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -419,9 +335,8 @@ func (c *apiClient) AddPullProxy(ctx context.Context, in *PullProxyInfo, opts ..
|
||||
}
|
||||
|
||||
func (c *apiClient) RemovePullProxy(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_RemovePullProxy_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/RemovePullProxy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -429,9 +344,8 @@ func (c *apiClient) RemovePullProxy(ctx context.Context, in *RequestWithId, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) UpdatePullProxy(ctx context.Context, in *PullProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_UpdatePullProxy_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/UpdatePullProxy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -439,9 +353,8 @@ func (c *apiClient) UpdatePullProxy(ctx context.Context, in *PullProxyInfo, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) GetPushProxyList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PushProxyListResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(PushProxyListResponse)
|
||||
err := c.cc.Invoke(ctx, Api_GetPushProxyList_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetPushProxyList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -449,9 +362,8 @@ func (c *apiClient) GetPushProxyList(ctx context.Context, in *emptypb.Empty, opt
|
||||
}
|
||||
|
||||
func (c *apiClient) AddPushProxy(ctx context.Context, in *PushProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_AddPushProxy_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/AddPushProxy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -459,9 +371,8 @@ func (c *apiClient) AddPushProxy(ctx context.Context, in *PushProxyInfo, opts ..
|
||||
}
|
||||
|
||||
func (c *apiClient) RemovePushProxy(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_RemovePushProxy_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/RemovePushProxy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -469,9 +380,8 @@ func (c *apiClient) RemovePushProxy(ctx context.Context, in *RequestWithId, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) UpdatePushProxy(ctx context.Context, in *PushProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_UpdatePushProxy_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/UpdatePushProxy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -479,9 +389,8 @@ func (c *apiClient) UpdatePushProxy(ctx context.Context, in *PushProxyInfo, opts
|
||||
}
|
||||
|
||||
func (c *apiClient) GetRecording(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*RecordingListResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RecordingListResponse)
|
||||
err := c.cc.Invoke(ctx, Api_GetRecording_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetRecording", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -489,9 +398,8 @@ func (c *apiClient) GetRecording(ctx context.Context, in *emptypb.Empty, opts ..
|
||||
}
|
||||
|
||||
func (c *apiClient) GetTransformList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TransformListResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(TransformListResponse)
|
||||
err := c.cc.Invoke(ctx, Api_GetTransformList_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetTransformList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -499,9 +407,8 @@ func (c *apiClient) GetTransformList(ctx context.Context, in *emptypb.Empty, opt
|
||||
}
|
||||
|
||||
func (c *apiClient) GetRecordList(ctx context.Context, in *ReqRecordList, opts ...grpc.CallOption) (*ResponseList, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ResponseList)
|
||||
err := c.cc.Invoke(ctx, Api_GetRecordList_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetRecordList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -509,9 +416,8 @@ func (c *apiClient) GetRecordList(ctx context.Context, in *ReqRecordList, opts .
|
||||
}
|
||||
|
||||
func (c *apiClient) GetRecordCatalog(ctx context.Context, in *ReqRecordCatalog, opts ...grpc.CallOption) (*ResponseCatalog, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ResponseCatalog)
|
||||
err := c.cc.Invoke(ctx, Api_GetRecordCatalog_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/GetRecordCatalog", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -519,9 +425,8 @@ func (c *apiClient) GetRecordCatalog(ctx context.Context, in *ReqRecordCatalog,
|
||||
}
|
||||
|
||||
func (c *apiClient) DeleteRecord(ctx context.Context, in *ReqRecordDelete, opts ...grpc.CallOption) (*ResponseDelete, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ResponseDelete)
|
||||
err := c.cc.Invoke(ctx, Api_DeleteRecord_FullMethodName, in, out, cOpts...)
|
||||
err := c.cc.Invoke(ctx, "/global.api/DeleteRecord", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -530,7 +435,7 @@ func (c *apiClient) DeleteRecord(ctx context.Context, in *ReqRecordDelete, opts
|
||||
|
||||
// ApiServer is the server API for Api service.
|
||||
// All implementations must embed UnimplementedApiServer
|
||||
// for forward compatibility.
|
||||
// for forward compatibility
|
||||
type ApiServer interface {
|
||||
SysInfo(context.Context, *emptypb.Empty) (*SysInfoResponse, error)
|
||||
DisabledPlugins(context.Context, *emptypb.Empty) (*DisabledPluginsResponse, error)
|
||||
@@ -559,7 +464,6 @@ type ApiServer interface {
|
||||
UpdateConfigFile(context.Context, *UpdateConfigFileRequest) (*SuccessResponse, error)
|
||||
GetConfig(context.Context, *GetConfigRequest) (*GetConfigResponse, error)
|
||||
GetFormily(context.Context, *GetConfigRequest) (*GetConfigResponse, error)
|
||||
ModifyConfig(context.Context, *ModifyConfigRequest) (*SuccessResponse, error)
|
||||
GetPullProxyList(context.Context, *emptypb.Empty) (*PullProxyListResponse, error)
|
||||
AddPullProxy(context.Context, *PullProxyInfo) (*SuccessResponse, error)
|
||||
RemovePullProxy(context.Context, *RequestWithId) (*SuccessResponse, error)
|
||||
@@ -576,12 +480,9 @@ type ApiServer interface {
|
||||
mustEmbedUnimplementedApiServer()
|
||||
}
|
||||
|
||||
// UnimplementedApiServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedApiServer struct{}
|
||||
// UnimplementedApiServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedApiServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedApiServer) SysInfo(context.Context, *emptypb.Empty) (*SysInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SysInfo not implemented")
|
||||
@@ -664,9 +565,6 @@ func (UnimplementedApiServer) GetConfig(context.Context, *GetConfigRequest) (*Ge
|
||||
func (UnimplementedApiServer) GetFormily(context.Context, *GetConfigRequest) (*GetConfigResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetFormily not implemented")
|
||||
}
|
||||
func (UnimplementedApiServer) ModifyConfig(context.Context, *ModifyConfigRequest) (*SuccessResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ModifyConfig not implemented")
|
||||
}
|
||||
func (UnimplementedApiServer) GetPullProxyList(context.Context, *emptypb.Empty) (*PullProxyListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPullProxyList not implemented")
|
||||
}
|
||||
@@ -707,7 +605,6 @@ func (UnimplementedApiServer) DeleteRecord(context.Context, *ReqRecordDelete) (*
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteRecord not implemented")
|
||||
}
|
||||
func (UnimplementedApiServer) mustEmbedUnimplementedApiServer() {}
|
||||
func (UnimplementedApiServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeApiServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ApiServer will
|
||||
@@ -717,13 +614,6 @@ type UnsafeApiServer interface {
|
||||
}
|
||||
|
||||
func RegisterApiServer(s grpc.ServiceRegistrar, srv ApiServer) {
|
||||
// If the following call pancis, it indicates UnimplementedApiServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&Api_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
@@ -737,7 +627,7 @@ func _Api_SysInfo_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_SysInfo_FullMethodName,
|
||||
FullMethod: "/global.api/SysInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).SysInfo(ctx, req.(*emptypb.Empty))
|
||||
@@ -755,7 +645,7 @@ func _Api_DisabledPlugins_Handler(srv interface{}, ctx context.Context, dec func
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_DisabledPlugins_FullMethodName,
|
||||
FullMethod: "/global.api/DisabledPlugins",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).DisabledPlugins(ctx, req.(*emptypb.Empty))
|
||||
@@ -773,7 +663,7 @@ func _Api_Summary_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_Summary_FullMethodName,
|
||||
FullMethod: "/global.api/Summary",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).Summary(ctx, req.(*emptypb.Empty))
|
||||
@@ -791,7 +681,7 @@ func _Api_Shutdown_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_Shutdown_FullMethodName,
|
||||
FullMethod: "/global.api/Shutdown",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).Shutdown(ctx, req.(*RequestWithId))
|
||||
@@ -809,7 +699,7 @@ func _Api_Restart_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_Restart_FullMethodName,
|
||||
FullMethod: "/global.api/Restart",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).Restart(ctx, req.(*RequestWithId))
|
||||
@@ -827,7 +717,7 @@ func _Api_TaskTree_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_TaskTree_FullMethodName,
|
||||
FullMethod: "/global.api/TaskTree",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).TaskTree(ctx, req.(*emptypb.Empty))
|
||||
@@ -845,7 +735,7 @@ func _Api_StopTask_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_StopTask_FullMethodName,
|
||||
FullMethod: "/global.api/StopTask",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).StopTask(ctx, req.(*RequestWithId64))
|
||||
@@ -863,7 +753,7 @@ func _Api_RestartTask_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_RestartTask_FullMethodName,
|
||||
FullMethod: "/global.api/RestartTask",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).RestartTask(ctx, req.(*RequestWithId64))
|
||||
@@ -881,7 +771,7 @@ func _Api_StreamList_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_StreamList_FullMethodName,
|
||||
FullMethod: "/global.api/StreamList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).StreamList(ctx, req.(*StreamListRequest))
|
||||
@@ -899,7 +789,7 @@ func _Api_WaitList_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_WaitList_FullMethodName,
|
||||
FullMethod: "/global.api/WaitList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).WaitList(ctx, req.(*emptypb.Empty))
|
||||
@@ -917,7 +807,7 @@ func _Api_StreamInfo_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_StreamInfo_FullMethodName,
|
||||
FullMethod: "/global.api/StreamInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).StreamInfo(ctx, req.(*StreamSnapRequest))
|
||||
@@ -935,7 +825,7 @@ func _Api_PauseStream_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_PauseStream_FullMethodName,
|
||||
FullMethod: "/global.api/PauseStream",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).PauseStream(ctx, req.(*StreamSnapRequest))
|
||||
@@ -953,7 +843,7 @@ func _Api_ResumeStream_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_ResumeStream_FullMethodName,
|
||||
FullMethod: "/global.api/ResumeStream",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).ResumeStream(ctx, req.(*StreamSnapRequest))
|
||||
@@ -971,7 +861,7 @@ func _Api_SetStreamSpeed_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_SetStreamSpeed_FullMethodName,
|
||||
FullMethod: "/global.api/SetStreamSpeed",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).SetStreamSpeed(ctx, req.(*SetStreamSpeedRequest))
|
||||
@@ -989,7 +879,7 @@ func _Api_SeekStream_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_SeekStream_FullMethodName,
|
||||
FullMethod: "/global.api/SeekStream",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).SeekStream(ctx, req.(*SeekStreamRequest))
|
||||
@@ -1007,7 +897,7 @@ func _Api_GetSubscribers_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetSubscribers_FullMethodName,
|
||||
FullMethod: "/global.api/GetSubscribers",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetSubscribers(ctx, req.(*SubscribersRequest))
|
||||
@@ -1025,7 +915,7 @@ func _Api_AudioTrackSnap_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_AudioTrackSnap_FullMethodName,
|
||||
FullMethod: "/global.api/AudioTrackSnap",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).AudioTrackSnap(ctx, req.(*StreamSnapRequest))
|
||||
@@ -1043,7 +933,7 @@ func _Api_VideoTrackSnap_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_VideoTrackSnap_FullMethodName,
|
||||
FullMethod: "/global.api/VideoTrackSnap",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).VideoTrackSnap(ctx, req.(*StreamSnapRequest))
|
||||
@@ -1061,7 +951,7 @@ func _Api_ChangeSubscribe_Handler(srv interface{}, ctx context.Context, dec func
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_ChangeSubscribe_FullMethodName,
|
||||
FullMethod: "/global.api/ChangeSubscribe",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).ChangeSubscribe(ctx, req.(*ChangeSubscribeRequest))
|
||||
@@ -1079,7 +969,7 @@ func _Api_GetStreamAlias_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetStreamAlias_FullMethodName,
|
||||
FullMethod: "/global.api/GetStreamAlias",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetStreamAlias(ctx, req.(*emptypb.Empty))
|
||||
@@ -1097,7 +987,7 @@ func _Api_SetStreamAlias_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_SetStreamAlias_FullMethodName,
|
||||
FullMethod: "/global.api/SetStreamAlias",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).SetStreamAlias(ctx, req.(*SetStreamAliasRequest))
|
||||
@@ -1115,7 +1005,7 @@ func _Api_StopPublish_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_StopPublish_FullMethodName,
|
||||
FullMethod: "/global.api/StopPublish",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).StopPublish(ctx, req.(*StreamSnapRequest))
|
||||
@@ -1133,7 +1023,7 @@ func _Api_StopSubscribe_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_StopSubscribe_FullMethodName,
|
||||
FullMethod: "/global.api/StopSubscribe",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).StopSubscribe(ctx, req.(*RequestWithId))
|
||||
@@ -1151,7 +1041,7 @@ func _Api_GetConfigFile_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetConfigFile_FullMethodName,
|
||||
FullMethod: "/global.api/GetConfigFile",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetConfigFile(ctx, req.(*emptypb.Empty))
|
||||
@@ -1169,7 +1059,7 @@ func _Api_UpdateConfigFile_Handler(srv interface{}, ctx context.Context, dec fun
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_UpdateConfigFile_FullMethodName,
|
||||
FullMethod: "/global.api/UpdateConfigFile",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).UpdateConfigFile(ctx, req.(*UpdateConfigFileRequest))
|
||||
@@ -1187,7 +1077,7 @@ func _Api_GetConfig_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetConfig_FullMethodName,
|
||||
FullMethod: "/global.api/GetConfig",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetConfig(ctx, req.(*GetConfigRequest))
|
||||
@@ -1205,7 +1095,7 @@ func _Api_GetFormily_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetFormily_FullMethodName,
|
||||
FullMethod: "/global.api/GetFormily",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetFormily(ctx, req.(*GetConfigRequest))
|
||||
@@ -1213,24 +1103,6 @@ func _Api_GetFormily_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Api_ModifyConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ModifyConfigRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ApiServer).ModifyConfig(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_ModifyConfig_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).ModifyConfig(ctx, req.(*ModifyConfigRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Api_GetPullProxyList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(emptypb.Empty)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -1241,7 +1113,7 @@ func _Api_GetPullProxyList_Handler(srv interface{}, ctx context.Context, dec fun
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetPullProxyList_FullMethodName,
|
||||
FullMethod: "/global.api/GetPullProxyList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetPullProxyList(ctx, req.(*emptypb.Empty))
|
||||
@@ -1259,7 +1131,7 @@ func _Api_AddPullProxy_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_AddPullProxy_FullMethodName,
|
||||
FullMethod: "/global.api/AddPullProxy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).AddPullProxy(ctx, req.(*PullProxyInfo))
|
||||
@@ -1277,7 +1149,7 @@ func _Api_RemovePullProxy_Handler(srv interface{}, ctx context.Context, dec func
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_RemovePullProxy_FullMethodName,
|
||||
FullMethod: "/global.api/RemovePullProxy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).RemovePullProxy(ctx, req.(*RequestWithId))
|
||||
@@ -1295,7 +1167,7 @@ func _Api_UpdatePullProxy_Handler(srv interface{}, ctx context.Context, dec func
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_UpdatePullProxy_FullMethodName,
|
||||
FullMethod: "/global.api/UpdatePullProxy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).UpdatePullProxy(ctx, req.(*PullProxyInfo))
|
||||
@@ -1313,7 +1185,7 @@ func _Api_GetPushProxyList_Handler(srv interface{}, ctx context.Context, dec fun
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetPushProxyList_FullMethodName,
|
||||
FullMethod: "/global.api/GetPushProxyList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetPushProxyList(ctx, req.(*emptypb.Empty))
|
||||
@@ -1331,7 +1203,7 @@ func _Api_AddPushProxy_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_AddPushProxy_FullMethodName,
|
||||
FullMethod: "/global.api/AddPushProxy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).AddPushProxy(ctx, req.(*PushProxyInfo))
|
||||
@@ -1349,7 +1221,7 @@ func _Api_RemovePushProxy_Handler(srv interface{}, ctx context.Context, dec func
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_RemovePushProxy_FullMethodName,
|
||||
FullMethod: "/global.api/RemovePushProxy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).RemovePushProxy(ctx, req.(*RequestWithId))
|
||||
@@ -1367,7 +1239,7 @@ func _Api_UpdatePushProxy_Handler(srv interface{}, ctx context.Context, dec func
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_UpdatePushProxy_FullMethodName,
|
||||
FullMethod: "/global.api/UpdatePushProxy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).UpdatePushProxy(ctx, req.(*PushProxyInfo))
|
||||
@@ -1385,7 +1257,7 @@ func _Api_GetRecording_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetRecording_FullMethodName,
|
||||
FullMethod: "/global.api/GetRecording",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetRecording(ctx, req.(*emptypb.Empty))
|
||||
@@ -1403,7 +1275,7 @@ func _Api_GetTransformList_Handler(srv interface{}, ctx context.Context, dec fun
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetTransformList_FullMethodName,
|
||||
FullMethod: "/global.api/GetTransformList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetTransformList(ctx, req.(*emptypb.Empty))
|
||||
@@ -1421,7 +1293,7 @@ func _Api_GetRecordList_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetRecordList_FullMethodName,
|
||||
FullMethod: "/global.api/GetRecordList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetRecordList(ctx, req.(*ReqRecordList))
|
||||
@@ -1439,7 +1311,7 @@ func _Api_GetRecordCatalog_Handler(srv interface{}, ctx context.Context, dec fun
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_GetRecordCatalog_FullMethodName,
|
||||
FullMethod: "/global.api/GetRecordCatalog",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).GetRecordCatalog(ctx, req.(*ReqRecordCatalog))
|
||||
@@ -1457,7 +1329,7 @@ func _Api_DeleteRecord_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Api_DeleteRecord_FullMethodName,
|
||||
FullMethod: "/global.api/DeleteRecord",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).DeleteRecord(ctx, req.(*ReqRecordDelete))
|
||||
@@ -1580,10 +1452,6 @@ var Api_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "GetFormily",
|
||||
Handler: _Api_GetFormily_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ModifyConfig",
|
||||
Handler: _Api_ModifyConfig_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPullProxyList",
|
||||
Handler: _Api_GetPullProxyList_Handler,
|
||||
|
@@ -3,7 +3,6 @@ package config
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/mcuadros/go-defaults"
|
||||
"log/slog"
|
||||
"maps"
|
||||
"os"
|
||||
@@ -12,6 +11,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mcuadros/go-defaults"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
|
55
plugin.go
55
plugin.go
@@ -150,7 +150,9 @@ func (plugin *PluginMeta) Init(s *Server, userConfig map[string]any) (p *Plugin)
|
||||
p.Warn("plugin disabled")
|
||||
return
|
||||
} else {
|
||||
p.assign()
|
||||
if v, ok := instance.(IRegisterHandler); ok {
|
||||
p.registerHandler(v.RegisterHandler())
|
||||
}
|
||||
}
|
||||
p.Info("init", "version", plugin.Version)
|
||||
var err error
|
||||
@@ -269,34 +271,12 @@ func (p *Plugin) GetPublicIP(netcardIP string) string {
|
||||
return localIp
|
||||
}
|
||||
|
||||
func (p *Plugin) settingPath() string {
|
||||
return filepath.Join(p.Server.SettingDir, strings.ToLower(p.Meta.Name)+".yaml")
|
||||
}
|
||||
|
||||
func (p *Plugin) disable(reason string) {
|
||||
p.Disabled = true
|
||||
p.SetDescription("disableReason", reason)
|
||||
p.Server.disabledPlugins = append(p.Server.disabledPlugins, p)
|
||||
}
|
||||
|
||||
func (p *Plugin) assign() {
|
||||
f, err := os.Open(p.settingPath())
|
||||
defer f.Close()
|
||||
if err == nil {
|
||||
var modifyConfig map[string]any
|
||||
err = yaml.NewDecoder(f).Decode(&modifyConfig)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
p.Config.ParseModifyFile(modifyConfig)
|
||||
}
|
||||
var handlerMap map[string]http.HandlerFunc
|
||||
if v, ok := p.handler.(IRegisterHandler); ok {
|
||||
handlerMap = v.RegisterHandler()
|
||||
}
|
||||
p.registerHandler(handlerMap)
|
||||
}
|
||||
|
||||
func (p *Plugin) Start() (err error) {
|
||||
s := p.Server
|
||||
if p.Meta.ServiceDesc != nil && s.grpcServer != nil {
|
||||
@@ -732,35 +712,6 @@ func (p *Plugin) handle(pattern string, handler http.Handler) {
|
||||
p.Server.apiList = append(p.Server.apiList, pattern)
|
||||
}
|
||||
|
||||
func (p *Plugin) SaveConfig() (err error) {
|
||||
return Servers.AddTask(&SaveConfig{Plugin: p}).WaitStopped()
|
||||
}
|
||||
|
||||
type SaveConfig struct {
|
||||
task.Task
|
||||
Plugin *Plugin
|
||||
file *os.File
|
||||
}
|
||||
|
||||
func (s *SaveConfig) Start() (err error) {
|
||||
if s.Plugin.Modify == nil {
|
||||
err = os.Remove(s.Plugin.settingPath())
|
||||
if err == nil {
|
||||
err = task.ErrTaskComplete
|
||||
}
|
||||
}
|
||||
s.file, err = os.OpenFile(s.Plugin.settingPath(), os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666)
|
||||
return
|
||||
}
|
||||
|
||||
func (s *SaveConfig) Run() (err error) {
|
||||
return yaml.NewEncoder(s.file).Encode(s.Plugin.Modify)
|
||||
}
|
||||
|
||||
func (s *SaveConfig) Dispose() {
|
||||
s.file.Close()
|
||||
}
|
||||
|
||||
func (p *Plugin) sendPublishWebhook(pub *Publisher) {
|
||||
if p.config.Hook == nil {
|
||||
return
|
||||
|
Reference in New Issue
Block a user