protocol

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReqSrc = "source"
	SrcV2  = "aipaas"
)
View Source
const (
	Uid       = "uid"
	AppId     = "appid"
	CloudId   = "cloud_id"
	ComposeId = "compose_id"
	Sub       = "sub"
	MeterPara = "meter_param"
	DeviceId  = "did"
	Imei      = "device.imei"
	SessionId = "sid"

	DataCleanTTL = "data_cleaner_ttl"
)

common headers

View Source
const (
	Encoding   = "encoding"
	Compress   = "compress"
	SampleRate = "sample_rate"
	FrameRate  = "frame_rate"
	FrameSize  = "frame_size"
	Channels   = "channels"
	BitDepth   = "bit_depth"
	Height     = "height"
	Width      = "width"
	Sequence   = "seq"
	Status     = "status"
	AudioUrl   = "audio_url"
)

payload attribute

Variables

View Source
var (
	ErrInvalidLengthV2 = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowV2   = fmt.Errorf("proto: integer overflow")
)
View Source
var LoaderInput_SessState_name = map[int32]string{
	0: "STREAM",
	1: "ONCE",
}
View Source
var LoaderInput_SessState_value = map[string]int32{
	"STREAM": 0,
	"ONCE":   1,
}
View Source
var LoaderOutput_RespStatus_name = map[int32]string{
	0: "BEGIN",
	1: "CONTINUE",
	2: "END",
	3: "ONCE",
}
View Source
var LoaderOutput_RespStatus_value = map[string]int32{
	"BEGIN":    0,
	"CONTINUE": 1,
	"END":      2,
	"ONCE":     3,
}
View Source
var MetaDesc_DataType_name = map[int32]string{
	0: "TEXT",
	1: "AUDIO",
	2: "IMAGE",
	3: "VIDEO",
	4: "OTHER",
}
View Source
var MetaDesc_DataType_value = map[string]int32{
	"TEXT":  0,
	"AUDIO": 1,
	"IMAGE": 2,
	"VIDEO": 3,
	"OTHER": 4,
}

Functions

func GetAllAttr

func GetAllAttr(desc *MetaDesc) (attr interface{})

func InputAdapter

func InputAdapter(input []byte, ei *LoaderInput) (code int, err error)

func OutputAdapter

func OutputAdapter(eo *LoaderOutput) (output []byte, code int, err error)

Types

type AudioAttr

type AudioAttr struct {
	Encoding   string // 编解码
	SampleRate string // 采样率
	FrameSize  string // 帧大小(开源speex)
	Channels   int    // 通道数
	BitDepth   int    // 位深
	Seq        int    // 序号
	Status     int    // 状态
}

音频数据属性

type BaseAttr

type BaseAttr struct {
	Name   string // 数据名
	Type   int    // 数据类型
	Seq    int    // 数据序号
	Status int    // 数据状态
}

TODO 关键参数校验;

func GetBaseAttr

func GetBaseAttr(desc *MetaDesc) (attr BaseAttr)

type ImageAttr

type ImageAttr struct {
	Encoding string // 编解码
	Seq      int    // 序号
	Status   int    // 状态
}

type LoaderInput

type LoaderInput struct {
	ServiceId            string                `protobuf:"bytes,1,opt,name=serviceId,proto3" json:"serviceId,omitempty"`
	ServiceName          string                `protobuf:"bytes,2,opt,name=serviceName,proto3" json:"serviceName,omitempty"`
	State                LoaderInput_SessState `protobuf:"varint,3,opt,name=state,proto3,enum=protocol.LoaderInput_SessState" json:"state,omitempty"`
	Headers              map[string]string     `` /* 155-byte string literal not displayed */
	Params               map[string]string     `` /* 153-byte string literal not displayed */
	Expect               []*MetaDesc           `protobuf:"bytes,6,rep,name=expect,proto3" json:"expect,omitempty"`
	Pl                   []*Payload            `protobuf:"bytes,7,rep,name=pl,proto3" json:"pl,omitempty"`
	SyncId               int32                 `protobuf:"varint,8,opt,name=sync_id,json=syncId,proto3" json:"sync_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{}              `json:"-"`
	XXX_unrecognized     []byte                `json:"-"`
	XXX_sizecache        int32                 `json:"-"`
}

func (*LoaderInput) Descriptor

func (*LoaderInput) Descriptor() ([]byte, []int)

func (*LoaderInput) GetExpect

func (m *LoaderInput) GetExpect() []*MetaDesc

func (*LoaderInput) GetHeaders

func (m *LoaderInput) GetHeaders() map[string]string

func (*LoaderInput) GetParams

func (m *LoaderInput) GetParams() map[string]string

func (*LoaderInput) GetPl

func (m *LoaderInput) GetPl() []*Payload

func (*LoaderInput) GetServiceId

func (m *LoaderInput) GetServiceId() string

func (*LoaderInput) GetServiceName

func (m *LoaderInput) GetServiceName() string

func (*LoaderInput) GetState

func (m *LoaderInput) GetState() LoaderInput_SessState

func (*LoaderInput) GetSyncId

func (m *LoaderInput) GetSyncId() int32

func (*LoaderInput) Marshal

func (m *LoaderInput) Marshal() (dAtA []byte, err error)

func (*LoaderInput) MarshalTo

func (m *LoaderInput) MarshalTo(dAtA []byte) (int, error)

func (*LoaderInput) ProtoMessage

func (*LoaderInput) ProtoMessage()

func (*LoaderInput) Reset

func (m *LoaderInput) Reset()

func (*LoaderInput) Size

func (m *LoaderInput) Size() (n int)

func (*LoaderInput) String

func (m *LoaderInput) String() string

func (*LoaderInput) Unmarshal

func (m *LoaderInput) Unmarshal(dAtA []byte) error

func (*LoaderInput) XXX_DiscardUnknown

func (m *LoaderInput) XXX_DiscardUnknown()

func (*LoaderInput) XXX_Marshal

func (m *LoaderInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LoaderInput) XXX_Merge

func (m *LoaderInput) XXX_Merge(src proto.Message)

func (*LoaderInput) XXX_Size

func (m *LoaderInput) XXX_Size() int

func (*LoaderInput) XXX_Unmarshal

func (m *LoaderInput) XXX_Unmarshal(b []byte) error

type LoaderInput_SessState

type LoaderInput_SessState int32
const (
	LoaderInput_STREAM LoaderInput_SessState = 0
	LoaderInput_ONCE   LoaderInput_SessState = 1
)

func (LoaderInput_SessState) EnumDescriptor

func (LoaderInput_SessState) EnumDescriptor() ([]byte, []int)

func (LoaderInput_SessState) String

func (x LoaderInput_SessState) String() string

type LoaderOutput

type LoaderOutput struct {
	ServiceId            string                  `protobuf:"bytes,1,opt,name=serviceId,proto3" json:"serviceId,omitempty"`
	Code                 int32                   `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"`
	Err                  string                  `protobuf:"bytes,3,opt,name=err,proto3" json:"err,omitempty"`
	Status               LoaderOutput_RespStatus `protobuf:"varint,4,opt,name=status,proto3,enum=protocol.LoaderOutput_RespStatus" json:"status,omitempty"`
	Pl                   []*Payload              `protobuf:"bytes,5,rep,name=pl,proto3" json:"pl,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                `json:"-"`
	XXX_unrecognized     []byte                  `json:"-"`
	XXX_sizecache        int32                   `json:"-"`
}

func (*LoaderOutput) Descriptor

func (*LoaderOutput) Descriptor() ([]byte, []int)

func (*LoaderOutput) GetCode

func (m *LoaderOutput) GetCode() int32

func (*LoaderOutput) GetErr

func (m *LoaderOutput) GetErr() string

func (*LoaderOutput) GetPl

func (m *LoaderOutput) GetPl() []*Payload

func (*LoaderOutput) GetServiceId

func (m *LoaderOutput) GetServiceId() string

func (*LoaderOutput) GetStatus

func (m *LoaderOutput) GetStatus() LoaderOutput_RespStatus

func (*LoaderOutput) Marshal

func (m *LoaderOutput) Marshal() (dAtA []byte, err error)

func (*LoaderOutput) MarshalTo

func (m *LoaderOutput) MarshalTo(dAtA []byte) (int, error)

func (*LoaderOutput) ProtoMessage

func (*LoaderOutput) ProtoMessage()

func (*LoaderOutput) Reset

func (m *LoaderOutput) Reset()

func (*LoaderOutput) Size

func (m *LoaderOutput) Size() (n int)

func (*LoaderOutput) String

func (m *LoaderOutput) String() string

func (*LoaderOutput) Unmarshal

func (m *LoaderOutput) Unmarshal(dAtA []byte) error

func (*LoaderOutput) XXX_DiscardUnknown

func (m *LoaderOutput) XXX_DiscardUnknown()

func (*LoaderOutput) XXX_Marshal

func (m *LoaderOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LoaderOutput) XXX_Merge

func (m *LoaderOutput) XXX_Merge(src proto.Message)

func (*LoaderOutput) XXX_Size

func (m *LoaderOutput) XXX_Size() int

func (*LoaderOutput) XXX_Unmarshal

func (m *LoaderOutput) XXX_Unmarshal(b []byte) error

type LoaderOutput_RespStatus

type LoaderOutput_RespStatus int32
const (
	LoaderOutput_BEGIN    LoaderOutput_RespStatus = 0
	LoaderOutput_CONTINUE LoaderOutput_RespStatus = 1
	LoaderOutput_END      LoaderOutput_RespStatus = 2
	LoaderOutput_ONCE     LoaderOutput_RespStatus = 3
)

func (LoaderOutput_RespStatus) EnumDescriptor

func (LoaderOutput_RespStatus) EnumDescriptor() ([]byte, []int)

func (LoaderOutput_RespStatus) String

func (x LoaderOutput_RespStatus) String() string

type MetaDesc

type MetaDesc struct {
	Name                 string            `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	DataType             MetaDesc_DataType `protobuf:"varint,2,opt,name=dataType,proto3,enum=protocol.MetaDesc_DataType" json:"dataType,omitempty"`
	Attribute            map[string]string `` /* 159-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*MetaDesc) Descriptor

func (*MetaDesc) Descriptor() ([]byte, []int)

func (*MetaDesc) GetAttribute

func (m *MetaDesc) GetAttribute() map[string]string

func (*MetaDesc) GetDataType

func (m *MetaDesc) GetDataType() MetaDesc_DataType

func (*MetaDesc) GetName

func (m *MetaDesc) GetName() string

func (*MetaDesc) Marshal

func (m *MetaDesc) Marshal() (dAtA []byte, err error)

func (*MetaDesc) MarshalTo

func (m *MetaDesc) MarshalTo(dAtA []byte) (int, error)

func (*MetaDesc) ProtoMessage

func (*MetaDesc) ProtoMessage()

func (*MetaDesc) Reset

func (m *MetaDesc) Reset()

func (*MetaDesc) Size

func (m *MetaDesc) Size() (n int)

func (*MetaDesc) String

func (m *MetaDesc) String() string

func (*MetaDesc) Unmarshal

func (m *MetaDesc) Unmarshal(dAtA []byte) error

func (*MetaDesc) XXX_DiscardUnknown

func (m *MetaDesc) XXX_DiscardUnknown()

func (*MetaDesc) XXX_Marshal

func (m *MetaDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MetaDesc) XXX_Merge

func (m *MetaDesc) XXX_Merge(src proto.Message)

func (*MetaDesc) XXX_Size

func (m *MetaDesc) XXX_Size() int

func (*MetaDesc) XXX_Unmarshal

func (m *MetaDesc) XXX_Unmarshal(b []byte) error

type MetaDesc_DataType

type MetaDesc_DataType int32
const (
	MetaDesc_TEXT  MetaDesc_DataType = 0
	MetaDesc_AUDIO MetaDesc_DataType = 1
	MetaDesc_IMAGE MetaDesc_DataType = 2
	MetaDesc_VIDEO MetaDesc_DataType = 3
	MetaDesc_OTHER MetaDesc_DataType = 4
)

func (MetaDesc_DataType) EnumDescriptor

func (MetaDesc_DataType) EnumDescriptor() ([]byte, []int)

func (MetaDesc_DataType) String

func (x MetaDesc_DataType) String() string

type Payload

type Payload struct {
	Meta                 *MetaDesc `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty"`
	Data                 []byte    `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*Payload) Descriptor

func (*Payload) Descriptor() ([]byte, []int)

func (*Payload) GetData

func (m *Payload) GetData() []byte

func (*Payload) GetMeta

func (m *Payload) GetMeta() *MetaDesc

func (*Payload) Marshal

func (m *Payload) Marshal() (dAtA []byte, err error)

func (*Payload) MarshalTo

func (m *Payload) MarshalTo(dAtA []byte) (int, error)

func (*Payload) ProtoMessage

func (*Payload) ProtoMessage()

func (*Payload) Reset

func (m *Payload) Reset()

func (*Payload) Size

func (m *Payload) Size() (n int)

func (*Payload) String

func (m *Payload) String() string

func (*Payload) Unmarshal

func (m *Payload) Unmarshal(dAtA []byte) error

func (*Payload) XXX_DiscardUnknown

func (m *Payload) XXX_DiscardUnknown()

func (*Payload) XXX_Marshal

func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Payload) XXX_Merge

func (m *Payload) XXX_Merge(src proto.Message)

func (*Payload) XXX_Size

func (m *Payload) XXX_Size() int

func (*Payload) XXX_Unmarshal

func (m *Payload) XXX_Unmarshal(b []byte) error

type TextAttr

type TextAttr struct {
	Encoding string // 文本编码
	Compress string // 压缩格式
	Seq      int    // 序号
	Status   int    // 状态
}

文本数据属性

type VideoAttr

type VideoAttr struct {
	Encoding  string // 编解码
	FrameRate string // 帧率
	Width     string // 分辨率-宽
	Height    string // 分辨率-高
	Seq       int    // 序号
	Status    int    // 状态
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL