mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-09-27 05:35:57 +08:00
feat: add mock scripts
This commit is contained in:
21
api.go
21
api.go
@@ -783,6 +783,27 @@ func (s *Server) RemoveDevice(ctx context.Context, req *pb.RequestWithId) (res *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) GetStreamAlias(ctx context.Context, req *emptypb.Empty) (res *pb.StreamAliasListResponse, err error) {
|
||||||
|
res = &pb.StreamAliasListResponse{}
|
||||||
|
s.Streams.Call(func() error {
|
||||||
|
for alias := range s.AliasStreams.Range {
|
||||||
|
info := &pb.StreamAlias{
|
||||||
|
StreamPath: alias.StreamPath,
|
||||||
|
Alias: alias.Alias,
|
||||||
|
AutoRemove: alias.AutoRemove,
|
||||||
|
}
|
||||||
|
if s.Streams.Has(alias.Alias) {
|
||||||
|
info.Status = 2
|
||||||
|
} else if alias.Publisher != nil {
|
||||||
|
info.Status = 1
|
||||||
|
}
|
||||||
|
res.Data = append(res.Data, info)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) SetStreamAlias(ctx context.Context, req *pb.SetStreamAliasRequest) (res *pb.SuccessResponse, err error) {
|
func (s *Server) SetStreamAlias(ctx context.Context, req *pb.SetStreamAliasRequest) (res *pb.SuccessResponse, err error) {
|
||||||
res = &pb.SuccessResponse{}
|
res = &pb.SuccessResponse{}
|
||||||
s.Streams.Call(func() error {
|
s.Streams.Call(func() error {
|
||||||
|
1800
pb/global.pb.go
1800
pb/global.pb.go
File diff suppressed because it is too large
Load Diff
@@ -930,6 +930,24 @@ func local_request_Api_ChangeSubscribe_0(ctx context.Context, marshaler runtime.
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func request_Api_GetStreamAlias_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
|
||||||
|
|
||||||
|
msg, err := client.GetStreamAlias(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_Api_GetStreamAlias_0(ctx context.Context, marshaler runtime.Marshaler, server ApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq emptypb.Empty
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
msg, err := server.GetStreamAlias(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func request_Api_SetStreamAlias_0(ctx context.Context, marshaler runtime.Marshaler, client ApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_Api_SetStreamAlias_0(ctx context.Context, marshaler runtime.Marshaler, client ApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq SetStreamAliasRequest
|
var protoReq SetStreamAliasRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@@ -1392,7 +1410,6 @@ func local_request_Api_GetRecording_0(ctx context.Context, marshaler runtime.Mar
|
|||||||
// UnaryRPC :call ApiServer directly.
|
// UnaryRPC :call ApiServer directly.
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
// 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.
|
// 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 {
|
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) {
|
mux.Handle("GET", pattern_Api_SysInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
@@ -1845,6 +1862,31 @@ func RegisterApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_Api_GetStreamAlias_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/GetStreamAlias", runtime.WithHTTPPathPattern("/api/stream/alias/list"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_Api_GetStreamAlias_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_GetStreamAlias_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
mux.Handle("POST", pattern_Api_SetStreamAlias_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle("POST", pattern_Api_SetStreamAlias_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -2126,21 +2168,21 @@ func RegisterApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
|
|||||||
// RegisterApiHandlerFromEndpoint is same as RegisterApiHandler but
|
// RegisterApiHandlerFromEndpoint is same as RegisterApiHandler but
|
||||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
// 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) {
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if cerr := conn.Close(); cerr != 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
|
return
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
if cerr := conn.Close(); cerr != 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)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}()
|
}()
|
||||||
@@ -2158,7 +2200,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".
|
// 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"
|
// 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
|
// 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 {
|
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) {
|
mux.Handle("GET", pattern_Api_SysInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
@@ -2557,6 +2599,28 @@ func RegisterApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_Api_GetStreamAlias_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/GetStreamAlias", runtime.WithHTTPPathPattern("/api/stream/alias/list"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_Api_GetStreamAlias_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_GetStreamAlias_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
mux.Handle("POST", pattern_Api_SetStreamAlias_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle("POST", pattern_Api_SetStreamAlias_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -2839,6 +2903,8 @@ var (
|
|||||||
|
|
||||||
pattern_Api_ChangeSubscribe_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 3, 0, 4, 1, 5, 4}, []string{"api", "subscribe", "change", "id", "streamPath"}, ""))
|
pattern_Api_ChangeSubscribe_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 3, 0, 4, 1, 5, 4}, []string{"api", "subscribe", "change", "id", "streamPath"}, ""))
|
||||||
|
|
||||||
|
pattern_Api_GetStreamAlias_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "stream", "alias", "list"}, ""))
|
||||||
|
|
||||||
pattern_Api_SetStreamAlias_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "stream", "alias"}, ""))
|
pattern_Api_SetStreamAlias_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "stream", "alias"}, ""))
|
||||||
|
|
||||||
pattern_Api_StopPublish_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 3, 0, 4, 1, 5, 3}, []string{"api", "stream", "stop", "streamPath"}, ""))
|
pattern_Api_StopPublish_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 3, 0, 4, 1, 5, 3}, []string{"api", "stream", "stop", "streamPath"}, ""))
|
||||||
@@ -2899,6 +2965,8 @@ var (
|
|||||||
|
|
||||||
forward_Api_ChangeSubscribe_0 = runtime.ForwardResponseMessage
|
forward_Api_ChangeSubscribe_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
|
forward_Api_GetStreamAlias_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
forward_Api_SetStreamAlias_0 = runtime.ForwardResponseMessage
|
forward_Api_SetStreamAlias_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
forward_Api_StopPublish_0 = runtime.ForwardResponseMessage
|
forward_Api_StopPublish_0 = runtime.ForwardResponseMessage
|
||||||
|
@@ -103,6 +103,11 @@ service api {
|
|||||||
body: "*"
|
body: "*"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
rpc GetStreamAlias (google.protobuf.Empty) returns (StreamAliasListResponse) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
get: "/api/stream/alias/list"
|
||||||
|
};
|
||||||
|
}
|
||||||
rpc SetStreamAlias (SetStreamAliasRequest) returns (SuccessResponse) {
|
rpc SetStreamAlias (SetStreamAliasRequest) returns (SuccessResponse) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
post: "/api/stream/alias"
|
post: "/api/stream/alias"
|
||||||
@@ -448,6 +453,19 @@ message SetStreamAliasRequest {
|
|||||||
bool autoRemove = 3;
|
bool autoRemove = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message StreamAlias {
|
||||||
|
string streamPath = 1;
|
||||||
|
string alias = 2;
|
||||||
|
bool autoRemove = 3;
|
||||||
|
uint32 status = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message StreamAliasListResponse {
|
||||||
|
int32 code = 1;
|
||||||
|
string message = 2;
|
||||||
|
repeated StreamAlias data = 3;
|
||||||
|
}
|
||||||
|
|
||||||
message SetStreamSpeedRequest {
|
message SetStreamSpeedRequest {
|
||||||
string streamPath = 1;
|
string streamPath = 1;
|
||||||
float speed = 2;
|
float speed = 2;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-grpc v1.5.1
|
// - protoc-gen-go-grpc v1.2.0
|
||||||
// - protoc v5.28.3
|
// - protoc v3.19.1
|
||||||
// source: global.proto
|
// source: global.proto
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
@@ -16,40 +16,8 @@ import (
|
|||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
// is compatible with the grpc package it is being compiled against.
|
// is compatible with the grpc package it is being compiled against.
|
||||||
// Requires gRPC-Go v1.64.0 or later.
|
// Requires gRPC-Go v1.32.0 or later.
|
||||||
const _ = grpc.SupportPackageIsVersion9
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
const (
|
|
||||||
Api_SysInfo_FullMethodName = "/global.api/SysInfo"
|
|
||||||
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_SetStreamAlias_FullMethodName = "/global.api/SetStreamAlias"
|
|
||||||
Api_StopPublish_FullMethodName = "/global.api/StopPublish"
|
|
||||||
Api_StopSubscribe_FullMethodName = "/global.api/StopSubscribe"
|
|
||||||
Api_GetConfig_FullMethodName = "/global.api/GetConfig"
|
|
||||||
Api_GetFormily_FullMethodName = "/global.api/GetFormily"
|
|
||||||
Api_ModifyConfig_FullMethodName = "/global.api/ModifyConfig"
|
|
||||||
Api_GetDeviceList_FullMethodName = "/global.api/GetDeviceList"
|
|
||||||
Api_AddDevice_FullMethodName = "/global.api/AddDevice"
|
|
||||||
Api_RemoveDevice_FullMethodName = "/global.api/RemoveDevice"
|
|
||||||
Api_UpdateDevice_FullMethodName = "/global.api/UpdateDevice"
|
|
||||||
Api_GetRecording_FullMethodName = "/global.api/GetRecording"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ApiClient is the client API for Api service.
|
// ApiClient is the client API for Api service.
|
||||||
//
|
//
|
||||||
@@ -73,6 +41,7 @@ type ApiClient interface {
|
|||||||
AudioTrackSnap(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*TrackSnapShotResponse, error)
|
AudioTrackSnap(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*TrackSnapShotResponse, error)
|
||||||
VideoTrackSnap(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*TrackSnapShotResponse, error)
|
VideoTrackSnap(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*TrackSnapShotResponse, error)
|
||||||
ChangeSubscribe(ctx context.Context, in *ChangeSubscribeRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
|
ChangeSubscribe(ctx context.Context, in *ChangeSubscribeRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||||
|
GetStreamAlias(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StreamAliasListResponse, error)
|
||||||
SetStreamAlias(ctx context.Context, in *SetStreamAliasRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
|
SetStreamAlias(ctx context.Context, in *SetStreamAliasRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||||
StopPublish(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
|
StopPublish(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||||
StopSubscribe(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error)
|
StopSubscribe(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||||
@@ -95,9 +64,8 @@ func NewApiClient(cc grpc.ClientConnInterface) ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) SysInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SysInfoResponse, error) {
|
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)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -105,9 +73,8 @@ func (c *apiClient) SysInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) Summary(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SummaryResponse, error) {
|
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)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -115,9 +82,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) {
|
func (c *apiClient) Shutdown(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -125,9 +91,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) {
|
func (c *apiClient) Restart(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -135,9 +100,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) {
|
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)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -145,9 +109,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) {
|
func (c *apiClient) StopTask(ctx context.Context, in *RequestWithId64, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -155,9 +118,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) {
|
func (c *apiClient) RestartTask(ctx context.Context, in *RequestWithId64, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -165,9 +127,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) {
|
func (c *apiClient) StreamList(ctx context.Context, in *StreamListRequest, opts ...grpc.CallOption) (*StreamListResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(StreamListResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -175,9 +136,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) {
|
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)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -185,9 +145,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) {
|
func (c *apiClient) StreamInfo(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*StreamInfoResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(StreamInfoResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -195,9 +154,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) {
|
func (c *apiClient) PauseStream(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -205,9 +163,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) {
|
func (c *apiClient) ResumeStream(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -215,9 +172,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) {
|
func (c *apiClient) SetStreamSpeed(ctx context.Context, in *SetStreamSpeedRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -225,9 +181,8 @@ func (c *apiClient) SetStreamSpeed(ctx context.Context, in *SetStreamSpeedReques
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) SeekStream(ctx context.Context, in *SeekStreamRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
func (c *apiClient) SeekStream(ctx context.Context, in *SeekStreamRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -235,9 +190,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) {
|
func (c *apiClient) GetSubscribers(ctx context.Context, in *SubscribersRequest, opts ...grpc.CallOption) (*SubscribersResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SubscribersResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -245,9 +199,8 @@ func (c *apiClient) GetSubscribers(ctx context.Context, in *SubscribersRequest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) AudioTrackSnap(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*TrackSnapShotResponse, error) {
|
func (c *apiClient) AudioTrackSnap(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*TrackSnapShotResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(TrackSnapShotResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -255,9 +208,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) {
|
func (c *apiClient) VideoTrackSnap(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*TrackSnapShotResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(TrackSnapShotResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -265,9 +217,17 @@ func (c *apiClient) VideoTrackSnap(ctx context.Context, in *StreamSnapRequest, o
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) ChangeSubscribe(ctx context.Context, in *ChangeSubscribeRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
func (c *apiClient) ChangeSubscribe(ctx context.Context, in *ChangeSubscribeRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *apiClient) GetStreamAlias(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StreamAliasListResponse, error) {
|
||||||
|
out := new(StreamAliasListResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/global.api/GetStreamAlias", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -275,9 +235,8 @@ func (c *apiClient) ChangeSubscribe(ctx context.Context, in *ChangeSubscribeRequ
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) SetStreamAlias(ctx context.Context, in *SetStreamAliasRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
func (c *apiClient) SetStreamAlias(ctx context.Context, in *SetStreamAliasRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -285,9 +244,8 @@ func (c *apiClient) SetStreamAlias(ctx context.Context, in *SetStreamAliasReques
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) StopPublish(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
func (c *apiClient) StopPublish(ctx context.Context, in *StreamSnapRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -295,9 +253,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) {
|
func (c *apiClient) StopSubscribe(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -305,9 +262,8 @@ func (c *apiClient) StopSubscribe(ctx context.Context, in *RequestWithId, opts .
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) GetConfig(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) {
|
func (c *apiClient) GetConfig(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(GetConfigResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -315,9 +271,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) {
|
func (c *apiClient) GetFormily(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(GetConfigResponse)
|
out := new(GetConfigResponse)
|
||||||
err := c.cc.Invoke(ctx, Api_GetFormily_FullMethodName, in, out, cOpts...)
|
err := c.cc.Invoke(ctx, "/global.api/GetFormily", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -325,9 +280,8 @@ func (c *apiClient) GetFormily(ctx context.Context, in *GetConfigRequest, opts .
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) ModifyConfig(ctx context.Context, in *ModifyConfigRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
func (c *apiClient) ModifyConfig(ctx context.Context, in *ModifyConfigRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
out := new(SuccessResponse)
|
||||||
err := c.cc.Invoke(ctx, Api_ModifyConfig_FullMethodName, in, out, cOpts...)
|
err := c.cc.Invoke(ctx, "/global.api/ModifyConfig", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -335,9 +289,8 @@ func (c *apiClient) ModifyConfig(ctx context.Context, in *ModifyConfigRequest, o
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) GetDeviceList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DeviceListResponse, error) {
|
func (c *apiClient) GetDeviceList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DeviceListResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(DeviceListResponse)
|
out := new(DeviceListResponse)
|
||||||
err := c.cc.Invoke(ctx, Api_GetDeviceList_FullMethodName, in, out, cOpts...)
|
err := c.cc.Invoke(ctx, "/global.api/GetDeviceList", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -345,9 +298,8 @@ func (c *apiClient) GetDeviceList(ctx context.Context, in *emptypb.Empty, opts .
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) AddDevice(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
func (c *apiClient) AddDevice(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
out := new(SuccessResponse)
|
||||||
err := c.cc.Invoke(ctx, Api_AddDevice_FullMethodName, in, out, cOpts...)
|
err := c.cc.Invoke(ctx, "/global.api/AddDevice", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -355,9 +307,8 @@ func (c *apiClient) AddDevice(ctx context.Context, in *DeviceInfo, opts ...grpc.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) RemoveDevice(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
func (c *apiClient) RemoveDevice(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
out := new(SuccessResponse)
|
||||||
err := c.cc.Invoke(ctx, Api_RemoveDevice_FullMethodName, in, out, cOpts...)
|
err := c.cc.Invoke(ctx, "/global.api/RemoveDevice", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -365,9 +316,8 @@ func (c *apiClient) RemoveDevice(ctx context.Context, in *RequestWithId, opts ..
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) UpdateDevice(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
func (c *apiClient) UpdateDevice(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(SuccessResponse)
|
out := new(SuccessResponse)
|
||||||
err := c.cc.Invoke(ctx, Api_UpdateDevice_FullMethodName, in, out, cOpts...)
|
err := c.cc.Invoke(ctx, "/global.api/UpdateDevice", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -375,9 +325,8 @@ func (c *apiClient) UpdateDevice(ctx context.Context, in *DeviceInfo, opts ...gr
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *apiClient) GetRecording(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*RecordingListResponse, error) {
|
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)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -386,7 +335,7 @@ func (c *apiClient) GetRecording(ctx context.Context, in *emptypb.Empty, opts ..
|
|||||||
|
|
||||||
// ApiServer is the server API for Api service.
|
// ApiServer is the server API for Api service.
|
||||||
// All implementations must embed UnimplementedApiServer
|
// All implementations must embed UnimplementedApiServer
|
||||||
// for forward compatibility.
|
// for forward compatibility
|
||||||
type ApiServer interface {
|
type ApiServer interface {
|
||||||
SysInfo(context.Context, *emptypb.Empty) (*SysInfoResponse, error)
|
SysInfo(context.Context, *emptypb.Empty) (*SysInfoResponse, error)
|
||||||
Summary(context.Context, *emptypb.Empty) (*SummaryResponse, error)
|
Summary(context.Context, *emptypb.Empty) (*SummaryResponse, error)
|
||||||
@@ -406,6 +355,7 @@ type ApiServer interface {
|
|||||||
AudioTrackSnap(context.Context, *StreamSnapRequest) (*TrackSnapShotResponse, error)
|
AudioTrackSnap(context.Context, *StreamSnapRequest) (*TrackSnapShotResponse, error)
|
||||||
VideoTrackSnap(context.Context, *StreamSnapRequest) (*TrackSnapShotResponse, error)
|
VideoTrackSnap(context.Context, *StreamSnapRequest) (*TrackSnapShotResponse, error)
|
||||||
ChangeSubscribe(context.Context, *ChangeSubscribeRequest) (*SuccessResponse, error)
|
ChangeSubscribe(context.Context, *ChangeSubscribeRequest) (*SuccessResponse, error)
|
||||||
|
GetStreamAlias(context.Context, *emptypb.Empty) (*StreamAliasListResponse, error)
|
||||||
SetStreamAlias(context.Context, *SetStreamAliasRequest) (*SuccessResponse, error)
|
SetStreamAlias(context.Context, *SetStreamAliasRequest) (*SuccessResponse, error)
|
||||||
StopPublish(context.Context, *StreamSnapRequest) (*SuccessResponse, error)
|
StopPublish(context.Context, *StreamSnapRequest) (*SuccessResponse, error)
|
||||||
StopSubscribe(context.Context, *RequestWithId) (*SuccessResponse, error)
|
StopSubscribe(context.Context, *RequestWithId) (*SuccessResponse, error)
|
||||||
@@ -420,12 +370,9 @@ type ApiServer interface {
|
|||||||
mustEmbedUnimplementedApiServer()
|
mustEmbedUnimplementedApiServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedApiServer must be embedded to have
|
// UnimplementedApiServer must be embedded to have forward compatible implementations.
|
||||||
// forward compatible implementations.
|
type UnimplementedApiServer struct {
|
||||||
//
|
}
|
||||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
||||||
// pointer dereference when methods are called.
|
|
||||||
type UnimplementedApiServer struct{}
|
|
||||||
|
|
||||||
func (UnimplementedApiServer) SysInfo(context.Context, *emptypb.Empty) (*SysInfoResponse, error) {
|
func (UnimplementedApiServer) SysInfo(context.Context, *emptypb.Empty) (*SysInfoResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method SysInfo not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method SysInfo not implemented")
|
||||||
@@ -481,6 +428,9 @@ func (UnimplementedApiServer) VideoTrackSnap(context.Context, *StreamSnapRequest
|
|||||||
func (UnimplementedApiServer) ChangeSubscribe(context.Context, *ChangeSubscribeRequest) (*SuccessResponse, error) {
|
func (UnimplementedApiServer) ChangeSubscribe(context.Context, *ChangeSubscribeRequest) (*SuccessResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ChangeSubscribe not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method ChangeSubscribe not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedApiServer) GetStreamAlias(context.Context, *emptypb.Empty) (*StreamAliasListResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetStreamAlias not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedApiServer) SetStreamAlias(context.Context, *SetStreamAliasRequest) (*SuccessResponse, error) {
|
func (UnimplementedApiServer) SetStreamAlias(context.Context, *SetStreamAliasRequest) (*SuccessResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method SetStreamAlias not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method SetStreamAlias not implemented")
|
||||||
}
|
}
|
||||||
@@ -515,7 +465,6 @@ func (UnimplementedApiServer) GetRecording(context.Context, *emptypb.Empty) (*Re
|
|||||||
return nil, status.Errorf(codes.Unimplemented, "method GetRecording not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetRecording not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedApiServer) mustEmbedUnimplementedApiServer() {}
|
func (UnimplementedApiServer) mustEmbedUnimplementedApiServer() {}
|
||||||
func (UnimplementedApiServer) testEmbeddedByValue() {}
|
|
||||||
|
|
||||||
// UnsafeApiServer may be embedded to opt out of forward compatibility for this service.
|
// 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
|
// Use of this interface is not recommended, as added methods to ApiServer will
|
||||||
@@ -525,13 +474,6 @@ type UnsafeApiServer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func RegisterApiServer(s grpc.ServiceRegistrar, srv ApiServer) {
|
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)
|
s.RegisterService(&Api_ServiceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,7 +487,7 @@ func _Api_SysInfo_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_SysInfo_FullMethodName,
|
FullMethod: "/global.api/SysInfo",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).SysInfo(ctx, req.(*emptypb.Empty))
|
return srv.(ApiServer).SysInfo(ctx, req.(*emptypb.Empty))
|
||||||
@@ -563,7 +505,7 @@ func _Api_Summary_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_Summary_FullMethodName,
|
FullMethod: "/global.api/Summary",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).Summary(ctx, req.(*emptypb.Empty))
|
return srv.(ApiServer).Summary(ctx, req.(*emptypb.Empty))
|
||||||
@@ -581,7 +523,7 @@ func _Api_Shutdown_Handler(srv interface{}, ctx context.Context, dec func(interf
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_Shutdown_FullMethodName,
|
FullMethod: "/global.api/Shutdown",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).Shutdown(ctx, req.(*RequestWithId))
|
return srv.(ApiServer).Shutdown(ctx, req.(*RequestWithId))
|
||||||
@@ -599,7 +541,7 @@ func _Api_Restart_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_Restart_FullMethodName,
|
FullMethod: "/global.api/Restart",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).Restart(ctx, req.(*RequestWithId))
|
return srv.(ApiServer).Restart(ctx, req.(*RequestWithId))
|
||||||
@@ -617,7 +559,7 @@ func _Api_TaskTree_Handler(srv interface{}, ctx context.Context, dec func(interf
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_TaskTree_FullMethodName,
|
FullMethod: "/global.api/TaskTree",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).TaskTree(ctx, req.(*emptypb.Empty))
|
return srv.(ApiServer).TaskTree(ctx, req.(*emptypb.Empty))
|
||||||
@@ -635,7 +577,7 @@ func _Api_StopTask_Handler(srv interface{}, ctx context.Context, dec func(interf
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_StopTask_FullMethodName,
|
FullMethod: "/global.api/StopTask",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).StopTask(ctx, req.(*RequestWithId64))
|
return srv.(ApiServer).StopTask(ctx, req.(*RequestWithId64))
|
||||||
@@ -653,7 +595,7 @@ func _Api_RestartTask_Handler(srv interface{}, ctx context.Context, dec func(int
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_RestartTask_FullMethodName,
|
FullMethod: "/global.api/RestartTask",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).RestartTask(ctx, req.(*RequestWithId64))
|
return srv.(ApiServer).RestartTask(ctx, req.(*RequestWithId64))
|
||||||
@@ -671,7 +613,7 @@ func _Api_StreamList_Handler(srv interface{}, ctx context.Context, dec func(inte
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_StreamList_FullMethodName,
|
FullMethod: "/global.api/StreamList",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).StreamList(ctx, req.(*StreamListRequest))
|
return srv.(ApiServer).StreamList(ctx, req.(*StreamListRequest))
|
||||||
@@ -689,7 +631,7 @@ func _Api_WaitList_Handler(srv interface{}, ctx context.Context, dec func(interf
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_WaitList_FullMethodName,
|
FullMethod: "/global.api/WaitList",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).WaitList(ctx, req.(*emptypb.Empty))
|
return srv.(ApiServer).WaitList(ctx, req.(*emptypb.Empty))
|
||||||
@@ -707,7 +649,7 @@ func _Api_StreamInfo_Handler(srv interface{}, ctx context.Context, dec func(inte
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_StreamInfo_FullMethodName,
|
FullMethod: "/global.api/StreamInfo",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).StreamInfo(ctx, req.(*StreamSnapRequest))
|
return srv.(ApiServer).StreamInfo(ctx, req.(*StreamSnapRequest))
|
||||||
@@ -725,7 +667,7 @@ func _Api_PauseStream_Handler(srv interface{}, ctx context.Context, dec func(int
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_PauseStream_FullMethodName,
|
FullMethod: "/global.api/PauseStream",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).PauseStream(ctx, req.(*StreamSnapRequest))
|
return srv.(ApiServer).PauseStream(ctx, req.(*StreamSnapRequest))
|
||||||
@@ -743,7 +685,7 @@ func _Api_ResumeStream_Handler(srv interface{}, ctx context.Context, dec func(in
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_ResumeStream_FullMethodName,
|
FullMethod: "/global.api/ResumeStream",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).ResumeStream(ctx, req.(*StreamSnapRequest))
|
return srv.(ApiServer).ResumeStream(ctx, req.(*StreamSnapRequest))
|
||||||
@@ -761,7 +703,7 @@ func _Api_SetStreamSpeed_Handler(srv interface{}, ctx context.Context, dec func(
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_SetStreamSpeed_FullMethodName,
|
FullMethod: "/global.api/SetStreamSpeed",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).SetStreamSpeed(ctx, req.(*SetStreamSpeedRequest))
|
return srv.(ApiServer).SetStreamSpeed(ctx, req.(*SetStreamSpeedRequest))
|
||||||
@@ -779,7 +721,7 @@ func _Api_SeekStream_Handler(srv interface{}, ctx context.Context, dec func(inte
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_SeekStream_FullMethodName,
|
FullMethod: "/global.api/SeekStream",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).SeekStream(ctx, req.(*SeekStreamRequest))
|
return srv.(ApiServer).SeekStream(ctx, req.(*SeekStreamRequest))
|
||||||
@@ -797,7 +739,7 @@ func _Api_GetSubscribers_Handler(srv interface{}, ctx context.Context, dec func(
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_GetSubscribers_FullMethodName,
|
FullMethod: "/global.api/GetSubscribers",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).GetSubscribers(ctx, req.(*SubscribersRequest))
|
return srv.(ApiServer).GetSubscribers(ctx, req.(*SubscribersRequest))
|
||||||
@@ -815,7 +757,7 @@ func _Api_AudioTrackSnap_Handler(srv interface{}, ctx context.Context, dec func(
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_AudioTrackSnap_FullMethodName,
|
FullMethod: "/global.api/AudioTrackSnap",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).AudioTrackSnap(ctx, req.(*StreamSnapRequest))
|
return srv.(ApiServer).AudioTrackSnap(ctx, req.(*StreamSnapRequest))
|
||||||
@@ -833,7 +775,7 @@ func _Api_VideoTrackSnap_Handler(srv interface{}, ctx context.Context, dec func(
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_VideoTrackSnap_FullMethodName,
|
FullMethod: "/global.api/VideoTrackSnap",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).VideoTrackSnap(ctx, req.(*StreamSnapRequest))
|
return srv.(ApiServer).VideoTrackSnap(ctx, req.(*StreamSnapRequest))
|
||||||
@@ -851,7 +793,7 @@ func _Api_ChangeSubscribe_Handler(srv interface{}, ctx context.Context, dec func
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_ChangeSubscribe_FullMethodName,
|
FullMethod: "/global.api/ChangeSubscribe",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).ChangeSubscribe(ctx, req.(*ChangeSubscribeRequest))
|
return srv.(ApiServer).ChangeSubscribe(ctx, req.(*ChangeSubscribeRequest))
|
||||||
@@ -859,6 +801,24 @@ func _Api_ChangeSubscribe_Handler(srv interface{}, ctx context.Context, dec func
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Api_GetStreamAlias_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 {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(ApiServer).GetStreamAlias(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/global.api/GetStreamAlias",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(ApiServer).GetStreamAlias(ctx, req.(*emptypb.Empty))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _Api_SetStreamAlias_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _Api_SetStreamAlias_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(SetStreamAliasRequest)
|
in := new(SetStreamAliasRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@@ -869,7 +829,7 @@ func _Api_SetStreamAlias_Handler(srv interface{}, ctx context.Context, dec func(
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_SetStreamAlias_FullMethodName,
|
FullMethod: "/global.api/SetStreamAlias",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).SetStreamAlias(ctx, req.(*SetStreamAliasRequest))
|
return srv.(ApiServer).SetStreamAlias(ctx, req.(*SetStreamAliasRequest))
|
||||||
@@ -887,7 +847,7 @@ func _Api_StopPublish_Handler(srv interface{}, ctx context.Context, dec func(int
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_StopPublish_FullMethodName,
|
FullMethod: "/global.api/StopPublish",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).StopPublish(ctx, req.(*StreamSnapRequest))
|
return srv.(ApiServer).StopPublish(ctx, req.(*StreamSnapRequest))
|
||||||
@@ -905,7 +865,7 @@ func _Api_StopSubscribe_Handler(srv interface{}, ctx context.Context, dec func(i
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_StopSubscribe_FullMethodName,
|
FullMethod: "/global.api/StopSubscribe",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).StopSubscribe(ctx, req.(*RequestWithId))
|
return srv.(ApiServer).StopSubscribe(ctx, req.(*RequestWithId))
|
||||||
@@ -923,7 +883,7 @@ func _Api_GetConfig_Handler(srv interface{}, ctx context.Context, dec func(inter
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_GetConfig_FullMethodName,
|
FullMethod: "/global.api/GetConfig",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).GetConfig(ctx, req.(*GetConfigRequest))
|
return srv.(ApiServer).GetConfig(ctx, req.(*GetConfigRequest))
|
||||||
@@ -941,7 +901,7 @@ func _Api_GetFormily_Handler(srv interface{}, ctx context.Context, dec func(inte
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_GetFormily_FullMethodName,
|
FullMethod: "/global.api/GetFormily",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).GetFormily(ctx, req.(*GetConfigRequest))
|
return srv.(ApiServer).GetFormily(ctx, req.(*GetConfigRequest))
|
||||||
@@ -959,7 +919,7 @@ func _Api_ModifyConfig_Handler(srv interface{}, ctx context.Context, dec func(in
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_ModifyConfig_FullMethodName,
|
FullMethod: "/global.api/ModifyConfig",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).ModifyConfig(ctx, req.(*ModifyConfigRequest))
|
return srv.(ApiServer).ModifyConfig(ctx, req.(*ModifyConfigRequest))
|
||||||
@@ -977,7 +937,7 @@ func _Api_GetDeviceList_Handler(srv interface{}, ctx context.Context, dec func(i
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_GetDeviceList_FullMethodName,
|
FullMethod: "/global.api/GetDeviceList",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).GetDeviceList(ctx, req.(*emptypb.Empty))
|
return srv.(ApiServer).GetDeviceList(ctx, req.(*emptypb.Empty))
|
||||||
@@ -995,7 +955,7 @@ func _Api_AddDevice_Handler(srv interface{}, ctx context.Context, dec func(inter
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_AddDevice_FullMethodName,
|
FullMethod: "/global.api/AddDevice",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).AddDevice(ctx, req.(*DeviceInfo))
|
return srv.(ApiServer).AddDevice(ctx, req.(*DeviceInfo))
|
||||||
@@ -1013,7 +973,7 @@ func _Api_RemoveDevice_Handler(srv interface{}, ctx context.Context, dec func(in
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_RemoveDevice_FullMethodName,
|
FullMethod: "/global.api/RemoveDevice",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).RemoveDevice(ctx, req.(*RequestWithId))
|
return srv.(ApiServer).RemoveDevice(ctx, req.(*RequestWithId))
|
||||||
@@ -1031,7 +991,7 @@ func _Api_UpdateDevice_Handler(srv interface{}, ctx context.Context, dec func(in
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_UpdateDevice_FullMethodName,
|
FullMethod: "/global.api/UpdateDevice",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).UpdateDevice(ctx, req.(*DeviceInfo))
|
return srv.(ApiServer).UpdateDevice(ctx, req.(*DeviceInfo))
|
||||||
@@ -1049,7 +1009,7 @@ func _Api_GetRecording_Handler(srv interface{}, ctx context.Context, dec func(in
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: Api_GetRecording_FullMethodName,
|
FullMethod: "/global.api/GetRecording",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(ApiServer).GetRecording(ctx, req.(*emptypb.Empty))
|
return srv.(ApiServer).GetRecording(ctx, req.(*emptypb.Empty))
|
||||||
@@ -1136,6 +1096,10 @@ var Api_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "ChangeSubscribe",
|
MethodName: "ChangeSubscribe",
|
||||||
Handler: _Api_ChangeSubscribe_Handler,
|
Handler: _Api_ChangeSubscribe_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetStreamAlias",
|
||||||
|
Handler: _Api_GetStreamAlias_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "SetStreamAlias",
|
MethodName: "SetStreamAlias",
|
||||||
Handler: _Api_SetStreamAlias_Handler,
|
Handler: _Api_SetStreamAlias_Handler,
|
||||||
|
@@ -24,7 +24,7 @@ func (h *LogRotatePlugin) List(context.Context, *emptypb.Empty) (*pb.ResponseFil
|
|||||||
Name: info.Name(), Size: info.Size(),
|
Name: info.Name(), Size: info.Size(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return &pb.ResponseFileInfo{Files: fileInfos}, nil
|
return &pb.ResponseFileInfo{Data: fileInfos}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -37,7 +37,7 @@ func (h *LogRotatePlugin) Get(_ context.Context, req *pb.RequestFileInfo) (res *
|
|||||||
res = &pb.ResponseOpen{}
|
res = &pb.ResponseOpen{}
|
||||||
content, err2 := io.ReadAll(file)
|
content, err2 := io.ReadAll(file)
|
||||||
if err2 == nil {
|
if err2 == nil {
|
||||||
res.Content = string(content)
|
res.Data = string(content)
|
||||||
} else {
|
} else {
|
||||||
err = err2
|
err = err2
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,9 @@ type ResponseOpen struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
|
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
|
||||||
|
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||||
|
Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ResponseOpen) Reset() {
|
func (x *ResponseOpen) Reset() {
|
||||||
@@ -62,9 +64,23 @@ func (*ResponseOpen) Descriptor() ([]byte, []int) {
|
|||||||
return file_logrotate_proto_rawDescGZIP(), []int{0}
|
return file_logrotate_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ResponseOpen) GetContent() string {
|
func (x *ResponseOpen) GetCode() int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Content
|
return x.Code
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ResponseOpen) GetMessage() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Message
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ResponseOpen) GetData() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Data
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -121,7 +137,9 @@ type ResponseFileInfo struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Files []*FileInfo `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
|
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
|
||||||
|
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||||
|
Data []*FileInfo `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ResponseFileInfo) Reset() {
|
func (x *ResponseFileInfo) Reset() {
|
||||||
@@ -156,9 +174,23 @@ func (*ResponseFileInfo) Descriptor() ([]byte, []int) {
|
|||||||
return file_logrotate_proto_rawDescGZIP(), []int{2}
|
return file_logrotate_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ResponseFileInfo) GetFiles() []*FileInfo {
|
func (x *ResponseFileInfo) GetCode() int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Files
|
return x.Code
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ResponseFileInfo) GetMessage() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Message
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ResponseFileInfo) GetData() []*FileInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.Data
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -226,33 +258,38 @@ var file_logrotate_proto_rawDesc = []byte{
|
|||||||
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74,
|
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74,
|
||||||
0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67,
|
0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67,
|
||||||
0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74,
|
0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74,
|
||||||
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x28, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x50, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
0x6e, 0x73, 0x65, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65,
|
0x6e, 0x73, 0x65, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
|
||||||
0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
|
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d,
|
||||||
0x74, 0x22, 0x2d, 0x0a, 0x0f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65,
|
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65,
|
||||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65,
|
0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65,
|
0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2d, 0x0a, 0x0f, 0x52, 0x65, 0x71,
|
||||||
0x22, 0x3d, 0x0a, 0x10, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x46, 0x69, 0x6c, 0x65,
|
0x75, 0x65, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08,
|
||||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x29, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20,
|
0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||||
0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6c, 0x6f, 0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x2e,
|
0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x69, 0x0a, 0x10, 0x52, 0x65, 0x73, 0x70,
|
||||||
0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22,
|
0x6f, 0x6e, 0x73, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04,
|
||||||
0x32, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65,
|
||||||
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73,
|
0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x27, 0x0a, 0x04, 0x64, 0x61,
|
||||||
0x69, 0x7a, 0x65, 0x32, 0xc5, 0x01, 0x0a, 0x03, 0x61, 0x70, 0x69, 0x12, 0x58, 0x0a, 0x04, 0x4c,
|
0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6c, 0x6f, 0x67, 0x72, 0x6f,
|
||||||
0x69, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
0x74, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64,
|
||||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f,
|
0x61, 0x74, 0x61, 0x22, 0x32, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12,
|
||||||
0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
|
||||||
0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15,
|
0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x12, 0x13, 0x2f, 0x6c, 0x6f, 0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69,
|
0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x32, 0xc5, 0x01, 0x0a, 0x03, 0x61, 0x70, 0x69, 0x12,
|
||||||
0x2f, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x64, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1a, 0x2e, 0x6c,
|
0x58, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||||
0x6f, 0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a,
|
||||||
0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x67, 0x72, 0x6f,
|
0x1b, 0x2e, 0x6c, 0x6f, 0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70,
|
||||||
0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x70, 0x65,
|
0x6f, 0x6e, 0x73, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x1b, 0x82, 0xd3,
|
||||||
0x6e, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x6c, 0x6f, 0x67, 0x72,
|
0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x6c, 0x6f, 0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65,
|
||||||
0x6f, 0x74, 0x61, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x74, 0x2f, 0x7b, 0x66,
|
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x64, 0x0a, 0x03, 0x47, 0x65, 0x74,
|
||||||
0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x3d, 0x2a, 0x2a, 0x7d, 0x42, 0x25, 0x5a, 0x23, 0x6d,
|
0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71,
|
||||||
0x37, 0x73, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x2f, 0x6d, 0x37, 0x73, 0x2f, 0x76, 0x35, 0x2f, 0x70,
|
0x75, 0x65, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x17, 0x2e, 0x6c,
|
||||||
|
0x6f, 0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
|
0x65, 0x4f, 0x70, 0x65, 0x6e, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f,
|
||||||
|
0x6c, 0x6f, 0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65,
|
||||||
|
0x74, 0x2f, 0x7b, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x3d, 0x2a, 0x2a, 0x7d, 0x42,
|
||||||
|
0x21, 0x5a, 0x1f, 0x6d, 0x37, 0x73, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x2f, 0x76, 0x35, 0x2f, 0x70,
|
||||||
0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x6c, 0x6f, 0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x2f,
|
0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x6c, 0x6f, 0x67, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x2f,
|
||||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
@@ -278,7 +315,7 @@ var file_logrotate_proto_goTypes = []interface{}{
|
|||||||
(*emptypb.Empty)(nil), // 4: google.protobuf.Empty
|
(*emptypb.Empty)(nil), // 4: google.protobuf.Empty
|
||||||
}
|
}
|
||||||
var file_logrotate_proto_depIdxs = []int32{
|
var file_logrotate_proto_depIdxs = []int32{
|
||||||
3, // 0: logrotate.ResponseFileInfo.files:type_name -> logrotate.FileInfo
|
3, // 0: logrotate.ResponseFileInfo.data:type_name -> logrotate.FileInfo
|
||||||
4, // 1: logrotate.api.List:input_type -> google.protobuf.Empty
|
4, // 1: logrotate.api.List:input_type -> google.protobuf.Empty
|
||||||
1, // 2: logrotate.api.Get:input_type -> logrotate.RequestFileInfo
|
1, // 2: logrotate.api.Get:input_type -> logrotate.RequestFileInfo
|
||||||
2, // 3: logrotate.api.List:output_type -> logrotate.ResponseFileInfo
|
2, // 3: logrotate.api.List:output_type -> logrotate.ResponseFileInfo
|
||||||
|
@@ -18,7 +18,9 @@ service api {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message ResponseOpen {
|
message ResponseOpen {
|
||||||
string content = 1;
|
int32 code = 1;
|
||||||
|
string message = 2;
|
||||||
|
string data = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message RequestFileInfo {
|
message RequestFileInfo {
|
||||||
@@ -26,7 +28,9 @@ message RequestFileInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message ResponseFileInfo {
|
message ResponseFileInfo {
|
||||||
repeated FileInfo files = 1;
|
int32 code = 1;
|
||||||
|
string message = 2;
|
||||||
|
repeated FileInfo data = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message FileInfo {
|
message FileInfo {
|
||||||
|
274
plugin/rtsp/pkg/connection_test.go
Normal file
274
plugin/rtsp/pkg/connection_test.go
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
package rtsp
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log/slog"
|
||||||
|
"net"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/pion/rtcp"
|
||||||
|
"github.com/pion/rtp"
|
||||||
|
"github.com/pion/webrtc/v3"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
"m7s.live/v5/pkg"
|
||||||
|
"m7s.live/v5/pkg/config"
|
||||||
|
"m7s.live/v5/pkg/util"
|
||||||
|
mrtp "m7s.live/v5/plugin/rtp/pkg"
|
||||||
|
)
|
||||||
|
|
||||||
|
func parseRTSPDump(filename string) ([]Packet, error) {
|
||||||
|
data, err := os.ReadFile(filename)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var dump struct {
|
||||||
|
Packets []struct {
|
||||||
|
Packet int `yaml:"packet"`
|
||||||
|
Peer int `yaml:"peer"`
|
||||||
|
Index int `yaml:"index"`
|
||||||
|
Timestamp float64 `yaml:"timestamp"`
|
||||||
|
Data string `yaml:"data"`
|
||||||
|
} `yaml:"packets"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err = yaml.Unmarshal(data, &dump)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
packets := make([]Packet, 0, len(dump.Packets))
|
||||||
|
for _, p := range dump.Packets {
|
||||||
|
packets = append(packets, Packet{
|
||||||
|
Index: p.Index,
|
||||||
|
Peer: p.Peer,
|
||||||
|
Timestamp: p.Timestamp,
|
||||||
|
Data: []byte(p.Data),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return packets, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type RTSPMockConn struct {
|
||||||
|
packets []Packet
|
||||||
|
currentIndex int
|
||||||
|
peer int
|
||||||
|
readDeadline time.Time
|
||||||
|
closed bool
|
||||||
|
localAddr net.Addr
|
||||||
|
remoteAddr net.Addr
|
||||||
|
}
|
||||||
|
|
||||||
|
type Packet struct {
|
||||||
|
Index int
|
||||||
|
Timestamp float64
|
||||||
|
Peer int
|
||||||
|
Data []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRTSPMockConn(dumpFile string, peer int) (*RTSPMockConn, error) {
|
||||||
|
// Parse YAML dump file and extract packets
|
||||||
|
packets, err := parseRTSPDump(dumpFile)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &RTSPMockConn{
|
||||||
|
packets: packets,
|
||||||
|
currentIndex: 0,
|
||||||
|
peer: peer,
|
||||||
|
localAddr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 8554},
|
||||||
|
remoteAddr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 49152},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read implements net.Conn interface
|
||||||
|
func (c *RTSPMockConn) Read(b []byte) (n int, err error) {
|
||||||
|
if c.closed {
|
||||||
|
return 0, io.EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.currentIndex >= len(c.packets) {
|
||||||
|
return 0, io.EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check read deadline
|
||||||
|
if !c.readDeadline.IsZero() && time.Now().After(c.readDeadline) {
|
||||||
|
return 0, os.ErrDeadlineExceeded
|
||||||
|
}
|
||||||
|
packet := c.packets[c.currentIndex]
|
||||||
|
for packet.Peer != c.peer {
|
||||||
|
c.currentIndex++
|
||||||
|
packet = c.packets[c.currentIndex]
|
||||||
|
}
|
||||||
|
|
||||||
|
n = copy(b, packet.Data)
|
||||||
|
if n == len(packet.Data) {
|
||||||
|
c.currentIndex++
|
||||||
|
} else {
|
||||||
|
packet.Data = packet.Data[n:]
|
||||||
|
}
|
||||||
|
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write implements net.Conn interface - just discard data
|
||||||
|
func (c *RTSPMockConn) Write(b []byte) (n int, err error) {
|
||||||
|
if c.closed {
|
||||||
|
return 0, io.ErrClosedPipe
|
||||||
|
}
|
||||||
|
return len(b), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close implements net.Conn interface
|
||||||
|
func (c *RTSPMockConn) Close() error {
|
||||||
|
c.closed = true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// LocalAddr implements net.Conn interface
|
||||||
|
func (c *RTSPMockConn) LocalAddr() net.Addr {
|
||||||
|
return c.localAddr
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoteAddr implements net.Conn interface
|
||||||
|
func (c *RTSPMockConn) RemoteAddr() net.Addr {
|
||||||
|
return c.remoteAddr
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDeadline implements net.Conn interface
|
||||||
|
func (c *RTSPMockConn) SetDeadline(t time.Time) error {
|
||||||
|
c.readDeadline = t
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetReadDeadline implements net.Conn interface
|
||||||
|
func (c *RTSPMockConn) SetReadDeadline(t time.Time) error {
|
||||||
|
c.readDeadline = t
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetWriteDeadline implements net.Conn interface
|
||||||
|
func (c *RTSPMockConn) SetWriteDeadline(t time.Time) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNetConnection_Receive(t *testing.T) {
|
||||||
|
conn, err := NewRTSPMockConn("/Users/dexter/project/v5/monibuca/example/default/dump/rtsp",0)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
allocator := util.NewScalableMemoryAllocator(1 << 12)
|
||||||
|
audioFrame, videoFrame := &mrtp.Audio{}, &mrtp.Video{}
|
||||||
|
audioFrame.RTPCodecParameters = &webrtc.RTPCodecParameters{
|
||||||
|
RTPCodecCapability: webrtc.RTPCodecCapability{
|
||||||
|
MimeType: "audio/MPEG4-GENERIC",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
audioFrame.SetAllocator(allocator)
|
||||||
|
videoFrame.RTPCodecParameters = &webrtc.RTPCodecParameters{
|
||||||
|
RTPCodecCapability: webrtc.RTPCodecCapability{
|
||||||
|
MimeType: webrtc.MimeTypeH264,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
videoFrame.SetAllocator(allocator)
|
||||||
|
c := NewNetConnection(conn)
|
||||||
|
c.Logger = slog.New(slog.NewTextHandler(os.Stdout, nil))
|
||||||
|
c.Context, c.CancelCauseFunc = context.WithCancelCause(context.Background())
|
||||||
|
var videoTrack *pkg.AVTrack
|
||||||
|
videoTrack = pkg.NewAVTrack(&mrtp.Video{}, c.Logger.With("track", "video"), &config.Publish{
|
||||||
|
RingSize: util.Range[int]{20, 1024},
|
||||||
|
}, util.NewPromise(context.Background()))
|
||||||
|
videoTrack.ICodecCtx = &mrtp.H264Ctx{}
|
||||||
|
if err := c.Receive(false, func(channelID byte, buf []byte) error {
|
||||||
|
switch int(channelID) {
|
||||||
|
case 2:
|
||||||
|
packet := &rtp.Packet{}
|
||||||
|
if err = packet.Unmarshal(buf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(audioFrame.Packets) == 0 || packet.Timestamp == audioFrame.Packets[0].Timestamp {
|
||||||
|
audioFrame.AddRecycleBytes(buf)
|
||||||
|
audioFrame.Packets = append(audioFrame.Packets, packet)
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
// if err = r.WriteAudio(audioFrame); err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
audioFrame = &mrtp.Audio{}
|
||||||
|
audioFrame.AddRecycleBytes(buf)
|
||||||
|
audioFrame.Packets = []*rtp.Packet{packet}
|
||||||
|
// audioFrame.RTPCodecParameters = c.AudioCodecParameters
|
||||||
|
audioFrame.SetAllocator(allocator)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
case 0:
|
||||||
|
packet := &rtp.Packet{}
|
||||||
|
if err = packet.Unmarshal(buf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(videoFrame.Packets) == 0 || packet.Timestamp == videoFrame.Packets[0].Timestamp {
|
||||||
|
videoFrame.AddRecycleBytes(buf)
|
||||||
|
videoFrame.Packets = append(videoFrame.Packets, packet)
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
videoFrame.Parse(videoTrack)
|
||||||
|
// t := time.Now()
|
||||||
|
// if err = r.WriteVideo(videoFrame); err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
fmt.Println("write video", videoTrack.Value.Raw)
|
||||||
|
videoFrame = &mrtp.Video{}
|
||||||
|
videoFrame.RTPCodecParameters = &webrtc.RTPCodecParameters{
|
||||||
|
RTPCodecCapability: webrtc.RTPCodecCapability{
|
||||||
|
MimeType: webrtc.MimeTypeH264,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
videoFrame.AddRecycleBytes(buf)
|
||||||
|
videoFrame.Packets = []*rtp.Packet{packet}
|
||||||
|
// videoFrame.RTPCodecParameters = c.VideoCodecParameters
|
||||||
|
videoFrame.SetAllocator(allocator)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
|
||||||
|
}
|
||||||
|
return pkg.ErrUnsupportCodec
|
||||||
|
}, func(channelID byte, buf []byte) error {
|
||||||
|
msg := &RTCP{Channel: channelID}
|
||||||
|
if err = msg.Header.Unmarshal(buf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if msg.Packets, err = rtcp.Unmarshal(buf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// r.Stream.Debug("rtcp", "type", msg.Header.Type, "length", msg.Header.Length)
|
||||||
|
// TODO: rtcp msg
|
||||||
|
return pkg.ErrDiscard
|
||||||
|
}); err != nil {
|
||||||
|
t.Errorf("NetConnection.Receive() error = %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNetConnection_Pull(t *testing.T) {
|
||||||
|
conn, err := NewRTSPMockConn("/Users/dexter/project/v5/monibuca/example/default/dump/rtsp", 1)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
client := NewPuller(config.Pull{
|
||||||
|
URL: "rtsp://127.0.0.1:8554/dump/test",
|
||||||
|
}).(*Client)
|
||||||
|
client.NetConnection = &NetConnection{Conn: conn}
|
||||||
|
client.BufReader = util.NewBufReader(conn)
|
||||||
|
client.URL, _ = url.Parse("rtsp://127.0.0.1:8554/dump/test")
|
||||||
|
client.MemoryAllocator = util.NewScalableMemoryAllocator(1 << 12)
|
||||||
|
client.Logger = slog.New(slog.NewTextHandler(os.Stdout, nil))
|
||||||
|
client.Context, client.CancelCauseFunc = context.WithCancelCause(context.Background())
|
||||||
|
client.Run()
|
||||||
|
}
|
@@ -6,4 +6,22 @@
|
|||||||
# use protoc_global to genertate the go code form the proto.file
|
# use protoc_global to genertate the go code form the proto.file
|
||||||
|
|
||||||
1. cd to the root
|
1. cd to the root
|
||||||
2. sh scripts/protoc_global.sh
|
2. sh scripts/protoc_global.sh
|
||||||
|
|
||||||
|
|
||||||
|
# use loop.py to loop the ffmpeg command
|
||||||
|
|
||||||
|
1. python scripts/loop.py
|
||||||
|
|
||||||
|
# use mock.py to mock the tcp server
|
||||||
|
|
||||||
|
使用方法:
|
||||||
|
1. 作为服务器运行 (监听端口 8554 并发送 peer 1 的数据):
|
||||||
|
```bash
|
||||||
|
python scripts/mock.py dump.rtsp 1 -l 8554
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 作为客户端运行 (连接到 192.168.1.100:554 并发送 peer 0 的数据):
|
||||||
|
```bash
|
||||||
|
python scripts/mock.py dump.rtsp 0 -c 192.168.1.100:554
|
||||||
|
```
|
||||||
|
101
scripts/mock.py
Normal file
101
scripts/mock.py
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
import yaml
|
||||||
|
import socket
|
||||||
|
import argparse
|
||||||
|
import base64
|
||||||
|
import time
|
||||||
|
from typing import List, Dict
|
||||||
|
|
||||||
|
class RtspMock:
|
||||||
|
def __init__(self, dump_file: str):
|
||||||
|
# Load and parse YAML file
|
||||||
|
with open(dump_file, 'r') as f:
|
||||||
|
data = yaml.safe_load(f)
|
||||||
|
|
||||||
|
self.peers = {p['peer']: (p['host'], p['port']) for p in data['peers']}
|
||||||
|
self.packets = data['packets']
|
||||||
|
|
||||||
|
# Group packets by peer
|
||||||
|
self.peer_packets: Dict[int, List] = {}
|
||||||
|
for packet in self.packets:
|
||||||
|
peer = packet['peer']
|
||||||
|
if peer not in self.peer_packets:
|
||||||
|
self.peer_packets[peer] = []
|
||||||
|
self.peer_packets[peer].append(packet)
|
||||||
|
|
||||||
|
def run_server(self, port: int, peer: int):
|
||||||
|
"""Run as server listening on specified port"""
|
||||||
|
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
|
server.bind(('0.0.0.0', port))
|
||||||
|
server.listen(1)
|
||||||
|
|
||||||
|
print(f"Listening on port {port}, will send peer {peer}'s packets")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
client, addr = server.accept()
|
||||||
|
print(f"Client connected from {addr}")
|
||||||
|
try:
|
||||||
|
self._send_packets(client, peer)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
finally:
|
||||||
|
client.close()
|
||||||
|
|
||||||
|
def run_client(self, host: str, port: int, peer: int):
|
||||||
|
"""Run as client connecting to specified address"""
|
||||||
|
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
print(f"Connecting to {host}:{port}, will send peer {peer}'s packets")
|
||||||
|
|
||||||
|
try:
|
||||||
|
client.connect((host, port))
|
||||||
|
self._send_packets(client, peer)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
finally:
|
||||||
|
client.close()
|
||||||
|
|
||||||
|
def _send_packets(self, sock: socket, peer: int):
|
||||||
|
"""Send packets for specified peer"""
|
||||||
|
if peer not in self.peer_packets:
|
||||||
|
raise ValueError(f"No packets found for peer {peer}")
|
||||||
|
|
||||||
|
packets = self.peer_packets[peer]
|
||||||
|
base_time = None
|
||||||
|
|
||||||
|
for packet in packets:
|
||||||
|
if base_time is None:
|
||||||
|
base_time = packet['timestamp']
|
||||||
|
|
||||||
|
# Calculate delay
|
||||||
|
delay = packet['timestamp'] - base_time
|
||||||
|
if delay > 0:
|
||||||
|
time.sleep(delay)
|
||||||
|
|
||||||
|
data = packet['data']
|
||||||
|
sock.send(data)
|
||||||
|
print(f"Sent packet {packet['packet']} (index {packet['index']}) "
|
||||||
|
f"length {len(data)} bytes")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description='RTSP Mock Server/Client')
|
||||||
|
parser.add_argument('dump_file', help='RTSP dump file in YAML format')
|
||||||
|
parser.add_argument('peer', type=int, help='Peer number to mock')
|
||||||
|
|
||||||
|
group = parser.add_mutually_exclusive_group(required=True)
|
||||||
|
group.add_argument('-l', '--listen', type=int, metavar='PORT',
|
||||||
|
help='Run as server listening on specified port')
|
||||||
|
group.add_argument('-c', '--connect', type=str, metavar='HOST:PORT',
|
||||||
|
help='Run as client connecting to specified address')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
mock = RtspMock(args.dump_file)
|
||||||
|
|
||||||
|
if args.listen is not None:
|
||||||
|
mock.run_server(args.listen, args.peer)
|
||||||
|
else:
|
||||||
|
host, port = args.connect.split(':')
|
||||||
|
mock.run_client(host, int(port), args.peer)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@@ -43,7 +43,7 @@ func (w *WaitManager) WakeUp(streamPath string, publisher *Publisher) {
|
|||||||
func (w *WaitManager) checkTimeout() {
|
func (w *WaitManager) checkTimeout() {
|
||||||
for waits := range w.Range {
|
for waits := range w.Range {
|
||||||
for sub := range waits.Range {
|
for sub := range waits.Range {
|
||||||
if time.Since(sub.waitStartTime) > sub.WaitTimeout {
|
if time.Since(sub.waitStartTime) > max(sub.WaitTimeout, sub.BufferTime) {
|
||||||
sub.Stop(ErrSubscribeTimeout)
|
sub.Stop(ErrSubscribeTimeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user