feat: add pull api

This commit is contained in:
langhuihui
2025-08-30 00:22:25 +08:00
parent f1e3714729
commit 7bc993a9ed
10 changed files with 1660 additions and 2018 deletions

121
api.go
View File

@@ -981,6 +981,127 @@ func (s *Server) GetTransformList(ctx context.Context, req *emptypb.Empty) (res
return
}
func (s *Server) StartPull(ctx context.Context, req *pb.GlobalPullRequest) (res *pb.SuccessResponse, err error) {
// 创建拉流配置
pullConfig := config.Pull{
URL: req.RemoteURL,
TestMode: int(req.TestMode),
}
// 使用请求中的流路径,如果未提供则生成默认路径
streamPath := req.StreamPath
protocol := req.Protocol
// 如果没有提供protocol则从URL推测
if protocol == "" {
u, err := url.Parse(req.RemoteURL)
if err == nil {
switch {
case strings.HasPrefix(u.Scheme, "rtmp"):
protocol = "rtmp"
case strings.HasPrefix(u.Scheme, "rtsp"):
protocol = "rtsp"
case strings.HasPrefix(u.Scheme, "srt"):
protocol = "srt"
case strings.HasPrefix(u.Scheme, "whep"):
protocol = "webrtc"
case strings.HasPrefix(u.Scheme, "http"):
if strings.Contains(u.Path, ".m3u8") {
protocol = "hls"
} else if strings.Contains(u.Path, ".flv") {
protocol = "flv"
} else if strings.Contains(u.Path, ".mp4") {
protocol = "mp4"
}
}
}
}
if streamPath == "" {
if protocol == "" {
streamPath = "pull/unknown"
} else {
streamPath = "pull/" + protocol
}
}
// 根据protocol找到对应的plugin进行pull
if protocol != "" {
for p := range s.Plugins.Range {
if strings.EqualFold(p.Meta.Name, protocol) {
pubConfig := p.GetCommonConf().Publish
// 设置发布配置参数
if req.PubAudio != nil {
pubConfig.PubAudio = *req.PubAudio
}
if req.PubVideo != nil {
pubConfig.PubVideo = *req.PubVideo
}
if req.DelayCloseTimeout != nil {
pubConfig.DelayCloseTimeout = req.DelayCloseTimeout.AsDuration()
}
if req.Speed != nil {
pubConfig.Speed = *req.Speed
}
if req.MaxCount != nil {
pubConfig.MaxCount = int(*req.MaxCount)
}
if req.KickExist != nil {
pubConfig.KickExist = *req.KickExist
}
if req.PublishTimeout != nil {
pubConfig.PublishTimeout = req.PublishTimeout.AsDuration()
}
if req.WaitCloseTimeout != nil {
pubConfig.WaitCloseTimeout = req.WaitCloseTimeout.AsDuration()
}
if req.IdleTimeout != nil {
pubConfig.IdleTimeout = req.IdleTimeout.AsDuration()
}
if req.PauseTimeout != nil {
pubConfig.PauseTimeout = req.PauseTimeout.AsDuration()
}
if req.BufferTime != nil {
pubConfig.BufferTime = req.BufferTime.AsDuration()
}
if req.Scale != nil {
pubConfig.Scale = *req.Scale
}
if req.MaxFPS != nil {
pubConfig.MaxFPS = int(*req.MaxFPS)
}
if req.Key != nil {
pubConfig.Key = *req.Key
}
if req.RelayMode != nil {
pubConfig.RelayMode = *req.RelayMode
}
if req.PubType != nil {
pubConfig.PubType = *req.PubType
}
if req.Dump != nil {
pubConfig.Dump = *req.Dump
}
_, err = p.Pull(streamPath, pullConfig, &pubConfig)
if err != nil {
return nil, err
}
return &pb.SuccessResponse{
Code: 0,
Message: "success",
}, nil
}
}
}
return &pb.SuccessResponse{
Code: 0,
Message: "success",
}, nil
}
func (s *Server) GetAlarmList(ctx context.Context, req *pb.AlarmListRequest) (res *pb.AlarmListResponse, err error) {
// 初始化响应对象
res = &pb.AlarmListResponse{

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc v5.29.3
// protoc v6.31.1
// source: auth.proto
package pb

View File

@@ -10,6 +10,7 @@ package pb
import (
"context"
"errors"
"io"
"net/http"
@@ -24,116 +25,118 @@ import (
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Auth_Login_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LoginRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
var (
protoReq LoginRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Login(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Auth_Login_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LoginRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
var (
protoReq LoginRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Login(ctx, &protoReq)
return msg, metadata, err
}
func request_Auth_Logout_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LogoutRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
var (
protoReq LogoutRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Logout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Auth_Logout_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LogoutRequest
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
var (
protoReq LogoutRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Logout(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Auth_GetUserInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
var filter_Auth_GetUserInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
func request_Auth_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UserInfoRequest
var metadata runtime.ServerMetadata
var (
protoReq UserInfoRequest
metadata runtime.ServerMetadata
)
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Auth_GetUserInfo_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetUserInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Auth_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UserInfoRequest
var metadata runtime.ServerMetadata
var (
protoReq UserInfoRequest
metadata runtime.ServerMetadata
)
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Auth_GetUserInfo_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetUserInfo(ctx, &protoReq)
return msg, metadata, err
}
// RegisterAuthHandlerServer registers the http handlers for service Auth to "mux".
// UnaryRPC :call AuthServer 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 RegisterAuthHandlerFromEndpoint 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 RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServer) error {
mux.Handle("POST", pattern_Auth_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle(http.MethodPost, pattern_Auth_Login_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, "/pb.Auth/Login", runtime.WithHTTPPathPattern("/api/auth/login"))
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.Auth/Login", runtime.WithHTTPPathPattern("/api/auth/login"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -145,20 +148,15 @@ func RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Auth_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Auth_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle(http.MethodPost, pattern_Auth_Logout_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, "/pb.Auth/Logout", runtime.WithHTTPPathPattern("/api/auth/logout"))
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.Auth/Logout", runtime.WithHTTPPathPattern("/api/auth/logout"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -170,20 +168,15 @@ func RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Auth_Logout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Auth_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle(http.MethodGet, pattern_Auth_GetUserInfo_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, "/pb.Auth/GetUserInfo", runtime.WithHTTPPathPattern("/api/auth/userinfo"))
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.Auth/GetUserInfo", runtime.WithHTTPPathPattern("/api/auth/userinfo"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -195,9 +188,7 @@ func RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Auth_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
@@ -206,25 +197,24 @@ func RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve
// RegisterAuthHandlerFromEndpoint is same as RegisterAuthHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAuthHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.DialContext(ctx, endpoint, opts...)
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterAuthHandler(ctx, mux, conn)
}
@@ -238,16 +228,13 @@ func RegisterAuthHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "AuthClient" to call the correct interceptors.
// "AuthClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterAuthHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthClient) error {
mux.Handle("POST", pattern_Auth_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle(http.MethodPost, pattern_Auth_Login_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, "/pb.Auth/Login", runtime.WithHTTPPathPattern("/api/auth/login"))
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/pb.Auth/Login", runtime.WithHTTPPathPattern("/api/auth/login"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -258,18 +245,13 @@ func RegisterAuthHandlerClient(ctx context.Context, mux *runtime.ServeMux, clien
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Auth_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Auth_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle(http.MethodPost, pattern_Auth_Logout_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, "/pb.Auth/Logout", runtime.WithHTTPPathPattern("/api/auth/logout"))
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/pb.Auth/Logout", runtime.WithHTTPPathPattern("/api/auth/logout"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -280,18 +262,13 @@ func RegisterAuthHandlerClient(ctx context.Context, mux *runtime.ServeMux, clien
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Auth_Logout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Auth_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle(http.MethodGet, pattern_Auth_GetUserInfo_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, "/pb.Auth/GetUserInfo", runtime.WithHTTPPathPattern("/api/auth/userinfo"))
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/pb.Auth/GetUserInfo", runtime.WithHTTPPathPattern("/api/auth/userinfo"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -302,26 +279,19 @@ func RegisterAuthHandlerClient(ctx context.Context, mux *runtime.ServeMux, clien
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Auth_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Auth_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "login"}, ""))
pattern_Auth_Logout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "logout"}, ""))
pattern_Auth_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "login"}, ""))
pattern_Auth_Logout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "logout"}, ""))
pattern_Auth_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "userinfo"}, ""))
)
var (
forward_Auth_Login_0 = runtime.ForwardResponseMessage
forward_Auth_Logout_0 = runtime.ForwardResponseMessage
forward_Auth_Login_0 = runtime.ForwardResponseMessage
forward_Auth_Logout_0 = runtime.ForwardResponseMessage
forward_Auth_GetUserInfo_0 = runtime.ForwardResponseMessage
)

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.29.3
// - protoc v6.31.1
// source: auth.proto
package pb

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc v5.29.3
// protoc v6.31.1
// source: global.proto
package pb
@@ -5562,6 +5562,211 @@ func (x *SubscriptionProgressResponse) GetData() *SubscriptionProgressData {
return nil
}
type GlobalPullRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
RemoteURL string `protobuf:"bytes,1,opt,name=remoteURL,proto3" json:"remoteURL,omitempty"`
Protocol string `protobuf:"bytes,2,opt,name=protocol,proto3" json:"protocol,omitempty"`
TestMode int32 `protobuf:"varint,3,opt,name=testMode,proto3" json:"testMode,omitempty"` // 0: pull, 1: pull without publish
StreamPath string `protobuf:"bytes,4,opt,name=streamPath,proto3" json:"streamPath,omitempty"` // 流路径
// Publish configuration
PubAudio *bool `protobuf:"varint,5,opt,name=pubAudio,proto3,oneof" json:"pubAudio,omitempty"`
PubVideo *bool `protobuf:"varint,6,opt,name=pubVideo,proto3,oneof" json:"pubVideo,omitempty"`
DelayCloseTimeout *durationpb.Duration `protobuf:"bytes,7,opt,name=delayCloseTimeout,proto3,oneof" json:"delayCloseTimeout,omitempty"` // 延迟自动关闭(无订阅时)
Speed *float64 `protobuf:"fixed64,8,opt,name=speed,proto3,oneof" json:"speed,omitempty"` // 发送速率
MaxCount *int32 `protobuf:"varint,9,opt,name=maxCount,proto3,oneof" json:"maxCount,omitempty"` // 最大发布者数量
KickExist *bool `protobuf:"varint,10,opt,name=kickExist,proto3,oneof" json:"kickExist,omitempty"` // 是否踢掉已经存在的发布者
PublishTimeout *durationpb.Duration `protobuf:"bytes,11,opt,name=publishTimeout,proto3,oneof" json:"publishTimeout,omitempty"` // 发布无数据超时
WaitCloseTimeout *durationpb.Duration `protobuf:"bytes,12,opt,name=waitCloseTimeout,proto3,oneof" json:"waitCloseTimeout,omitempty"` // 延迟自动关闭(等待重连)
IdleTimeout *durationpb.Duration `protobuf:"bytes,13,opt,name=idleTimeout,proto3,oneof" json:"idleTimeout,omitempty"` // 空闲(无订阅)超时
PauseTimeout *durationpb.Duration `protobuf:"bytes,14,opt,name=pauseTimeout,proto3,oneof" json:"pauseTimeout,omitempty"` // 暂停超时时间
BufferTime *durationpb.Duration `protobuf:"bytes,15,opt,name=bufferTime,proto3,oneof" json:"bufferTime,omitempty"` // 缓冲时长0代表取最近关键帧
Scale *float64 `protobuf:"fixed64,16,opt,name=scale,proto3,oneof" json:"scale,omitempty"` // 缩放倍数
MaxFPS *int32 `protobuf:"varint,17,opt,name=maxFPS,proto3,oneof" json:"maxFPS,omitempty"` // 最大FPS
Key *string `protobuf:"bytes,18,opt,name=key,proto3,oneof" json:"key,omitempty"` // 发布鉴权key
RelayMode *string `protobuf:"bytes,19,opt,name=relayMode,proto3,oneof" json:"relayMode,omitempty"` // 转发模式
PubType *string `protobuf:"bytes,20,opt,name=pubType,proto3,oneof" json:"pubType,omitempty"` // 发布类型
Dump *bool `protobuf:"varint,21,opt,name=dump,proto3,oneof" json:"dump,omitempty"` // 是否dump
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GlobalPullRequest) Reset() {
*x = GlobalPullRequest{}
mi := &file_global_proto_msgTypes[74]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GlobalPullRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GlobalPullRequest) ProtoMessage() {}
func (x *GlobalPullRequest) ProtoReflect() protoreflect.Message {
mi := &file_global_proto_msgTypes[74]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GlobalPullRequest.ProtoReflect.Descriptor instead.
func (*GlobalPullRequest) Descriptor() ([]byte, []int) {
return file_global_proto_rawDescGZIP(), []int{74}
}
func (x *GlobalPullRequest) GetRemoteURL() string {
if x != nil {
return x.RemoteURL
}
return ""
}
func (x *GlobalPullRequest) GetProtocol() string {
if x != nil {
return x.Protocol
}
return ""
}
func (x *GlobalPullRequest) GetTestMode() int32 {
if x != nil {
return x.TestMode
}
return 0
}
func (x *GlobalPullRequest) GetStreamPath() string {
if x != nil {
return x.StreamPath
}
return ""
}
func (x *GlobalPullRequest) GetPubAudio() bool {
if x != nil && x.PubAudio != nil {
return *x.PubAudio
}
return false
}
func (x *GlobalPullRequest) GetPubVideo() bool {
if x != nil && x.PubVideo != nil {
return *x.PubVideo
}
return false
}
func (x *GlobalPullRequest) GetDelayCloseTimeout() *durationpb.Duration {
if x != nil {
return x.DelayCloseTimeout
}
return nil
}
func (x *GlobalPullRequest) GetSpeed() float64 {
if x != nil && x.Speed != nil {
return *x.Speed
}
return 0
}
func (x *GlobalPullRequest) GetMaxCount() int32 {
if x != nil && x.MaxCount != nil {
return *x.MaxCount
}
return 0
}
func (x *GlobalPullRequest) GetKickExist() bool {
if x != nil && x.KickExist != nil {
return *x.KickExist
}
return false
}
func (x *GlobalPullRequest) GetPublishTimeout() *durationpb.Duration {
if x != nil {
return x.PublishTimeout
}
return nil
}
func (x *GlobalPullRequest) GetWaitCloseTimeout() *durationpb.Duration {
if x != nil {
return x.WaitCloseTimeout
}
return nil
}
func (x *GlobalPullRequest) GetIdleTimeout() *durationpb.Duration {
if x != nil {
return x.IdleTimeout
}
return nil
}
func (x *GlobalPullRequest) GetPauseTimeout() *durationpb.Duration {
if x != nil {
return x.PauseTimeout
}
return nil
}
func (x *GlobalPullRequest) GetBufferTime() *durationpb.Duration {
if x != nil {
return x.BufferTime
}
return nil
}
func (x *GlobalPullRequest) GetScale() float64 {
if x != nil && x.Scale != nil {
return *x.Scale
}
return 0
}
func (x *GlobalPullRequest) GetMaxFPS() int32 {
if x != nil && x.MaxFPS != nil {
return *x.MaxFPS
}
return 0
}
func (x *GlobalPullRequest) GetKey() string {
if x != nil && x.Key != nil {
return *x.Key
}
return ""
}
func (x *GlobalPullRequest) GetRelayMode() string {
if x != nil && x.RelayMode != nil {
return *x.RelayMode
}
return ""
}
func (x *GlobalPullRequest) GetPubType() string {
if x != nil && x.PubType != nil {
return *x.PubType
}
return ""
}
func (x *GlobalPullRequest) GetDump() bool {
if x != nil && x.Dump != nil {
return *x.Dump
}
return false
}
var File_global_proto protoreflect.FileDescriptor
const file_global_proto_rawDesc = "" +
@@ -6161,7 +6366,55 @@ const file_global_proto_rawDesc = "" +
"\x1cSubscriptionProgressResponse\x12\x12\n" +
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage\x124\n" +
"\x04data\x18\x03 \x01(\v2 .global.SubscriptionProgressDataR\x04data2\xb6$\n" +
"\x04data\x18\x03 \x01(\v2 .global.SubscriptionProgressDataR\x04data\"\xe9\b\n" +
"\x11GlobalPullRequest\x12\x1c\n" +
"\tremoteURL\x18\x01 \x01(\tR\tremoteURL\x12\x1a\n" +
"\bprotocol\x18\x02 \x01(\tR\bprotocol\x12\x1a\n" +
"\btestMode\x18\x03 \x01(\x05R\btestMode\x12\x1e\n" +
"\n" +
"streamPath\x18\x04 \x01(\tR\n" +
"streamPath\x12\x1f\n" +
"\bpubAudio\x18\x05 \x01(\bH\x00R\bpubAudio\x88\x01\x01\x12\x1f\n" +
"\bpubVideo\x18\x06 \x01(\bH\x01R\bpubVideo\x88\x01\x01\x12L\n" +
"\x11delayCloseTimeout\x18\a \x01(\v2\x19.google.protobuf.DurationH\x02R\x11delayCloseTimeout\x88\x01\x01\x12\x19\n" +
"\x05speed\x18\b \x01(\x01H\x03R\x05speed\x88\x01\x01\x12\x1f\n" +
"\bmaxCount\x18\t \x01(\x05H\x04R\bmaxCount\x88\x01\x01\x12!\n" +
"\tkickExist\x18\n" +
" \x01(\bH\x05R\tkickExist\x88\x01\x01\x12F\n" +
"\x0epublishTimeout\x18\v \x01(\v2\x19.google.protobuf.DurationH\x06R\x0epublishTimeout\x88\x01\x01\x12J\n" +
"\x10waitCloseTimeout\x18\f \x01(\v2\x19.google.protobuf.DurationH\aR\x10waitCloseTimeout\x88\x01\x01\x12@\n" +
"\vidleTimeout\x18\r \x01(\v2\x19.google.protobuf.DurationH\bR\vidleTimeout\x88\x01\x01\x12B\n" +
"\fpauseTimeout\x18\x0e \x01(\v2\x19.google.protobuf.DurationH\tR\fpauseTimeout\x88\x01\x01\x12>\n" +
"\n" +
"bufferTime\x18\x0f \x01(\v2\x19.google.protobuf.DurationH\n" +
"R\n" +
"bufferTime\x88\x01\x01\x12\x19\n" +
"\x05scale\x18\x10 \x01(\x01H\vR\x05scale\x88\x01\x01\x12\x1b\n" +
"\x06maxFPS\x18\x11 \x01(\x05H\fR\x06maxFPS\x88\x01\x01\x12\x15\n" +
"\x03key\x18\x12 \x01(\tH\rR\x03key\x88\x01\x01\x12!\n" +
"\trelayMode\x18\x13 \x01(\tH\x0eR\trelayMode\x88\x01\x01\x12\x1d\n" +
"\apubType\x18\x14 \x01(\tH\x0fR\apubType\x88\x01\x01\x12\x17\n" +
"\x04dump\x18\x15 \x01(\bH\x10R\x04dump\x88\x01\x01B\v\n" +
"\t_pubAudioB\v\n" +
"\t_pubVideoB\x14\n" +
"\x12_delayCloseTimeoutB\b\n" +
"\x06_speedB\v\n" +
"\t_maxCountB\f\n" +
"\n" +
"_kickExistB\x11\n" +
"\x0f_publishTimeoutB\x13\n" +
"\x11_waitCloseTimeoutB\x0e\n" +
"\f_idleTimeoutB\x0f\n" +
"\r_pauseTimeoutB\r\n" +
"\v_bufferTimeB\b\n" +
"\x06_scaleB\t\n" +
"\a_maxFPSB\x06\n" +
"\x04_keyB\f\n" +
"\n" +
"_relayModeB\n" +
"\n" +
"\b_pubTypeB\a\n" +
"\x05_dump2\x94%\n" +
"\x03api\x12P\n" +
"\aSysInfo\x12\x16.google.protobuf.Empty\x1a\x17.global.SysInfoResponse\"\x14\x82\xd3\xe4\x93\x02\x0e\x12\f/api/sysinfo\x12i\n" +
"\x0fDisabledPlugins\x12\x16.google.protobuf.Empty\x1a\x1f.global.DisabledPluginsResponse\"\x1d\x82\xd3\xe4\x93\x02\x17\x12\x15/api/plugins/disabled\x12P\n" +
@@ -6209,7 +6462,8 @@ const file_global_proto_rawDesc = "" +
"\x10GetRecordCatalog\x12\x18.global.ReqRecordCatalog\x1a\x17.global.ResponseCatalog\"\"\x82\xd3\xe4\x93\x02\x1c\x12\x1a/api/record/{type}/catalog\x12u\n" +
"\fDeleteRecord\x12\x17.global.ReqRecordDelete\x1a\x16.global.ResponseDelete\"4\x82\xd3\xe4\x93\x02.:\x01*\")/api/record/{type}/delete/{streamPath=**}\x12\\\n" +
"\fGetAlarmList\x12\x18.global.AlarmListRequest\x1a\x19.global.AlarmListResponse\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/api/alarm/list\x12\x88\x01\n" +
"\x17GetSubscriptionProgress\x12\x19.global.StreamSnapRequest\x1a$.global.SubscriptionProgressResponse\",\x82\xd3\xe4\x93\x02&\x12$/api/stream/progress/{streamPath=**}B\x10Z\x0em7s.live/v5/pbb\x06proto3"
"\x17GetSubscriptionProgress\x12\x19.global.StreamSnapRequest\x1a$.global.SubscriptionProgressResponse\",\x82\xd3\xe4\x93\x02&\x12$/api/stream/progress/{streamPath=**}\x12\\\n" +
"\tStartPull\x12\x19.global.GlobalPullRequest\x1a\x17.global.SuccessResponse\"\x1b\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/api/stream/pullB\x10Z\x0em7s.live/v5/pbb\x06proto3"
var (
file_global_proto_rawDescOnce sync.Once
@@ -6223,7 +6477,7 @@ func file_global_proto_rawDescGZIP() []byte {
return file_global_proto_rawDescData
}
var file_global_proto_msgTypes = make([]protoimpl.MessageInfo, 81)
var file_global_proto_msgTypes = make([]protoimpl.MessageInfo, 82)
var file_global_proto_goTypes = []any{
(*DisabledPluginsResponse)(nil), // 0: global.DisabledPluginsResponse
(*GetConfigRequest)(nil), // 1: global.GetConfigRequest
@@ -6299,184 +6553,193 @@ var file_global_proto_goTypes = []any{
(*Step)(nil), // 71: global.Step
(*SubscriptionProgressData)(nil), // 72: global.SubscriptionProgressData
(*SubscriptionProgressResponse)(nil), // 73: global.SubscriptionProgressResponse
nil, // 74: global.Formily.PropertiesEntry
nil, // 75: global.Formily.ComponentPropsEntry
nil, // 76: global.FormilyResponse.PropertiesEntry
nil, // 77: global.PluginInfo.DescriptionEntry
nil, // 78: global.TaskTreeData.DescriptionEntry
nil, // 79: global.StreamWaitListResponse.ListEntry
nil, // 80: global.TrackSnapShotData.ReaderEntry
(*timestamppb.Timestamp)(nil), // 81: google.protobuf.Timestamp
(*durationpb.Duration)(nil), // 82: google.protobuf.Duration
(*anypb.Any)(nil), // 83: google.protobuf.Any
(*emptypb.Empty)(nil), // 84: google.protobuf.Empty
(*GlobalPullRequest)(nil), // 74: global.GlobalPullRequest
nil, // 75: global.Formily.PropertiesEntry
nil, // 76: global.Formily.ComponentPropsEntry
nil, // 77: global.FormilyResponse.PropertiesEntry
nil, // 78: global.PluginInfo.DescriptionEntry
nil, // 79: global.TaskTreeData.DescriptionEntry
nil, // 80: global.StreamWaitListResponse.ListEntry
nil, // 81: global.TrackSnapShotData.ReaderEntry
(*timestamppb.Timestamp)(nil), // 82: google.protobuf.Timestamp
(*durationpb.Duration)(nil), // 83: google.protobuf.Duration
(*anypb.Any)(nil), // 84: google.protobuf.Any
(*emptypb.Empty)(nil), // 85: google.protobuf.Empty
}
var file_global_proto_depIdxs = []int32{
12, // 0: global.DisabledPluginsResponse.data:type_name -> global.PluginInfo
74, // 1: global.Formily.properties:type_name -> global.Formily.PropertiesEntry
75, // 2: global.Formily.componentProps:type_name -> global.Formily.ComponentPropsEntry
76, // 3: global.FormilyResponse.properties:type_name -> global.FormilyResponse.PropertiesEntry
75, // 1: global.Formily.properties:type_name -> global.Formily.PropertiesEntry
76, // 2: global.Formily.componentProps:type_name -> global.Formily.ComponentPropsEntry
77, // 3: global.FormilyResponse.properties:type_name -> global.FormilyResponse.PropertiesEntry
4, // 4: global.GetConfigResponse.data:type_name -> global.ConfigData
10, // 5: global.SummaryResponse.memory:type_name -> global.Usage
10, // 6: global.SummaryResponse.hardDisk:type_name -> global.Usage
9, // 7: global.SummaryResponse.netWork:type_name -> global.NetWorkInfo
77, // 8: global.PluginInfo.description:type_name -> global.PluginInfo.DescriptionEntry
81, // 9: global.SysInfoData.startTime:type_name -> google.protobuf.Timestamp
78, // 8: global.PluginInfo.description:type_name -> global.PluginInfo.DescriptionEntry
82, // 9: global.SysInfoData.startTime:type_name -> google.protobuf.Timestamp
12, // 10: global.SysInfoData.plugins:type_name -> global.PluginInfo
13, // 11: global.SysInfoResponse.data:type_name -> global.SysInfoData
81, // 12: global.TaskTreeData.startTime:type_name -> google.protobuf.Timestamp
78, // 13: global.TaskTreeData.description:type_name -> global.TaskTreeData.DescriptionEntry
82, // 12: global.TaskTreeData.startTime:type_name -> google.protobuf.Timestamp
79, // 13: global.TaskTreeData.description:type_name -> global.TaskTreeData.DescriptionEntry
15, // 14: global.TaskTreeData.children:type_name -> global.TaskTreeData
15, // 15: global.TaskTreeData.blocked:type_name -> global.TaskTreeData
15, // 16: global.TaskTreeResponse.data:type_name -> global.TaskTreeData
22, // 17: global.StreamListResponse.data:type_name -> global.StreamInfo
79, // 18: global.StreamWaitListResponse.list:type_name -> global.StreamWaitListResponse.ListEntry
80, // 18: global.StreamWaitListResponse.list:type_name -> global.StreamWaitListResponse.ListEntry
22, // 19: global.StreamInfoResponse.data:type_name -> global.StreamInfo
28, // 20: global.StreamInfo.audioTrack:type_name -> global.AudioTrackInfo
31, // 21: global.StreamInfo.videoTrack:type_name -> global.VideoTrackInfo
81, // 22: global.StreamInfo.startTime:type_name -> google.protobuf.Timestamp
82, // 23: global.StreamInfo.bufferTime:type_name -> google.protobuf.Duration
82, // 22: global.StreamInfo.startTime:type_name -> google.protobuf.Timestamp
83, // 23: global.StreamInfo.bufferTime:type_name -> google.protobuf.Duration
23, // 24: global.StreamInfo.recording:type_name -> global.RecordingDetail
82, // 25: global.RecordingDetail.fragment:type_name -> google.protobuf.Duration
81, // 26: global.TrackSnapShot.writeTime:type_name -> google.protobuf.Timestamp
83, // 25: global.RecordingDetail.fragment:type_name -> google.protobuf.Duration
82, // 26: global.TrackSnapShot.writeTime:type_name -> google.protobuf.Timestamp
24, // 27: global.TrackSnapShot.wrap:type_name -> global.Wrap
26, // 28: global.MemoryBlockGroup.list:type_name -> global.MemoryBlock
25, // 29: global.TrackSnapShotData.ring:type_name -> global.TrackSnapShot
80, // 30: global.TrackSnapShotData.reader:type_name -> global.TrackSnapShotData.ReaderEntry
81, // 30: global.TrackSnapShotData.reader:type_name -> global.TrackSnapShotData.ReaderEntry
27, // 31: global.TrackSnapShotData.memory:type_name -> global.MemoryBlockGroup
29, // 32: global.TrackSnapShotResponse.data:type_name -> global.TrackSnapShotData
81, // 33: global.SubscriberSnapShot.startTime:type_name -> google.protobuf.Timestamp
82, // 33: global.SubscriberSnapShot.startTime:type_name -> google.protobuf.Timestamp
37, // 34: global.SubscriberSnapShot.audioReader:type_name -> global.RingReaderSnapShot
37, // 35: global.SubscriberSnapShot.videoReader:type_name -> global.RingReaderSnapShot
82, // 36: global.SubscriberSnapShot.bufferTime:type_name -> google.protobuf.Duration
83, // 36: global.SubscriberSnapShot.bufferTime:type_name -> google.protobuf.Duration
38, // 37: global.SubscribersResponse.data:type_name -> global.SubscriberSnapShot
41, // 38: global.PullProxyListResponse.data:type_name -> global.PullProxyInfo
81, // 39: global.PullProxyInfo.createTime:type_name -> google.protobuf.Timestamp
81, // 40: global.PullProxyInfo.updateTime:type_name -> google.protobuf.Timestamp
82, // 41: global.PullProxyInfo.recordFragment:type_name -> google.protobuf.Duration
82, // 42: global.PullProxyInfo.checkInterval:type_name -> google.protobuf.Duration
82, // 43: global.UpdatePullProxyRequest.recordFragment:type_name -> google.protobuf.Duration
82, // 44: global.UpdatePullProxyRequest.checkInterval:type_name -> google.protobuf.Duration
81, // 45: global.PushProxyInfo.createTime:type_name -> google.protobuf.Timestamp
81, // 46: global.PushProxyInfo.updateTime:type_name -> google.protobuf.Timestamp
82, // 39: global.PullProxyInfo.createTime:type_name -> google.protobuf.Timestamp
82, // 40: global.PullProxyInfo.updateTime:type_name -> google.protobuf.Timestamp
83, // 41: global.PullProxyInfo.recordFragment:type_name -> google.protobuf.Duration
83, // 42: global.PullProxyInfo.checkInterval:type_name -> google.protobuf.Duration
83, // 43: global.UpdatePullProxyRequest.recordFragment:type_name -> google.protobuf.Duration
83, // 44: global.UpdatePullProxyRequest.checkInterval:type_name -> google.protobuf.Duration
82, // 45: global.PushProxyInfo.createTime:type_name -> google.protobuf.Timestamp
82, // 46: global.PushProxyInfo.updateTime:type_name -> google.protobuf.Timestamp
43, // 47: global.PushProxyListResponse.data:type_name -> global.PushProxyInfo
47, // 48: global.StreamAliasListResponse.data:type_name -> global.StreamAlias
81, // 49: global.Recording.startTime:type_name -> google.protobuf.Timestamp
82, // 49: global.Recording.startTime:type_name -> google.protobuf.Timestamp
51, // 50: global.RecordingListResponse.data:type_name -> global.Recording
81, // 51: global.PushInfo.startTime:type_name -> google.protobuf.Timestamp
82, // 51: global.PushInfo.startTime:type_name -> google.protobuf.Timestamp
53, // 52: global.PushListResponse.data:type_name -> global.PushInfo
56, // 53: global.TransformListResponse.data:type_name -> global.Transform
81, // 54: global.RecordFile.startTime:type_name -> google.protobuf.Timestamp
81, // 55: global.RecordFile.endTime:type_name -> google.protobuf.Timestamp
81, // 56: global.EventRecordFile.startTime:type_name -> google.protobuf.Timestamp
81, // 57: global.EventRecordFile.endTime:type_name -> google.protobuf.Timestamp
82, // 54: global.RecordFile.startTime:type_name -> google.protobuf.Timestamp
82, // 55: global.RecordFile.endTime:type_name -> google.protobuf.Timestamp
82, // 56: global.EventRecordFile.startTime:type_name -> google.protobuf.Timestamp
82, // 57: global.EventRecordFile.endTime:type_name -> google.protobuf.Timestamp
59, // 58: global.RecordResponseList.data:type_name -> global.RecordFile
60, // 59: global.EventRecordResponseList.data:type_name -> global.EventRecordFile
81, // 60: global.Catalog.startTime:type_name -> google.protobuf.Timestamp
81, // 61: global.Catalog.endTime:type_name -> google.protobuf.Timestamp
82, // 60: global.Catalog.startTime:type_name -> google.protobuf.Timestamp
82, // 61: global.Catalog.endTime:type_name -> google.protobuf.Timestamp
63, // 62: global.ResponseCatalog.data:type_name -> global.Catalog
59, // 63: global.ResponseDelete.data:type_name -> global.RecordFile
81, // 64: global.AlarmInfo.createdAt:type_name -> google.protobuf.Timestamp
81, // 65: global.AlarmInfo.updatedAt:type_name -> google.protobuf.Timestamp
82, // 64: global.AlarmInfo.createdAt:type_name -> google.protobuf.Timestamp
82, // 65: global.AlarmInfo.updatedAt:type_name -> google.protobuf.Timestamp
68, // 66: global.AlarmListResponse.data:type_name -> global.AlarmInfo
81, // 67: global.Step.startedAt:type_name -> google.protobuf.Timestamp
81, // 68: global.Step.completedAt:type_name -> google.protobuf.Timestamp
82, // 67: global.Step.startedAt:type_name -> google.protobuf.Timestamp
82, // 68: global.Step.completedAt:type_name -> google.protobuf.Timestamp
71, // 69: global.SubscriptionProgressData.steps:type_name -> global.Step
72, // 70: global.SubscriptionProgressResponse.data:type_name -> global.SubscriptionProgressData
2, // 71: global.Formily.PropertiesEntry.value:type_name -> global.Formily
83, // 72: global.Formily.ComponentPropsEntry.value:type_name -> google.protobuf.Any
2, // 73: global.FormilyResponse.PropertiesEntry.value:type_name -> global.Formily
84, // 74: global.api.SysInfo:input_type -> google.protobuf.Empty
84, // 75: global.api.DisabledPlugins:input_type -> google.protobuf.Empty
84, // 76: global.api.Summary:input_type -> google.protobuf.Empty
33, // 77: global.api.Shutdown:input_type -> global.RequestWithId
33, // 78: global.api.Restart:input_type -> global.RequestWithId
84, // 79: global.api.TaskTree:input_type -> google.protobuf.Empty
34, // 80: global.api.StopTask:input_type -> global.RequestWithId64
34, // 81: global.api.RestartTask:input_type -> global.RequestWithId64
17, // 82: global.api.StreamList:input_type -> global.StreamListRequest
84, // 83: global.api.WaitList:input_type -> google.protobuf.Empty
20, // 84: global.api.StreamInfo:input_type -> global.StreamSnapRequest
20, // 85: global.api.PauseStream:input_type -> global.StreamSnapRequest
20, // 86: global.api.ResumeStream:input_type -> global.StreamSnapRequest
49, // 87: global.api.SetStreamSpeed:input_type -> global.SetStreamSpeedRequest
50, // 88: global.api.SeekStream:input_type -> global.SeekStreamRequest
36, // 89: global.api.GetSubscribers:input_type -> global.SubscribersRequest
20, // 90: global.api.AudioTrackSnap:input_type -> global.StreamSnapRequest
20, // 91: global.api.VideoTrackSnap:input_type -> global.StreamSnapRequest
35, // 92: global.api.ChangeSubscribe:input_type -> global.ChangeSubscribeRequest
84, // 93: global.api.GetStreamAlias:input_type -> google.protobuf.Empty
46, // 94: global.api.SetStreamAlias:input_type -> global.SetStreamAliasRequest
20, // 95: global.api.StopPublish:input_type -> global.StreamSnapRequest
33, // 96: global.api.StopSubscribe:input_type -> global.RequestWithId
84, // 97: global.api.GetConfigFile:input_type -> google.protobuf.Empty
7, // 98: global.api.UpdateConfigFile:input_type -> global.UpdateConfigFileRequest
1, // 99: global.api.GetConfig:input_type -> global.GetConfigRequest
1, // 100: global.api.GetFormily:input_type -> global.GetConfigRequest
84, // 101: global.api.GetPullProxyList:input_type -> google.protobuf.Empty
41, // 102: global.api.AddPullProxy:input_type -> global.PullProxyInfo
33, // 103: global.api.RemovePullProxy:input_type -> global.RequestWithId
42, // 104: global.api.UpdatePullProxy:input_type -> global.UpdatePullProxyRequest
84, // 105: global.api.GetPushProxyList:input_type -> google.protobuf.Empty
43, // 106: global.api.AddPushProxy:input_type -> global.PushProxyInfo
33, // 107: global.api.RemovePushProxy:input_type -> global.RequestWithId
44, // 108: global.api.UpdatePushProxy:input_type -> global.UpdatePushProxyRequest
84, // 109: global.api.GetRecording:input_type -> google.protobuf.Empty
84, // 110: global.api.GetTransformList:input_type -> google.protobuf.Empty
58, // 111: global.api.GetRecordList:input_type -> global.ReqRecordList
58, // 112: global.api.GetEventRecordList:input_type -> global.ReqRecordList
67, // 113: global.api.GetRecordCatalog:input_type -> global.ReqRecordCatalog
65, // 114: global.api.DeleteRecord:input_type -> global.ReqRecordDelete
69, // 115: global.api.GetAlarmList:input_type -> global.AlarmListRequest
20, // 116: global.api.GetSubscriptionProgress:input_type -> global.StreamSnapRequest
14, // 117: global.api.SysInfo:output_type -> global.SysInfoResponse
0, // 118: global.api.DisabledPlugins:output_type -> global.DisabledPluginsResponse
11, // 119: global.api.Summary:output_type -> global.SummaryResponse
32, // 120: global.api.Shutdown:output_type -> global.SuccessResponse
32, // 121: global.api.Restart:output_type -> global.SuccessResponse
16, // 122: global.api.TaskTree:output_type -> global.TaskTreeResponse
32, // 123: global.api.StopTask:output_type -> global.SuccessResponse
32, // 124: global.api.RestartTask:output_type -> global.SuccessResponse
18, // 125: global.api.StreamList:output_type -> global.StreamListResponse
19, // 126: global.api.WaitList:output_type -> global.StreamWaitListResponse
21, // 127: global.api.StreamInfo:output_type -> global.StreamInfoResponse
32, // 128: global.api.PauseStream:output_type -> global.SuccessResponse
32, // 129: global.api.ResumeStream:output_type -> global.SuccessResponse
32, // 130: global.api.SetStreamSpeed:output_type -> global.SuccessResponse
32, // 131: global.api.SeekStream:output_type -> global.SuccessResponse
39, // 132: global.api.GetSubscribers:output_type -> global.SubscribersResponse
30, // 133: global.api.AudioTrackSnap:output_type -> global.TrackSnapShotResponse
30, // 134: global.api.VideoTrackSnap:output_type -> global.TrackSnapShotResponse
32, // 135: global.api.ChangeSubscribe:output_type -> global.SuccessResponse
48, // 136: global.api.GetStreamAlias:output_type -> global.StreamAliasListResponse
32, // 137: global.api.SetStreamAlias:output_type -> global.SuccessResponse
32, // 138: global.api.StopPublish:output_type -> global.SuccessResponse
32, // 139: global.api.StopSubscribe:output_type -> global.SuccessResponse
5, // 140: global.api.GetConfigFile:output_type -> global.GetConfigFileResponse
32, // 141: global.api.UpdateConfigFile:output_type -> global.SuccessResponse
6, // 142: global.api.GetConfig:output_type -> global.GetConfigResponse
6, // 143: global.api.GetFormily:output_type -> global.GetConfigResponse
40, // 144: global.api.GetPullProxyList:output_type -> global.PullProxyListResponse
32, // 145: global.api.AddPullProxy:output_type -> global.SuccessResponse
32, // 146: global.api.RemovePullProxy:output_type -> global.SuccessResponse
32, // 147: global.api.UpdatePullProxy:output_type -> global.SuccessResponse
45, // 148: global.api.GetPushProxyList:output_type -> global.PushProxyListResponse
32, // 149: global.api.AddPushProxy:output_type -> global.SuccessResponse
32, // 150: global.api.RemovePushProxy:output_type -> global.SuccessResponse
32, // 151: global.api.UpdatePushProxy:output_type -> global.SuccessResponse
52, // 152: global.api.GetRecording:output_type -> global.RecordingListResponse
57, // 153: global.api.GetTransformList:output_type -> global.TransformListResponse
61, // 154: global.api.GetRecordList:output_type -> global.RecordResponseList
62, // 155: global.api.GetEventRecordList:output_type -> global.EventRecordResponseList
64, // 156: global.api.GetRecordCatalog:output_type -> global.ResponseCatalog
66, // 157: global.api.DeleteRecord:output_type -> global.ResponseDelete
70, // 158: global.api.GetAlarmList:output_type -> global.AlarmListResponse
73, // 159: global.api.GetSubscriptionProgress:output_type -> global.SubscriptionProgressResponse
117, // [117:160] is the sub-list for method output_type
74, // [74:117] is the sub-list for method input_type
74, // [74:74] is the sub-list for extension type_name
74, // [74:74] is the sub-list for extension extendee
0, // [0:74] is the sub-list for field type_name
83, // 71: global.GlobalPullRequest.delayCloseTimeout:type_name -> google.protobuf.Duration
83, // 72: global.GlobalPullRequest.publishTimeout:type_name -> google.protobuf.Duration
83, // 73: global.GlobalPullRequest.waitCloseTimeout:type_name -> google.protobuf.Duration
83, // 74: global.GlobalPullRequest.idleTimeout:type_name -> google.protobuf.Duration
83, // 75: global.GlobalPullRequest.pauseTimeout:type_name -> google.protobuf.Duration
83, // 76: global.GlobalPullRequest.bufferTime:type_name -> google.protobuf.Duration
2, // 77: global.Formily.PropertiesEntry.value:type_name -> global.Formily
84, // 78: global.Formily.ComponentPropsEntry.value:type_name -> google.protobuf.Any
2, // 79: global.FormilyResponse.PropertiesEntry.value:type_name -> global.Formily
85, // 80: global.api.SysInfo:input_type -> google.protobuf.Empty
85, // 81: global.api.DisabledPlugins:input_type -> google.protobuf.Empty
85, // 82: global.api.Summary:input_type -> google.protobuf.Empty
33, // 83: global.api.Shutdown:input_type -> global.RequestWithId
33, // 84: global.api.Restart:input_type -> global.RequestWithId
85, // 85: global.api.TaskTree:input_type -> google.protobuf.Empty
34, // 86: global.api.StopTask:input_type -> global.RequestWithId64
34, // 87: global.api.RestartTask:input_type -> global.RequestWithId64
17, // 88: global.api.StreamList:input_type -> global.StreamListRequest
85, // 89: global.api.WaitList:input_type -> google.protobuf.Empty
20, // 90: global.api.StreamInfo:input_type -> global.StreamSnapRequest
20, // 91: global.api.PauseStream:input_type -> global.StreamSnapRequest
20, // 92: global.api.ResumeStream:input_type -> global.StreamSnapRequest
49, // 93: global.api.SetStreamSpeed:input_type -> global.SetStreamSpeedRequest
50, // 94: global.api.SeekStream:input_type -> global.SeekStreamRequest
36, // 95: global.api.GetSubscribers:input_type -> global.SubscribersRequest
20, // 96: global.api.AudioTrackSnap:input_type -> global.StreamSnapRequest
20, // 97: global.api.VideoTrackSnap:input_type -> global.StreamSnapRequest
35, // 98: global.api.ChangeSubscribe:input_type -> global.ChangeSubscribeRequest
85, // 99: global.api.GetStreamAlias:input_type -> google.protobuf.Empty
46, // 100: global.api.SetStreamAlias:input_type -> global.SetStreamAliasRequest
20, // 101: global.api.StopPublish:input_type -> global.StreamSnapRequest
33, // 102: global.api.StopSubscribe:input_type -> global.RequestWithId
85, // 103: global.api.GetConfigFile:input_type -> google.protobuf.Empty
7, // 104: global.api.UpdateConfigFile:input_type -> global.UpdateConfigFileRequest
1, // 105: global.api.GetConfig:input_type -> global.GetConfigRequest
1, // 106: global.api.GetFormily:input_type -> global.GetConfigRequest
85, // 107: global.api.GetPullProxyList:input_type -> google.protobuf.Empty
41, // 108: global.api.AddPullProxy:input_type -> global.PullProxyInfo
33, // 109: global.api.RemovePullProxy:input_type -> global.RequestWithId
42, // 110: global.api.UpdatePullProxy:input_type -> global.UpdatePullProxyRequest
85, // 111: global.api.GetPushProxyList:input_type -> google.protobuf.Empty
43, // 112: global.api.AddPushProxy:input_type -> global.PushProxyInfo
33, // 113: global.api.RemovePushProxy:input_type -> global.RequestWithId
44, // 114: global.api.UpdatePushProxy:input_type -> global.UpdatePushProxyRequest
85, // 115: global.api.GetRecording:input_type -> google.protobuf.Empty
85, // 116: global.api.GetTransformList:input_type -> google.protobuf.Empty
58, // 117: global.api.GetRecordList:input_type -> global.ReqRecordList
58, // 118: global.api.GetEventRecordList:input_type -> global.ReqRecordList
67, // 119: global.api.GetRecordCatalog:input_type -> global.ReqRecordCatalog
65, // 120: global.api.DeleteRecord:input_type -> global.ReqRecordDelete
69, // 121: global.api.GetAlarmList:input_type -> global.AlarmListRequest
20, // 122: global.api.GetSubscriptionProgress:input_type -> global.StreamSnapRequest
74, // 123: global.api.StartPull:input_type -> global.GlobalPullRequest
14, // 124: global.api.SysInfo:output_type -> global.SysInfoResponse
0, // 125: global.api.DisabledPlugins:output_type -> global.DisabledPluginsResponse
11, // 126: global.api.Summary:output_type -> global.SummaryResponse
32, // 127: global.api.Shutdown:output_type -> global.SuccessResponse
32, // 128: global.api.Restart:output_type -> global.SuccessResponse
16, // 129: global.api.TaskTree:output_type -> global.TaskTreeResponse
32, // 130: global.api.StopTask:output_type -> global.SuccessResponse
32, // 131: global.api.RestartTask:output_type -> global.SuccessResponse
18, // 132: global.api.StreamList:output_type -> global.StreamListResponse
19, // 133: global.api.WaitList:output_type -> global.StreamWaitListResponse
21, // 134: global.api.StreamInfo:output_type -> global.StreamInfoResponse
32, // 135: global.api.PauseStream:output_type -> global.SuccessResponse
32, // 136: global.api.ResumeStream:output_type -> global.SuccessResponse
32, // 137: global.api.SetStreamSpeed:output_type -> global.SuccessResponse
32, // 138: global.api.SeekStream:output_type -> global.SuccessResponse
39, // 139: global.api.GetSubscribers:output_type -> global.SubscribersResponse
30, // 140: global.api.AudioTrackSnap:output_type -> global.TrackSnapShotResponse
30, // 141: global.api.VideoTrackSnap:output_type -> global.TrackSnapShotResponse
32, // 142: global.api.ChangeSubscribe:output_type -> global.SuccessResponse
48, // 143: global.api.GetStreamAlias:output_type -> global.StreamAliasListResponse
32, // 144: global.api.SetStreamAlias:output_type -> global.SuccessResponse
32, // 145: global.api.StopPublish:output_type -> global.SuccessResponse
32, // 146: global.api.StopSubscribe:output_type -> global.SuccessResponse
5, // 147: global.api.GetConfigFile:output_type -> global.GetConfigFileResponse
32, // 148: global.api.UpdateConfigFile:output_type -> global.SuccessResponse
6, // 149: global.api.GetConfig:output_type -> global.GetConfigResponse
6, // 150: global.api.GetFormily:output_type -> global.GetConfigResponse
40, // 151: global.api.GetPullProxyList:output_type -> global.PullProxyListResponse
32, // 152: global.api.AddPullProxy:output_type -> global.SuccessResponse
32, // 153: global.api.RemovePullProxy:output_type -> global.SuccessResponse
32, // 154: global.api.UpdatePullProxy:output_type -> global.SuccessResponse
45, // 155: global.api.GetPushProxyList:output_type -> global.PushProxyListResponse
32, // 156: global.api.AddPushProxy:output_type -> global.SuccessResponse
32, // 157: global.api.RemovePushProxy:output_type -> global.SuccessResponse
32, // 158: global.api.UpdatePushProxy:output_type -> global.SuccessResponse
52, // 159: global.api.GetRecording:output_type -> global.RecordingListResponse
57, // 160: global.api.GetTransformList:output_type -> global.TransformListResponse
61, // 161: global.api.GetRecordList:output_type -> global.RecordResponseList
62, // 162: global.api.GetEventRecordList:output_type -> global.EventRecordResponseList
64, // 163: global.api.GetRecordCatalog:output_type -> global.ResponseCatalog
66, // 164: global.api.DeleteRecord:output_type -> global.ResponseDelete
70, // 165: global.api.GetAlarmList:output_type -> global.AlarmListResponse
73, // 166: global.api.GetSubscriptionProgress:output_type -> global.SubscriptionProgressResponse
32, // 167: global.api.StartPull:output_type -> global.SuccessResponse
124, // [124:168] is the sub-list for method output_type
80, // [80:124] is the sub-list for method input_type
80, // [80:80] is the sub-list for extension type_name
80, // [80:80] is the sub-list for extension extendee
0, // [0:80] is the sub-list for field type_name
}
func init() { file_global_proto_init() }
@@ -6486,13 +6749,14 @@ func file_global_proto_init() {
}
file_global_proto_msgTypes[42].OneofWrappers = []any{}
file_global_proto_msgTypes[44].OneofWrappers = []any{}
file_global_proto_msgTypes[74].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_global_proto_rawDesc), len(file_global_proto_rawDesc)),
NumEnums: 0,
NumMessages: 81,
NumMessages: 82,
NumExtensions: 0,
NumServices: 1,
},

File diff suppressed because it is too large Load Diff

View File

@@ -255,6 +255,13 @@ service api {
get: "/api/stream/progress/{streamPath=**}"
};
}
rpc StartPull (GlobalPullRequest) returns (SuccessResponse) {
option (google.api.http) = {
post: "/api/stream/pull"
body: "*"
};
}
}
message DisabledPluginsResponse {
@@ -838,4 +845,30 @@ message SubscriptionProgressResponse {
int32 code = 1;
string message = 2;
SubscriptionProgressData data = 3;
}
message GlobalPullRequest {
string remoteURL = 1;
string protocol = 2;
int32 testMode = 3; // 0: pull, 1: pull without publish
string streamPath = 4; // 流路径
// Publish configuration
optional bool pubAudio = 5;
optional bool pubVideo = 6;
optional google.protobuf.Duration delayCloseTimeout = 7; // 延迟自动关闭(无订阅时)
optional double speed = 8; // 发送速率
optional int32 maxCount = 9; // 最大发布者数量
optional bool kickExist = 10; // 是否踢掉已经存在的发布者
optional google.protobuf.Duration publishTimeout = 11; // 发布无数据超时
optional google.protobuf.Duration waitCloseTimeout = 12; // 延迟自动关闭(等待重连)
optional google.protobuf.Duration idleTimeout = 13; // 空闲(无订阅)超时
optional google.protobuf.Duration pauseTimeout = 14; // 暂停超时时间
optional google.protobuf.Duration bufferTime = 15; // 缓冲时长0代表取最近关键帧
optional double scale = 16; // 缩放倍数
optional int32 maxFPS = 17; // 最大FPS
optional string key = 18; // 发布鉴权key
optional string relayMode = 19; // 转发模式
optional string pubType = 20; // 发布类型
optional bool dump = 21; // 是否dump
}

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.29.3
// - protoc v6.31.1
// source: global.proto
package pb
@@ -63,6 +63,7 @@ const (
Api_DeleteRecord_FullMethodName = "/global.api/DeleteRecord"
Api_GetAlarmList_FullMethodName = "/global.api/GetAlarmList"
Api_GetSubscriptionProgress_FullMethodName = "/global.api/GetSubscriptionProgress"
Api_StartPull_FullMethodName = "/global.api/StartPull"
)
// ApiClient is the client API for Api service.
@@ -112,6 +113,7 @@ type ApiClient interface {
DeleteRecord(ctx context.Context, in *ReqRecordDelete, opts ...grpc.CallOption) (*ResponseDelete, error)
GetAlarmList(ctx context.Context, in *AlarmListRequest, opts ...grpc.CallOption) (*AlarmListResponse, error)
GetSubscriptionProgress(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*SubscriptionProgressResponse, error)
StartPull(ctx context.Context, in *GlobalPullRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
}
type apiClient struct {
@@ -552,6 +554,16 @@ func (c *apiClient) GetSubscriptionProgress(ctx context.Context, in *StreamSnapR
return out, nil
}
func (c *apiClient) StartPull(ctx context.Context, in *GlobalPullRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SuccessResponse)
err := c.cc.Invoke(ctx, Api_StartPull_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ApiServer is the server API for Api service.
// All implementations must embed UnimplementedApiServer
// for forward compatibility.
@@ -599,6 +611,7 @@ type ApiServer interface {
DeleteRecord(context.Context, *ReqRecordDelete) (*ResponseDelete, error)
GetAlarmList(context.Context, *AlarmListRequest) (*AlarmListResponse, error)
GetSubscriptionProgress(context.Context, *StreamSnapRequest) (*SubscriptionProgressResponse, error)
StartPull(context.Context, *GlobalPullRequest) (*SuccessResponse, error)
mustEmbedUnimplementedApiServer()
}
@@ -738,6 +751,9 @@ func (UnimplementedApiServer) GetAlarmList(context.Context, *AlarmListRequest) (
func (UnimplementedApiServer) GetSubscriptionProgress(context.Context, *StreamSnapRequest) (*SubscriptionProgressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSubscriptionProgress not implemented")
}
func (UnimplementedApiServer) StartPull(context.Context, *GlobalPullRequest) (*SuccessResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method StartPull not implemented")
}
func (UnimplementedApiServer) mustEmbedUnimplementedApiServer() {}
func (UnimplementedApiServer) testEmbeddedByValue() {}
@@ -1533,6 +1549,24 @@ func _Api_GetSubscriptionProgress_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _Api_StartPull_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GlobalPullRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ApiServer).StartPull(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Api_StartPull_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ApiServer).StartPull(ctx, req.(*GlobalPullRequest))
}
return interceptor(ctx, in, info, handler)
}
// Api_ServiceDesc is the grpc.ServiceDesc for Api service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -1712,6 +1746,10 @@ var Api_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetSubscriptionProgress",
Handler: _Api_GetSubscriptionProgress_Handler,
},
{
MethodName: "StartPull",
Handler: _Api_StartPull_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "global.proto",

View File

@@ -76,8 +76,8 @@ func (c *Stream) Do(req *util.Request) (*util.Response, error) {
func (c *Stream) Options() error {
req := &util.Request{
Method: MethodOptions,
URL: c.URL,
Method: MethodOptions,
URL: c.URL,
Header: map[string][]string{},
}
@@ -257,7 +257,17 @@ func (c *Stream) SetupMedia(media *Media, index int) (byte, error) {
}
func (c *Stream) Play() (err error) {
_, err = c.Do(&util.Request{Method: MethodPlay, URL: c.URL})
req := &util.Request{
Method: MethodPlay,
URL: c.URL,
Header: map[string][]string{},
}
if c.UserAgent != "" {
req.Header.Set("User-Agent", c.UserAgent)
}
_, err = c.Do(req)
return
}

View File

@@ -19,11 +19,13 @@ import (
"m7s.live/v5/pkg/task"
"m7s.live/v5/pkg/util"
flv "m7s.live/v5/plugin/flv/pkg"
hls "m7s.live/v5/plugin/hls/pkg"
mp4 "m7s.live/v5/plugin/mp4/pkg"
rtmp "m7s.live/v5/plugin/rtmp/pkg"
rtsp "m7s.live/v5/plugin/rtsp/pkg"
srt "m7s.live/v5/plugin/srt/pkg"
testpb "m7s.live/v5/plugin/test/pb"
webrtc "m7s.live/v5/plugin/webrtc/pkg"
)
// ========== Protobuf 转换函数 ========== //
@@ -208,6 +210,8 @@ func (p *TestPlugin) StartPush(ctx context.Context, req *testpb.PushRequest) (re
pusher = rtsp.NewPusher
case "srt":
pusher = srt.NewPusher
case "whip":
pusher = webrtc.NewPusher
default:
return nil, fmt.Errorf("unsupport protocol %s", req.Protocol)
}
@@ -227,6 +231,10 @@ func (p *TestPlugin) StartPull(ctx context.Context, req *testpb.PullRequest) (re
puller = flv.NewPuller
case "mp4":
puller = mp4.NewPuller
case "whep":
puller = webrtc.NewPuller
case "hls":
puller = hls.NewPuller
default:
return nil, fmt.Errorf("unsupport protocol %s", req.Protocol)
}