Files
monibuca/pb/global.proto
2024-07-05 17:21:27 +08:00

285 lines
5.9 KiB
Protocol Buffer

syntax = "proto3";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
package m7s;
option go_package="m7s.live/m7s/v5/pb";
service Global {
rpc SysInfo (google.protobuf.Empty) returns (SysInfoResponse) {
option (google.api.http) = {
get: "/api/sysinfo"
};
}
rpc Summary (google.protobuf.Empty) returns (SummaryResponse) {
option (google.api.http) = {
get: "/api/summary"
};
}
rpc Shutdown (RequestWithId) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/shutdown/{id}"
};
}
rpc Restart (RequestWithId) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/restart/{id}"
};
}
rpc StreamList (StreamListRequest) returns (StreamListResponse) {
option (google.api.http) = {
get: "/api/stream/list"
};
}
rpc WaitList (google.protobuf.Empty) returns (StreamWaitListResponse) {
option (google.api.http) = {
get: "/api/stream/waitlist"
};
}
rpc StreamInfo (StreamSnapRequest) returns (StreamInfoResponse) {
option (google.api.http) = {
get: "/api/stream/info/{streamPath=**}"
};
}
rpc GetSubscribers(SubscribersRequest) returns (SubscribersResponse) {
option (google.api.http) = {
get: "/api/subscribers/{streamPath=**}"
};
}
rpc AudioTrackSnap (StreamSnapRequest) returns (TrackSnapShotResponse) {
option (google.api.http) = {
get: "/api/audiotrack/snap/{streamPath=**}"
};
}
rpc VideoTrackSnap (StreamSnapRequest) returns (TrackSnapShotResponse) {
option (google.api.http) = {
get: "/api/videotrack/snap/{streamPath=**}"
};
}
rpc ChangeSubscribe (ChangeSubscribeRequest) returns (SuccessResponse) {
option (google.api.http) = {
post: "/api/subscribe/change/{id}/{streamPath=**}"
body: "*"
};
}
rpc StopSubscribe (RequestWithId) returns (SuccessResponse) {
option (google.api.http) = {
post: "/api/subscribe/stop/{id}"
body: "*"
};
}
rpc GetConfig (GetConfigRequest) returns (GetConfigResponse) {
option (google.api.http) = {
get: "/api/config/get/{name}"
};
}
rpc GetFormily (GetConfigRequest) returns (GetConfigResponse) {
option (google.api.http) = {
get: "/api/config/formily/{name}"
};
}
rpc ModifyConfig (ModifyConfigRequest) returns (SuccessResponse) {
option (google.api.http) = {
post: "/api/config/modify/{name}"
body: "yaml"
};
}
}
message GetConfigRequest {
string name = 1;
}
message Formily {
string type = 1;
map<string, Formily> properties = 2;
string component = 3;
map<string, google.protobuf.Any> componentProps = 4;
}
message FormilyResponse {
string type = 1;
map<string, Formily> properties = 2;
}
message GetConfigResponse {
string file = 1;
string modified = 2;
string merged = 3;
}
message ModifyConfigRequest {
string name = 1;
string yaml = 2;
}
message NetWorkInfo {
string name = 1;
uint64 receive = 2;
uint64 sent = 3;
uint64 receiveSpeed = 4;
uint64 sentSpeed = 5;
}
message Usage {
uint64 total = 1;
uint64 free = 2;
uint64 used = 3;
float usage = 4;
}
message SummaryResponse {
string address = 1;
Usage memory = 2;
float cpuUsage = 3;
Usage hardDisk = 4;
repeated NetWorkInfo netWork = 5;
int32 streamCount = 6;
int32 subscribeCount = 7;
int32 pullCount = 8;
int32 pushCount = 9;
}
message PluginInfo {
string name = 1;
string version = 2;
bool disabled = 3;
}
message SysInfoResponse {
google.protobuf.Timestamp startTime = 1;
string localIP = 2;
string version = 3;
string goVersion = 4;
string os = 5;
string arch = 6;
int32 cpus = 7;
repeated PluginInfo plugins = 8;
}
message StreamListRequest {
int32 pageNum = 1;
int32 pageSize = 2;
}
message StreamListResponse {
int32 total = 1;
int32 pageNum = 2;
int32 pageSize = 3;
repeated StreamInfoResponse list = 4;
}
message StreamWaitListResponse {
map<string, int32> list = 1;
}
message StreamSnapRequest {
string streamPath = 1;
}
message StreamInfoResponse {
string path = 1;
int32 state = 2;
int32 subscribers = 3;
AudioTrackInfo audioTrack = 4;
VideoTrackInfo videoTrack = 5;
google.protobuf.Timestamp startTime = 6;
string type = 7;
string meta = 8;
}
message Wrap {
uint32 timestamp = 1;
uint32 size = 2;
string data = 3;
}
message TrackSnapShot {
uint32 sequence = 1;
uint32 timestamp = 2;
google.protobuf.Timestamp writeTime = 3;
bool keyFrame = 4;
repeated Wrap wrap = 5;
}
message MemoryBlock {
uint32 s = 1;
uint32 e = 2;
}
message MemoryBlockGroup {
uint32 size = 1;
repeated MemoryBlock list = 2;
}
message AudioTrackInfo {
string codec = 1;
string delta = 2;
string meta = 3;
uint32 bps = 4;
uint32 fps = 5;
uint32 sampleRate = 6;
uint32 channels =7;
}
message TrackSnapShotResponse {
repeated TrackSnapShot ring = 1;
uint32 ringDataSize = 2;
map<uint32, uint32> reader = 3;
repeated MemoryBlockGroup memory = 4;
}
message VideoTrackInfo {
string codec = 1;
string delta = 2;
string meta = 3;
uint32 bps = 4;
uint32 fps = 5;
uint32 width = 6;
uint32 height =7;
uint32 gop = 8;
}
message SuccessResponse {
int32 code = 1;
string msg = 2;
}
message RequestWithId {
uint32 id = 1;
}
message ChangeSubscribeRequest {
uint32 id = 1;
string streamPath = 2;
}
message SubscribersRequest {
string streamPath = 1;
int32 pageNum = 2;
int32 pageSize = 3;
}
message RingReaderSnapShot {
uint32 sequence = 1;
uint32 timestamp = 2;
uint32 delay = 3;
int32 state = 4;
}
message SubscriberSnapShot {
uint32 id = 1;
google.protobuf.Timestamp startTime = 2;
RingReaderSnapShot audioReader = 3;
RingReaderSnapShot videoReader = 4;
string meta = 5;
}
message SubscribersResponse {
int32 total = 1;
int32 pageNum = 2;
int32 pageSize = 3;
repeated SubscriberSnapShot list = 4;
}