mirror of https://github.com/q191201771/lal.git
增加HTTP API接口,获取服务信息
parent
d7df4d9623
commit
f2fc9a741a
@ -1,2 +1,2 @@
|
||||
github.com/q191201771/naza v0.15.0 h1:HFyRrluqZhpnBu6YQ1soIk6cR9P8G/9sDMFLBhTTBRc=
|
||||
github.com/q191201771/naza v0.15.0/go.mod h1:SE14GBGO9mAn6JZl3NlfWGtNOT7xQjxOG7f3YOdBThM=
|
||||
github.com/q191201771/naza v0.15.1 h1:y9D7jbzHeD883PqBZTln+O47E40dFoRlQUrWYOA5GoM=
|
||||
github.com/q191201771/naza v0.15.1/go.mod h1:SE14GBGO9mAn6JZl3NlfWGtNOT7xQjxOG7f3YOdBThM=
|
||||
|
@ -0,0 +1,71 @@
|
||||
// Copyright 2020, Chef. All rights reserved.
|
||||
// https://github.com/q191201771/lal
|
||||
//
|
||||
// Use of this source code is governed by a MIT-style license
|
||||
// that can be found in the License file.
|
||||
//
|
||||
// Author: Chef (191201771@qq.com)
|
||||
|
||||
package base
|
||||
|
||||
const (
|
||||
// StatGroup.AudioCodec
|
||||
AudioCodecAAC = "AAC"
|
||||
|
||||
// StatGroup.VideoCodec
|
||||
VideoCodecAVC = "H264"
|
||||
VideoCodecHEVC = "H265"
|
||||
|
||||
// StatSession.Protocol
|
||||
ProtocolRTMP = "RTMP"
|
||||
ProtocolRTSP = "RTSP"
|
||||
ProtocolHTTPFLV = "HTTP-FLV"
|
||||
ProtocolHTTPTS = "HTTP-TS"
|
||||
)
|
||||
|
||||
type StatGroup struct {
|
||||
StreamName string `json:"stream_name"`
|
||||
AudioCodec string `json:"audio_codec"`
|
||||
VideoCodec string `json:"video_codec"`
|
||||
VideoWidth int `json:"video_width"`
|
||||
VideoHeight int `json:"video_height"`
|
||||
StatPub StatPub `json:"pub"`
|
||||
StatSubs []StatSub `json:"subs"`
|
||||
}
|
||||
|
||||
type StatPub struct {
|
||||
StatSession
|
||||
}
|
||||
|
||||
type StatSub struct {
|
||||
StatSession
|
||||
}
|
||||
|
||||
type StatSession struct {
|
||||
Protocol string `json:"protocol"`
|
||||
StartTime string `json:"start_time"`
|
||||
RemoteAddr string `json:"remote_addr"`
|
||||
ReadBytesSum uint64 `json:"read_bytes_sum"`
|
||||
WroteBytesSum uint64 `json:"wrote_bytes_sum"`
|
||||
Bitrate int `json:"bitrate"`
|
||||
}
|
||||
|
||||
func StatSession2Pub(ss StatSession) (ret StatPub) {
|
||||
ret.Protocol = ss.Protocol
|
||||
ret.StartTime = ss.StartTime
|
||||
ret.RemoteAddr = ss.RemoteAddr
|
||||
ret.ReadBytesSum = ss.ReadBytesSum
|
||||
ret.WroteBytesSum = ss.WroteBytesSum
|
||||
ret.Bitrate = ss.Bitrate
|
||||
return
|
||||
}
|
||||
|
||||
func StatSession2Sub(ss StatSession) (ret StatSub) {
|
||||
ret.Protocol = ss.Protocol
|
||||
ret.StartTime = ss.StartTime
|
||||
ret.RemoteAddr = ss.RemoteAddr
|
||||
ret.ReadBytesSum = ss.ReadBytesSum
|
||||
ret.WroteBytesSum = ss.WroteBytesSum
|
||||
ret.Bitrate = ss.Bitrate
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue