Refactor MediaRequestRemotePlayback function to handle end_time parameter

This commit is contained in:
Александр Лазаренко 2024-01-06 14:56:42 +03:00
parent d302e599ce
commit 11b19333e1
Signed by: Kerblif
GPG Key ID: 5AFAD6640F4670C3

View File

@ -58,21 +58,39 @@ func (e *Package) MediaRequestAliveVideo(token int, camNo int64, Sid string, ser
// main server util // main server util
func (e *Package) MediaRequestRemotePlayback(token int, serial string, session string, camNo int, date string, begin_time string, end_time string, serverId int) { func (e *Package) MediaRequestRemotePlayback(token int, serial string, session string, camNo int, date string, begin_time string, end_time string, serverId int) {
e.Payload = map[string]any{ if end_time == "" {
"MODULE": "MEDIASTREAMMODEL", e.Payload = map[string]any{
"OPERATION": "REQUESTREMOTEPLAYBACK", "MODULE": "MEDIASTREAMMODEL",
"PARAMETER": map[string]any{ "OPERATION": "REQUESTREMOTEPLAYBACK",
"STREAMNAME": "PLAYBACK" + "_" + fmt.Sprint(serial) + "_" + fmt.Sprint(camNo) + "_" + fmt.Sprint(serverId), "PARAMETER": map[string]any{
"STREAMTYPE": 1, // main stream "STREAMNAME": "PLAYBACK" + "_" + fmt.Sprint(serial) + "_" + fmt.Sprint(camNo) + "_" + fmt.Sprint(serverId),
"VIDEOTYPE": 2, // common files "STREAMTYPE": 1, // main stream
"CHANNEL": 1 << (camNo - 1), "VIDEOTYPE": 2, // common files
"STARTTIME": date + begin_time, "CHANNEL": 1 << (camNo - 1),
// "ENDTIME": date + end_time, "STARTTIME": date + begin_time,
"IPANDPORT": ip + ":12092", "IPANDPORT": ip + ":12092",
"SERIAL": token, "SERIAL": token,
"PBST": 0, "PBST": 0,
}, },
"SESSION": session, "SESSION": session,
}
} else {
e.Payload = map[string]any{
"MODULE": "MEDIASTREAMMODEL",
"OPERATION": "REQUESTREMOTEPLAYBACK",
"PARAMETER": map[string]any{
"STREAMNAME": "PLAYBACK" + "_" + fmt.Sprint(serial) + "_" + fmt.Sprint(camNo) + "_" + fmt.Sprint(serverId),
"STREAMTYPE": 1, // main stream
"VIDEOTYPE": 2, // common files
"CHANNEL": 1 << (camNo - 1),
"STARTTIME": date + begin_time,
"ENDTIME": date + end_time,
"IPANDPORT": ip + ":12092",
"SERIAL": token,
"PBST": 0,
},
"SESSION": session,
}
} }
} }