获取源列表
1.接口描述
获取源列表。
请求方式:GET [ip]/api/source/list
2.输入参数
| 参数 |
描述 |
| type |
源类型:static代表手动添加源,ndi代表ndi发现的源,all代表所有,如果不填写该字段默认提供手动添加源 |
3.输出参数
| 参数 |
类型 |
描述 |
| status |
Int |
状态码 |
| static |
Array |
source列表。当type参数填写all时存在,作为静态源的列表 |
| ndi |
Array |
source列表。当type参数填写all时存在,作为ndi的源列表 |
| list |
Array |
source列表。当type参数填写ndi或者static时存在 |
| selected |
Int |
当前被选中的源ID,只有简单模式下才存在 |
| mode |
Int |
配置模式 |
source
| 参数 |
类型 |
描述 |
| id |
Int |
源ID |
| config |
Struct |
参考源配置 |
| protocol |
Int |
协议类型 |
| p-use |
Array |
被哪些profile使用,数组类型的profile id |
源配置
根据type字段的不同,config字段的内容也不同,type为1时,config字段为URL源,type为2时,config字段为动态NDI源,type为3时,config字段为自定义NDI源。
URL源
| 参数 |
类型 |
描述 |
| name |
String |
名称 |
| type |
Int |
配置类型,固定为1 |
| url |
String |
源地址 |
| hotkey |
String |
热键 |
动态NDI源
| 参数 |
类型 |
描述 |
| name |
String |
名称 |
| type |
Int |
配置类型,动态NDI源固定为2 |
| ndi |
Struct |
NDI信息 |
NDI信息
| 参数 |
类型 |
描述 |
| name |
String |
NDI名称 |
| url |
String |
NDI地址 |
自定义NDI源
| 参数 |
类型 |
描述 |
| name |
String |
名称 |
| type |
Int |
配置类型,为3 |
| buffer-ms |
Int |
缓存时间,单位为毫秒 |
| ndi |
Struct |
自定义NDI源配置 |
| hotkey |
String |
热键 |
自定义NDI源配置
| 参数 |
类型 |
描述 |
| name |
String |
名称,可不提供 |
| url |
String |
NDI地址,可不提供 |
| transport |
String |
传输类型,字符串格式,支持:auto,rudp,udp,multicast,multi-tcp,tcp |
| pts-mode |
String |
时间戳类型,字符串格式,支持:auto,timecode,timestamp |
| low-bw |
Boolean |
布尔类型,是否启用低带宽模式 |
4.示例
获取所有类型的源
请求示例
GET /api/source/list?type=all
输出示例
{
"mode": 2,
"ndi": [
{
"config": {
"hotkey": "none",
"name": "ULTRA ENCODE Test (C315230423002-2)",
"ndi": {
"name": "ULTRA ENCODE Test (C315230423002-2)",
"url": "10.10.33.113:5984"
},
"type": 2
},
"id": 10017,
"in-use": 2,
"p-use": [1, 3, 4],
"protocol": 64
},
{
"config": {
"hotkey": "none",
"name": "ULTRA ENCODE AIO (B313230314057-fly)",
"ndi": {
"name": "ULTRA ENCODE AIO (B313230314057-fly)",
"url": "10.10.39.130:6062"
},
"type": 2
},
"id": 10041,
"in-use": 2,
"p-use": [2],
"protocol": 64
},
{
"config": {
"hotkey": "none",
"name": "ULTRA ENCODE QUAD SDI (0BA317240301001)",
"ndi": {
"name": "ULTRA ENCODE QUAD SDI (0BA317240301001)",
"url": "10.10.35.36:5961"
},
"type": 2
},
"id": 10009,
"in-use": 0,
"protocol": 64
}
],
"static": [
{
"config": {
"hotkey": "none",
"name": "SRT Server",
"type": 1,
"url": "srt://0.0.0.0:8000?mode=listener&latency=120&mw-buffer-duration=60&mw-audio-track=1"
},
"id": 1,
"in-use": 0,
"protocol": 2
},
{
"config": {
"buffer-ms": 60,
"hotkey": "none",
"name": "ULTRA ENCODE Test (C315230423002-2)",
"ndi": {
"low-bw": false,
"name": "ULTRA ENCODE Test (C315230423002-2)",
"pts-mode": "auto",
"transport": "auto",
"url": "1.1.1.1"
},
"type": 3
},
"id": 4,
"in-use": 0,
"protocol": 64
}
],
"status": 0
}