Rename gRPC endpoints and service methods.

- GetAudio > GetPeaks
- GetAudioSegment > GetPeaksForSegment
This commit is contained in:
Rob Watson 2021-12-17 17:30:53 +01:00
parent 57516c738e
commit 2445ebc02f
15 changed files with 876 additions and 844 deletions

View File

@ -14,13 +14,13 @@ type FileStore struct {
mock.Mock
}
// GetObject provides a mock function with given fields: _a0, _a1
func (_m *FileStore) GetObject(_a0 context.Context, _a1 string) (io.ReadCloser, error) {
ret := _m.Called(_a0, _a1)
// GetObject provides a mock function with given fields: ctx, key
func (_m *FileStore) GetObject(ctx context.Context, key string) (io.ReadCloser, error) {
ret := _m.Called(ctx, key)
var r0 io.ReadCloser
if rf, ok := ret.Get(0).(func(context.Context, string) io.ReadCloser); ok {
r0 = rf(_a0, _a1)
r0 = rf(ctx, key)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(io.ReadCloser)
@ -29,7 +29,7 @@ func (_m *FileStore) GetObject(_a0 context.Context, _a1 string) (io.ReadCloser,
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(_a0, _a1)
r1 = rf(ctx, key)
} else {
r1 = ret.Error(1)
}
@ -37,13 +37,13 @@ func (_m *FileStore) GetObject(_a0 context.Context, _a1 string) (io.ReadCloser,
return r0, r1
}
// GetObjectWithRange provides a mock function with given fields: _a0, _a1, _a2, _a3
func (_m *FileStore) GetObjectWithRange(_a0 context.Context, _a1 string, _a2 int64, _a3 int64) (io.ReadCloser, error) {
ret := _m.Called(_a0, _a1, _a2, _a3)
// GetObjectWithRange provides a mock function with given fields: ctx, key, startFrame, endFrame
func (_m *FileStore) GetObjectWithRange(ctx context.Context, key string, startFrame int64, endFrame int64) (io.ReadCloser, error) {
ret := _m.Called(ctx, key, startFrame, endFrame)
var r0 io.ReadCloser
if rf, ok := ret.Get(0).(func(context.Context, string, int64, int64) io.ReadCloser); ok {
r0 = rf(_a0, _a1, _a2, _a3)
r0 = rf(ctx, key, startFrame, endFrame)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(io.ReadCloser)
@ -52,7 +52,7 @@ func (_m *FileStore) GetObjectWithRange(_a0 context.Context, _a1 string, _a2 int
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, int64, int64) error); ok {
r1 = rf(_a0, _a1, _a2, _a3)
r1 = rf(ctx, key, startFrame, endFrame)
} else {
r1 = ret.Error(1)
}
@ -60,20 +60,20 @@ func (_m *FileStore) GetObjectWithRange(_a0 context.Context, _a1 string, _a2 int
return r0, r1
}
// GetURL provides a mock function with given fields: _a0, _a1
func (_m *FileStore) GetURL(_a0 context.Context, _a1 string) (string, error) {
ret := _m.Called(_a0, _a1)
// GetURL provides a mock function with given fields: ctx, key
func (_m *FileStore) GetURL(ctx context.Context, key string) (string, error) {
ret := _m.Called(ctx, key)
var r0 string
if rf, ok := ret.Get(0).(func(context.Context, string) string); ok {
r0 = rf(_a0, _a1)
r0 = rf(ctx, key)
} else {
r0 = ret.Get(0).(string)
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(_a0, _a1)
r1 = rf(ctx, key)
} else {
r1 = ret.Error(1)
}
@ -81,20 +81,20 @@ func (_m *FileStore) GetURL(_a0 context.Context, _a1 string) (string, error) {
return r0, r1
}
// PutObject provides a mock function with given fields: _a0, _a1, _a2, _a3
func (_m *FileStore) PutObject(_a0 context.Context, _a1 string, _a2 io.Reader, _a3 string) (int64, error) {
ret := _m.Called(_a0, _a1, _a2, _a3)
// PutObject provides a mock function with given fields: ctx, key, reader, contentType
func (_m *FileStore) PutObject(ctx context.Context, key string, reader io.Reader, contentType string) (int64, error) {
ret := _m.Called(ctx, key, reader, contentType)
var r0 int64
if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, string) int64); ok {
r0 = rf(_a0, _a1, _a2, _a3)
r0 = rf(ctx, key, reader, contentType)
} else {
r0 = ret.Get(0).(int64)
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, io.Reader, string) error); ok {
r1 = rf(_a0, _a1, _a2, _a3)
r1 = rf(ctx, key, reader, contentType)
} else {
r1 = ret.Error(1)
}

View File

@ -16,13 +16,13 @@ type YoutubeClient struct {
mock.Mock
}
// GetStreamContext provides a mock function with given fields: _a0, _a1, _a2
func (_m *YoutubeClient) GetStreamContext(_a0 context.Context, _a1 *youtube.Video, _a2 *youtube.Format) (io.ReadCloser, int64, error) {
ret := _m.Called(_a0, _a1, _a2)
// GetStreamContext provides a mock function with given fields: ctx, video, format
func (_m *YoutubeClient) GetStreamContext(ctx context.Context, video *youtube.Video, format *youtube.Format) (io.ReadCloser, int64, error) {
ret := _m.Called(ctx, video, format)
var r0 io.ReadCloser
if rf, ok := ret.Get(0).(func(context.Context, *youtube.Video, *youtube.Format) io.ReadCloser); ok {
r0 = rf(_a0, _a1, _a2)
r0 = rf(ctx, video, format)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(io.ReadCloser)
@ -31,14 +31,14 @@ func (_m *YoutubeClient) GetStreamContext(_a0 context.Context, _a1 *youtube.Vide
var r1 int64
if rf, ok := ret.Get(1).(func(context.Context, *youtube.Video, *youtube.Format) int64); ok {
r1 = rf(_a0, _a1, _a2)
r1 = rf(ctx, video, format)
} else {
r1 = ret.Get(1).(int64)
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, *youtube.Video, *youtube.Format) error); ok {
r2 = rf(_a0, _a1, _a2)
r2 = rf(ctx, video, format)
} else {
r2 = ret.Error(2)
}
@ -46,13 +46,13 @@ func (_m *YoutubeClient) GetStreamContext(_a0 context.Context, _a1 *youtube.Vide
return r0, r1, r2
}
// GetVideoContext provides a mock function with given fields: _a0, _a1
func (_m *YoutubeClient) GetVideoContext(_a0 context.Context, _a1 string) (*youtube.Video, error) {
ret := _m.Called(_a0, _a1)
// GetVideoContext provides a mock function with given fields: ctx, id
func (_m *YoutubeClient) GetVideoContext(ctx context.Context, id string) (*youtube.Video, error) {
ret := _m.Called(ctx, id)
var r0 *youtube.Video
if rf, ok := ret.Get(0).(func(context.Context, string) *youtube.Video); ok {
r0 = rf(_a0, _a1)
r0 = rf(ctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*youtube.Video)
@ -61,7 +61,7 @@ func (_m *YoutubeClient) GetVideoContext(_a0 context.Context, _a1 string) (*yout
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(_a0, _a1)
r1 = rf(ctx, id)
} else {
r1 = ret.Error(1)
}

View File

@ -148,69 +148,6 @@ func (x *MediaSet) GetVideoMimeType() string {
return ""
}
type GetAudioProgress struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Peaks []int32 `protobuf:"varint,1,rep,packed,name=peaks,proto3" json:"peaks,omitempty"`
PercentComplete float32 `protobuf:"fixed32,2,opt,name=percent_complete,json=percentComplete,proto3" json:"percent_complete,omitempty"`
Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
}
func (x *GetAudioProgress) Reset() {
*x = GetAudioProgress{}
if protoimpl.UnsafeEnabled {
mi := &file_media_set_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetAudioProgress) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetAudioProgress) ProtoMessage() {}
func (x *GetAudioProgress) ProtoReflect() protoreflect.Message {
mi := &file_media_set_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetAudioProgress.ProtoReflect.Descriptor instead.
func (*GetAudioProgress) Descriptor() ([]byte, []int) {
return file_media_set_proto_rawDescGZIP(), []int{1}
}
func (x *GetAudioProgress) GetPeaks() []int32 {
if x != nil {
return x.Peaks
}
return nil
}
func (x *GetAudioProgress) GetPercentComplete() float32 {
if x != nil {
return x.PercentComplete
}
return 0
}
func (x *GetAudioProgress) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
type GetRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -222,7 +159,7 @@ type GetRequest struct {
func (x *GetRequest) Reset() {
*x = GetRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_media_set_proto_msgTypes[2]
mi := &file_media_set_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -235,7 +172,7 @@ func (x *GetRequest) String() string {
func (*GetRequest) ProtoMessage() {}
func (x *GetRequest) ProtoReflect() protoreflect.Message {
mi := &file_media_set_proto_msgTypes[2]
mi := &file_media_set_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -248,7 +185,7 @@ func (x *GetRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.
func (*GetRequest) Descriptor() ([]byte, []int) {
return file_media_set_proto_rawDescGZIP(), []int{2}
return file_media_set_proto_rawDescGZIP(), []int{1}
}
func (x *GetRequest) GetYoutubeId() string {
@ -258,7 +195,7 @@ func (x *GetRequest) GetYoutubeId() string {
return ""
}
type GetAudioRequest struct {
type GetPeaksRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -267,8 +204,64 @@ type GetAudioRequest struct {
NumBins int32 `protobuf:"varint,2,opt,name=num_bins,json=numBins,proto3" json:"num_bins,omitempty"`
}
func (x *GetAudioRequest) Reset() {
*x = GetAudioRequest{}
func (x *GetPeaksRequest) Reset() {
*x = GetPeaksRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_media_set_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetPeaksRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetPeaksRequest) ProtoMessage() {}
func (x *GetPeaksRequest) ProtoReflect() protoreflect.Message {
mi := &file_media_set_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetPeaksRequest.ProtoReflect.Descriptor instead.
func (*GetPeaksRequest) Descriptor() ([]byte, []int) {
return file_media_set_proto_rawDescGZIP(), []int{2}
}
func (x *GetPeaksRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *GetPeaksRequest) GetNumBins() int32 {
if x != nil {
return x.NumBins
}
return 0
}
type GetPeaksProgress struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Peaks []int32 `protobuf:"varint,1,rep,packed,name=peaks,proto3" json:"peaks,omitempty"`
PercentComplete float32 `protobuf:"fixed32,2,opt,name=percent_complete,json=percentComplete,proto3" json:"percent_complete,omitempty"`
Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
}
func (x *GetPeaksProgress) Reset() {
*x = GetPeaksProgress{}
if protoimpl.UnsafeEnabled {
mi := &file_media_set_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -276,13 +269,13 @@ func (x *GetAudioRequest) Reset() {
}
}
func (x *GetAudioRequest) String() string {
func (x *GetPeaksProgress) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetAudioRequest) ProtoMessage() {}
func (*GetPeaksProgress) ProtoMessage() {}
func (x *GetAudioRequest) ProtoReflect() protoreflect.Message {
func (x *GetPeaksProgress) ProtoReflect() protoreflect.Message {
mi := &file_media_set_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -294,26 +287,33 @@ func (x *GetAudioRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetAudioRequest.ProtoReflect.Descriptor instead.
func (*GetAudioRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use GetPeaksProgress.ProtoReflect.Descriptor instead.
func (*GetPeaksProgress) Descriptor() ([]byte, []int) {
return file_media_set_proto_rawDescGZIP(), []int{3}
}
func (x *GetAudioRequest) GetId() string {
func (x *GetPeaksProgress) GetPeaks() []int32 {
if x != nil {
return x.Id
return x.Peaks
}
return ""
return nil
}
func (x *GetAudioRequest) GetNumBins() int32 {
func (x *GetPeaksProgress) GetPercentComplete() float32 {
if x != nil {
return x.NumBins
return x.PercentComplete
}
return 0
}
type GetAudioSegmentRequest struct {
func (x *GetPeaksProgress) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
type GetPeaksForSegmentRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -324,8 +324,8 @@ type GetAudioSegmentRequest struct {
EndFrame int64 `protobuf:"varint,4,opt,name=end_frame,json=endFrame,proto3" json:"end_frame,omitempty"`
}
func (x *GetAudioSegmentRequest) Reset() {
*x = GetAudioSegmentRequest{}
func (x *GetPeaksForSegmentRequest) Reset() {
*x = GetPeaksForSegmentRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_media_set_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -333,13 +333,13 @@ func (x *GetAudioSegmentRequest) Reset() {
}
}
func (x *GetAudioSegmentRequest) String() string {
func (x *GetPeaksForSegmentRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetAudioSegmentRequest) ProtoMessage() {}
func (*GetPeaksForSegmentRequest) ProtoMessage() {}
func (x *GetAudioSegmentRequest) ProtoReflect() protoreflect.Message {
func (x *GetPeaksForSegmentRequest) ProtoReflect() protoreflect.Message {
mi := &file_media_set_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -351,40 +351,40 @@ func (x *GetAudioSegmentRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetAudioSegmentRequest.ProtoReflect.Descriptor instead.
func (*GetAudioSegmentRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use GetPeaksForSegmentRequest.ProtoReflect.Descriptor instead.
func (*GetPeaksForSegmentRequest) Descriptor() ([]byte, []int) {
return file_media_set_proto_rawDescGZIP(), []int{4}
}
func (x *GetAudioSegmentRequest) GetId() string {
func (x *GetPeaksForSegmentRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *GetAudioSegmentRequest) GetNumBins() int32 {
func (x *GetPeaksForSegmentRequest) GetNumBins() int32 {
if x != nil {
return x.NumBins
}
return 0
}
func (x *GetAudioSegmentRequest) GetStartFrame() int64 {
func (x *GetPeaksForSegmentRequest) GetStartFrame() int64 {
if x != nil {
return x.StartFrame
}
return 0
}
func (x *GetAudioSegmentRequest) GetEndFrame() int64 {
func (x *GetPeaksForSegmentRequest) GetEndFrame() int64 {
if x != nil {
return x.EndFrame
}
return 0
}
type GetAudioSegmentResponse struct {
type GetPeaksForSegmentResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -392,8 +392,8 @@ type GetAudioSegmentResponse struct {
Peaks []int32 `protobuf:"varint,1,rep,packed,name=peaks,proto3" json:"peaks,omitempty"`
}
func (x *GetAudioSegmentResponse) Reset() {
*x = GetAudioSegmentResponse{}
func (x *GetPeaksForSegmentResponse) Reset() {
*x = GetPeaksForSegmentResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_media_set_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -401,13 +401,13 @@ func (x *GetAudioSegmentResponse) Reset() {
}
}
func (x *GetAudioSegmentResponse) String() string {
func (x *GetPeaksForSegmentResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetAudioSegmentResponse) ProtoMessage() {}
func (*GetPeaksForSegmentResponse) ProtoMessage() {}
func (x *GetAudioSegmentResponse) ProtoReflect() protoreflect.Message {
func (x *GetPeaksForSegmentResponse) ProtoReflect() protoreflect.Message {
mi := &file_media_set_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -419,12 +419,12 @@ func (x *GetAudioSegmentResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetAudioSegmentResponse.ProtoReflect.Descriptor instead.
func (*GetAudioSegmentResponse) Descriptor() ([]byte, []int) {
// Deprecated: Use GetPeaksForSegmentResponse.ProtoReflect.Descriptor instead.
func (*GetPeaksForSegmentResponse) Descriptor() ([]byte, []int) {
return file_media_set_proto_rawDescGZIP(), []int{5}
}
func (x *GetAudioSegmentResponse) GetPeaks() []int32 {
func (x *GetPeaksForSegmentResponse) GetPeaks() []int32 {
if x != nil {
return x.Peaks
}
@ -678,75 +678,76 @@ var file_media_set_proto_rawDesc = []byte{
0x28, 0x05, 0x52, 0x10, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x59, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65,
0x49, 0x74, 0x61, 0x67, 0x12, 0x26, 0x0a, 0x0f, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x5f, 0x6d, 0x69,
0x6d, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x76,
0x69, 0x64, 0x65, 0x6f, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x65, 0x0a, 0x10,
0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73,
0x12, 0x14, 0x0a, 0x05, 0x70, 0x65, 0x61, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52,
0x05, 0x70, 0x65, 0x61, 0x6b, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e,
0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02,
0x52, 0x0f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74,
0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x75, 0x72, 0x6c, 0x22, 0x2b, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x5f, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x49, 0x64,
0x22, 0x3c, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x5f, 0x62, 0x69, 0x6e, 0x73, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6e, 0x75, 0x6d, 0x42, 0x69, 0x6e, 0x73, 0x22, 0x81,
0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x53, 0x65, 0x67, 0x6d, 0x65,
0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x75, 0x6d,
0x5f, 0x62, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6e, 0x75, 0x6d,
0x42, 0x69, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x66, 0x72,
0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74,
0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x5f, 0x66, 0x72, 0x61,
0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x46, 0x72, 0x61,
0x6d, 0x65, 0x22, 0x2f, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x53, 0x65,
0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a,
0x05, 0x70, 0x65, 0x61, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x70, 0x65,
0x61, 0x6b, 0x73, 0x22, 0x21, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64,
0x65, 0x6f, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x65,
0x72, 0x63, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x02, 0x52, 0x0f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d,
0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x2a, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x56, 0x69,
0x64, 0x65, 0x6f, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x22, 0x5f, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x54,
0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06,
0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65,
0x69, 0x67, 0x68, 0x74, 0x32, 0x96, 0x03, 0x0a, 0x0f, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65,
0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12,
0x15, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73,
0x65, 0x74, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x22, 0x00, 0x12, 0x47, 0x0a,
0x08, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x12, 0x1a, 0x2e, 0x6d, 0x65, 0x64, 0x69,
0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65,
0x74, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65,
0x73, 0x73, 0x22, 0x00, 0x30, 0x01, 0x12, 0x5a, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64,
0x69, 0x6f, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x2e, 0x6d, 0x65, 0x64, 0x69,
0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x53, 0x65,
0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6d,
0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69,
0x6f, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x12, 0x47, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x12, 0x1a,
0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x69,
0x64, 0x65, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6d, 0x65, 0x64,
0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x50,
0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x22, 0x00, 0x30, 0x01, 0x12, 0x60, 0x0a, 0x11, 0x47,
0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c,
0x12, 0x23, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74,
0x69, 0x64, 0x65, 0x6f, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x2b, 0x0a, 0x0a,
0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x79, 0x6f,
0x75, 0x74, 0x75, 0x62, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x49, 0x64, 0x22, 0x3c, 0x0a, 0x0f, 0x47, 0x65, 0x74,
0x50, 0x65, 0x61, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08,
0x6e, 0x75, 0x6d, 0x5f, 0x62, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
0x6e, 0x75, 0x6d, 0x42, 0x69, 0x6e, 0x73, 0x22, 0x65, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x65,
0x61, 0x6b, 0x73, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x70,
0x65, 0x61, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x70, 0x65, 0x61, 0x6b,
0x73, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x6d,
0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0f, 0x70, 0x65, 0x72,
0x63, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03,
0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x84,
0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x50, 0x65, 0x61, 0x6b, 0x73, 0x46, 0x6f, 0x72, 0x53, 0x65,
0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08,
0x6e, 0x75, 0x6d, 0x5f, 0x62, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
0x6e, 0x75, 0x6d, 0x42, 0x69, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74,
0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x73, 0x74,
0x61, 0x72, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x5f,
0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x65, 0x6e, 0x64,
0x46, 0x72, 0x61, 0x6d, 0x65, 0x22, 0x32, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x50, 0x65, 0x61, 0x6b,
0x73, 0x46, 0x6f, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x65, 0x61, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03,
0x28, 0x05, 0x52, 0x05, 0x70, 0x65, 0x61, 0x6b, 0x73, 0x22, 0x21, 0x0a, 0x0f, 0x47, 0x65, 0x74,
0x56, 0x69, 0x64, 0x65, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x10,
0x47, 0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73,
0x12, 0x29, 0x0a, 0x10, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x70,
0x6c, 0x65, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0f, 0x70, 0x65, 0x72, 0x63,
0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75,
0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x2a, 0x0a,
0x18, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61,
0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x5f, 0x0a, 0x19, 0x47, 0x65, 0x74,
0x56, 0x69, 0x64, 0x65, 0x6f, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65,
0x74, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e,
0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0e, 0x5a,
0x0c, 0x70, 0x62, 0x2f, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x69, 0x64,
0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01,
0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x32, 0x9f, 0x03, 0x0a, 0x0f, 0x4d,
0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x33,
0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x15, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65,
0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6d,
0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65,
0x74, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x50, 0x65, 0x61, 0x6b, 0x73, 0x12,
0x1a, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50,
0x65, 0x61, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6d, 0x65,
0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x61, 0x6b, 0x73,
0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x22, 0x00, 0x30, 0x01, 0x12, 0x63, 0x0a, 0x12,
0x47, 0x65, 0x74, 0x50, 0x65, 0x61, 0x6b, 0x73, 0x46, 0x6f, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65,
0x6e, 0x74, 0x12, 0x24, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47,
0x65, 0x74, 0x50, 0x65, 0x61, 0x6b, 0x73, 0x46, 0x6f, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e,
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61,
0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x61, 0x6b, 0x73, 0x46, 0x6f, 0x72,
0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x12, 0x47, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x12, 0x1a, 0x2e,
0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64,
0x65, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6d, 0x65, 0x64, 0x69,
0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x50, 0x72,
0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x22, 0x00, 0x30, 0x01, 0x12, 0x60, 0x0a, 0x11, 0x47, 0x65,
0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x12,
0x23, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x56,
0x69, 0x64, 0x65, 0x6f, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74,
0x2e, 0x47, 0x65, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61,
0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0e, 0x5a, 0x0c,
0x70, 0x62, 0x2f, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -763,28 +764,28 @@ func file_media_set_proto_rawDescGZIP() []byte {
var file_media_set_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_media_set_proto_goTypes = []interface{}{
(*MediaSet)(nil), // 0: media_set.MediaSet
(*GetAudioProgress)(nil), // 1: media_set.GetAudioProgress
(*GetRequest)(nil), // 2: media_set.GetRequest
(*GetAudioRequest)(nil), // 3: media_set.GetAudioRequest
(*GetAudioSegmentRequest)(nil), // 4: media_set.GetAudioSegmentRequest
(*GetAudioSegmentResponse)(nil), // 5: media_set.GetAudioSegmentResponse
(*GetVideoRequest)(nil), // 6: media_set.GetVideoRequest
(*GetVideoProgress)(nil), // 7: media_set.GetVideoProgress
(*GetVideoThumbnailRequest)(nil), // 8: media_set.GetVideoThumbnailRequest
(*GetVideoThumbnailResponse)(nil), // 9: media_set.GetVideoThumbnailResponse
(*durationpb.Duration)(nil), // 10: google.protobuf.Duration
(*MediaSet)(nil), // 0: media_set.MediaSet
(*GetRequest)(nil), // 1: media_set.GetRequest
(*GetPeaksRequest)(nil), // 2: media_set.GetPeaksRequest
(*GetPeaksProgress)(nil), // 3: media_set.GetPeaksProgress
(*GetPeaksForSegmentRequest)(nil), // 4: media_set.GetPeaksForSegmentRequest
(*GetPeaksForSegmentResponse)(nil), // 5: media_set.GetPeaksForSegmentResponse
(*GetVideoRequest)(nil), // 6: media_set.GetVideoRequest
(*GetVideoProgress)(nil), // 7: media_set.GetVideoProgress
(*GetVideoThumbnailRequest)(nil), // 8: media_set.GetVideoThumbnailRequest
(*GetVideoThumbnailResponse)(nil), // 9: media_set.GetVideoThumbnailResponse
(*durationpb.Duration)(nil), // 10: google.protobuf.Duration
}
var file_media_set_proto_depIdxs = []int32{
10, // 0: media_set.MediaSet.video_duration:type_name -> google.protobuf.Duration
2, // 1: media_set.MediaSetService.Get:input_type -> media_set.GetRequest
3, // 2: media_set.MediaSetService.GetAudio:input_type -> media_set.GetAudioRequest
4, // 3: media_set.MediaSetService.GetAudioSegment:input_type -> media_set.GetAudioSegmentRequest
1, // 1: media_set.MediaSetService.Get:input_type -> media_set.GetRequest
2, // 2: media_set.MediaSetService.GetPeaks:input_type -> media_set.GetPeaksRequest
4, // 3: media_set.MediaSetService.GetPeaksForSegment:input_type -> media_set.GetPeaksForSegmentRequest
6, // 4: media_set.MediaSetService.GetVideo:input_type -> media_set.GetVideoRequest
8, // 5: media_set.MediaSetService.GetVideoThumbnail:input_type -> media_set.GetVideoThumbnailRequest
0, // 6: media_set.MediaSetService.Get:output_type -> media_set.MediaSet
1, // 7: media_set.MediaSetService.GetAudio:output_type -> media_set.GetAudioProgress
5, // 8: media_set.MediaSetService.GetAudioSegment:output_type -> media_set.GetAudioSegmentResponse
3, // 7: media_set.MediaSetService.GetPeaks:output_type -> media_set.GetPeaksProgress
5, // 8: media_set.MediaSetService.GetPeaksForSegment:output_type -> media_set.GetPeaksForSegmentResponse
7, // 9: media_set.MediaSetService.GetVideo:output_type -> media_set.GetVideoProgress
9, // 10: media_set.MediaSetService.GetVideoThumbnail:output_type -> media_set.GetVideoThumbnailResponse
6, // [6:11] is the sub-list for method output_type
@ -813,18 +814,6 @@ func file_media_set_proto_init() {
}
}
file_media_set_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetAudioProgress); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_media_set_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetRequest); i {
case 0:
return &v.state
@ -836,8 +825,20 @@ func file_media_set_proto_init() {
return nil
}
}
file_media_set_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetPeaksRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_media_set_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetAudioRequest); i {
switch v := v.(*GetPeaksProgress); i {
case 0:
return &v.state
case 1:
@ -849,7 +850,7 @@ func file_media_set_proto_init() {
}
}
file_media_set_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetAudioSegmentRequest); i {
switch v := v.(*GetPeaksForSegmentRequest); i {
case 0:
return &v.state
case 1:
@ -861,7 +862,7 @@ func file_media_set_proto_init() {
}
}
file_media_set_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetAudioSegmentResponse); i {
switch v := v.(*GetPeaksForSegmentResponse); i {
case 0:
return &v.state
case 1:

View File

@ -19,8 +19,8 @@ const _ = grpc.SupportPackageIsVersion7
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MediaSetServiceClient interface {
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*MediaSet, error)
GetAudio(ctx context.Context, in *GetAudioRequest, opts ...grpc.CallOption) (MediaSetService_GetAudioClient, error)
GetAudioSegment(ctx context.Context, in *GetAudioSegmentRequest, opts ...grpc.CallOption) (*GetAudioSegmentResponse, error)
GetPeaks(ctx context.Context, in *GetPeaksRequest, opts ...grpc.CallOption) (MediaSetService_GetPeaksClient, error)
GetPeaksForSegment(ctx context.Context, in *GetPeaksForSegmentRequest, opts ...grpc.CallOption) (*GetPeaksForSegmentResponse, error)
GetVideo(ctx context.Context, in *GetVideoRequest, opts ...grpc.CallOption) (MediaSetService_GetVideoClient, error)
GetVideoThumbnail(ctx context.Context, in *GetVideoThumbnailRequest, opts ...grpc.CallOption) (*GetVideoThumbnailResponse, error)
}
@ -42,12 +42,12 @@ func (c *mediaSetServiceClient) Get(ctx context.Context, in *GetRequest, opts ..
return out, nil
}
func (c *mediaSetServiceClient) GetAudio(ctx context.Context, in *GetAudioRequest, opts ...grpc.CallOption) (MediaSetService_GetAudioClient, error) {
stream, err := c.cc.NewStream(ctx, &MediaSetService_ServiceDesc.Streams[0], "/media_set.MediaSetService/GetAudio", opts...)
func (c *mediaSetServiceClient) GetPeaks(ctx context.Context, in *GetPeaksRequest, opts ...grpc.CallOption) (MediaSetService_GetPeaksClient, error) {
stream, err := c.cc.NewStream(ctx, &MediaSetService_ServiceDesc.Streams[0], "/media_set.MediaSetService/GetPeaks", opts...)
if err != nil {
return nil, err
}
x := &mediaSetServiceGetAudioClient{stream}
x := &mediaSetServiceGetPeaksClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
@ -57,26 +57,26 @@ func (c *mediaSetServiceClient) GetAudio(ctx context.Context, in *GetAudioReques
return x, nil
}
type MediaSetService_GetAudioClient interface {
Recv() (*GetAudioProgress, error)
type MediaSetService_GetPeaksClient interface {
Recv() (*GetPeaksProgress, error)
grpc.ClientStream
}
type mediaSetServiceGetAudioClient struct {
type mediaSetServiceGetPeaksClient struct {
grpc.ClientStream
}
func (x *mediaSetServiceGetAudioClient) Recv() (*GetAudioProgress, error) {
m := new(GetAudioProgress)
func (x *mediaSetServiceGetPeaksClient) Recv() (*GetPeaksProgress, error) {
m := new(GetPeaksProgress)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *mediaSetServiceClient) GetAudioSegment(ctx context.Context, in *GetAudioSegmentRequest, opts ...grpc.CallOption) (*GetAudioSegmentResponse, error) {
out := new(GetAudioSegmentResponse)
err := c.cc.Invoke(ctx, "/media_set.MediaSetService/GetAudioSegment", in, out, opts...)
func (c *mediaSetServiceClient) GetPeaksForSegment(ctx context.Context, in *GetPeaksForSegmentRequest, opts ...grpc.CallOption) (*GetPeaksForSegmentResponse, error) {
out := new(GetPeaksForSegmentResponse)
err := c.cc.Invoke(ctx, "/media_set.MediaSetService/GetPeaksForSegment", in, out, opts...)
if err != nil {
return nil, err
}
@ -129,8 +129,8 @@ func (c *mediaSetServiceClient) GetVideoThumbnail(ctx context.Context, in *GetVi
// for forward compatibility
type MediaSetServiceServer interface {
Get(context.Context, *GetRequest) (*MediaSet, error)
GetAudio(*GetAudioRequest, MediaSetService_GetAudioServer) error
GetAudioSegment(context.Context, *GetAudioSegmentRequest) (*GetAudioSegmentResponse, error)
GetPeaks(*GetPeaksRequest, MediaSetService_GetPeaksServer) error
GetPeaksForSegment(context.Context, *GetPeaksForSegmentRequest) (*GetPeaksForSegmentResponse, error)
GetVideo(*GetVideoRequest, MediaSetService_GetVideoServer) error
GetVideoThumbnail(context.Context, *GetVideoThumbnailRequest) (*GetVideoThumbnailResponse, error)
mustEmbedUnimplementedMediaSetServiceServer()
@ -143,11 +143,11 @@ type UnimplementedMediaSetServiceServer struct {
func (UnimplementedMediaSetServiceServer) Get(context.Context, *GetRequest) (*MediaSet, error) {
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedMediaSetServiceServer) GetAudio(*GetAudioRequest, MediaSetService_GetAudioServer) error {
return status.Errorf(codes.Unimplemented, "method GetAudio not implemented")
func (UnimplementedMediaSetServiceServer) GetPeaks(*GetPeaksRequest, MediaSetService_GetPeaksServer) error {
return status.Errorf(codes.Unimplemented, "method GetPeaks not implemented")
}
func (UnimplementedMediaSetServiceServer) GetAudioSegment(context.Context, *GetAudioSegmentRequest) (*GetAudioSegmentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAudioSegment not implemented")
func (UnimplementedMediaSetServiceServer) GetPeaksForSegment(context.Context, *GetPeaksForSegmentRequest) (*GetPeaksForSegmentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPeaksForSegment not implemented")
}
func (UnimplementedMediaSetServiceServer) GetVideo(*GetVideoRequest, MediaSetService_GetVideoServer) error {
return status.Errorf(codes.Unimplemented, "method GetVideo not implemented")
@ -186,41 +186,41 @@ func _MediaSetService_Get_Handler(srv interface{}, ctx context.Context, dec func
return interceptor(ctx, in, info, handler)
}
func _MediaSetService_GetAudio_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(GetAudioRequest)
func _MediaSetService_GetPeaks_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(GetPeaksRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(MediaSetServiceServer).GetAudio(m, &mediaSetServiceGetAudioServer{stream})
return srv.(MediaSetServiceServer).GetPeaks(m, &mediaSetServiceGetPeaksServer{stream})
}
type MediaSetService_GetAudioServer interface {
Send(*GetAudioProgress) error
type MediaSetService_GetPeaksServer interface {
Send(*GetPeaksProgress) error
grpc.ServerStream
}
type mediaSetServiceGetAudioServer struct {
type mediaSetServiceGetPeaksServer struct {
grpc.ServerStream
}
func (x *mediaSetServiceGetAudioServer) Send(m *GetAudioProgress) error {
func (x *mediaSetServiceGetPeaksServer) Send(m *GetPeaksProgress) error {
return x.ServerStream.SendMsg(m)
}
func _MediaSetService_GetAudioSegment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetAudioSegmentRequest)
func _MediaSetService_GetPeaksForSegment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPeaksForSegmentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MediaSetServiceServer).GetAudioSegment(ctx, in)
return srv.(MediaSetServiceServer).GetPeaksForSegment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/media_set.MediaSetService/GetAudioSegment",
FullMethod: "/media_set.MediaSetService/GetPeaksForSegment",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MediaSetServiceServer).GetAudioSegment(ctx, req.(*GetAudioSegmentRequest))
return srv.(MediaSetServiceServer).GetPeaksForSegment(ctx, req.(*GetPeaksForSegmentRequest))
}
return interceptor(ctx, in, info, handler)
}
@ -276,8 +276,8 @@ var MediaSetService_ServiceDesc = grpc.ServiceDesc{
Handler: _MediaSetService_Get_Handler,
},
{
MethodName: "GetAudioSegment",
Handler: _MediaSetService_GetAudioSegment_Handler,
MethodName: "GetPeaksForSegment",
Handler: _MediaSetService_GetPeaksForSegment_Handler,
},
{
MethodName: "GetVideoThumbnail",
@ -286,8 +286,8 @@ var MediaSetService_ServiceDesc = grpc.ServiceDesc{
},
Streams: []grpc.StreamDesc{
{
StreamName: "GetAudio",
Handler: _MediaSetService_GetAudio_Handler,
StreamName: "GetPeaks",
Handler: _MediaSetService_GetPeaks_Handler,
ServerStreams: true,
},
{

View File

@ -16,14 +16,14 @@ import (
"go.uber.org/zap"
)
type GetAudioProgress struct {
type GetPeaksProgress struct {
PercentComplete float32
Peaks []int16
URL string
}
type GetAudioProgressReader interface {
Next() (GetAudioProgress, error)
type GetPeaksProgressReader interface {
Next() (GetPeaksProgress, error)
Close(string) error
}
@ -52,7 +52,7 @@ func newAudioGetter(store Store, youtube YoutubeClient, fileStore FileStore, con
// and audio peaks.
//
// TODO: accept domain object instead
func (g *audioGetter) GetAudio(ctx context.Context, mediaSet store.MediaSet, numBins int) (GetAudioProgressReader, error) {
func (g *audioGetter) GetAudio(ctx context.Context, mediaSet store.MediaSet, numBins int) (GetPeaksProgressReader, error) {
video, err := g.youtube.GetVideoContext(ctx, mediaSet.YoutubeID)
if err != nil {
return nil, fmt.Errorf("error fetching video: %v", err)
@ -68,14 +68,14 @@ func (g *audioGetter) GetAudio(ctx context.Context, mediaSet store.MediaSet, num
return nil, fmt.Errorf("error fetching stream: %v", err)
}
audioProgressReader, err := newGetAudioProgressReader(mediaSet.AudioFramesApprox, int(mediaSet.AudioChannels), numBins)
audioProgressReader, err := newGetPeaksProgressReader(mediaSet.AudioFramesApprox, int(mediaSet.AudioChannels), numBins)
if err != nil {
return nil, fmt.Errorf("error building progress reader: %v", err)
}
s := &audioGetterState{
audioGetter: g,
getAudioProgressReader: audioProgressReader,
getPeaksProgressReader: audioProgressReader,
}
go s.getAudio(ctx, stream, mediaSet)
@ -85,11 +85,11 @@ func (g *audioGetter) GetAudio(ctx context.Context, mediaSet store.MediaSet, num
// audioGetterState represents the state of an individual audio fetch.
type audioGetterState struct {
*audioGetter
*getAudioProgressReader
*getPeaksProgressReader
}
func (s *audioGetterState) getAudio(ctx context.Context, r io.ReadCloser, mediaSet store.MediaSet) {
streamWithProgress := newProgressReader(r, "audio", mediaSet.AudioContentLength, s.logger)
streamWithProgress := newLogProgressReader(r, "audio", mediaSet.AudioContentLength, s.logger)
pr, pw := io.Pipe()
teeReader := io.TeeReader(streamWithProgress, pw)
@ -180,10 +180,10 @@ func (s *audioGetterState) getAudio(ctx context.Context, r io.ReadCloser, mediaS
s.Close(presignedAudioURL)
}
// getAudioProgressReader accepts a byte stream containing little endian
// getPeaksProgressReader accepts a byte stream containing little endian
// signed int16s and, given a target number of bins, emits a stream of peaks
// corresponding to each channel of the audio data.
type getAudioProgressReader struct {
type getPeaksProgressReader struct {
framesExpected int64
channels int
framesPerBin int
@ -193,52 +193,52 @@ type getAudioProgressReader struct {
currCount int
framesProcessed int64
url string
progress chan GetAudioProgress
progress chan GetPeaksProgress
errorChan chan error
}
func newGetAudioProgressReader(framesExpected int64, channels, numBins int) (*getAudioProgressReader, error) {
func newGetPeaksProgressReader(framesExpected int64, channels, numBins int) (*getPeaksProgressReader, error) {
if framesExpected <= 0 || channels <= 0 || numBins <= 0 {
return nil, fmt.Errorf("error creating audio progress reader (framesExpected = %d, channels = %d, numBins = %d)", framesExpected, channels, numBins)
}
return &getAudioProgressReader{
return &getPeaksProgressReader{
channels: channels,
framesExpected: framesExpected,
framesPerBin: int(math.Ceil(float64(framesExpected) / float64(numBins))),
samples: make([]int16, 8_192),
currPeaks: make([]int16, channels),
progress: make(chan GetAudioProgress),
progress: make(chan GetPeaksProgress),
errorChan: make(chan error, 1),
}, nil
}
func (w *getAudioProgressReader) CloseWithError(err error) {
func (w *getPeaksProgressReader) CloseWithError(err error) {
w.errorChan <- err
}
// Close cloes the reader and returns the provided URL to the calling code.
func (w *getAudioProgressReader) Close(url string) error {
func (w *getPeaksProgressReader) Close(url string) error {
w.url = url
close(w.progress)
return nil
}
func (w *getAudioProgressReader) Next() (GetAudioProgress, error) {
func (w *getPeaksProgressReader) Next() (GetPeaksProgress, error) {
for {
select {
case progress, ok := <-w.progress:
if !ok {
return GetAudioProgress{Peaks: w.currPeaks, PercentComplete: w.percentComplete(), URL: w.url}, io.EOF
return GetPeaksProgress{Peaks: w.currPeaks, PercentComplete: w.percentComplete(), URL: w.url}, io.EOF
}
return progress, nil
case err := <-w.errorChan:
return GetAudioProgress{}, fmt.Errorf("error waiting for progress: %v", err)
return GetPeaksProgress{}, fmt.Errorf("error waiting for progress: %v", err)
}
}
}
func (w *getAudioProgressReader) Write(p []byte) (int, error) {
func (w *getPeaksProgressReader) Write(p []byte) (int, error) {
// expand our target slice if it is of insufficient size:
numSamples := len(p) / SizeOfInt16
if len(w.samples) < numSamples {
@ -272,12 +272,12 @@ func (w *getAudioProgressReader) Write(p []byte) (int, error) {
return len(p), nil
}
func (w *getAudioProgressReader) percentComplete() float32 {
func (w *getPeaksProgressReader) percentComplete() float32 {
return (float32(w.framesProcessed) / float32(w.framesExpected)) * 100.0
}
func (w *getAudioProgressReader) nextBin() {
var progress GetAudioProgress
func (w *getPeaksProgressReader) nextBin() {
var progress GetPeaksProgress
progress.Peaks = append(progress.Peaks, w.currPeaks...)
progress.PercentComplete = w.percentComplete()

View File

@ -50,7 +50,7 @@ func newVideoGetter(store Store, fileStore FileStore, logger *zap.SugaredLogger)
func (g *videoGetter) GetVideo(ctx context.Context, r io.Reader, exp int64, mediaSetID uuid.UUID, key, contentType string) (GetVideoProgressReader, error) {
s := &videoGetterState{
videoGetter: g,
r: newProgressReader(r, "video", exp, g.logger),
r: newLogProgressReader(r, "video", exp, g.logger),
exp: exp,
mediaSetID: mediaSetID,
key: key,

View File

@ -53,7 +53,7 @@ func NewMediaSetService(store Store, youtubeClient YoutubeClient, fileStore File
// Get fetches the metadata for a given MediaSet source. If it does not exist
// in the local DB, it will attempt to create it. After the resource has been
// created, other endpoints (e.g. GetAudio) can be called to fetch media from
// created, other endpoints (e.g. GetPeaks) can be called to fetch media from
// Youtube and store it in a file store.
func (s *MediaSetService) Get(ctx context.Context, youtubeID string) (*MediaSet, error) {
var (
@ -251,7 +251,7 @@ func (s *MediaSetService) GetVideo(ctx context.Context, id uuid.UUID) (GetVideoP
}
// GetAudio fetches the audio part of a MediaSet.
func (s *MediaSetService) GetAudio(ctx context.Context, id uuid.UUID, numBins int) (GetAudioProgressReader, error) {
func (s *MediaSetService) GetPeaks(ctx context.Context, id uuid.UUID, numBins int) (GetPeaksProgressReader, error) {
mediaSet, err := s.store.GetMediaSet(ctx, id)
if err != nil {
return nil, fmt.Errorf("error getting media set: %v", err)
@ -261,24 +261,26 @@ func (s *MediaSetService) GetAudio(ctx context.Context, id uuid.UUID, numBins in
// Otherwise, we cannot return both peaks and a presigned URL for use by the
// player.
if mediaSet.AudioRawS3UploadedAt.Valid && mediaSet.AudioEncodedS3UploadedAt.Valid {
return s.getAudioFromFileStore(ctx, mediaSet, numBins)
return s.getPeaksFromFileStore(ctx, mediaSet, numBins)
}
// Fetch the audio from Youtube, calculate and store the peaks and return
// them.
return s.getAudioFromYoutube(ctx, mediaSet, numBins)
}
func (s *MediaSetService) getAudioFromYoutube(ctx context.Context, mediaSet store.MediaSet, numBins int) (GetAudioProgressReader, error) {
func (s *MediaSetService) getAudioFromYoutube(ctx context.Context, mediaSet store.MediaSet, numBins int) (GetPeaksProgressReader, error) {
audioGetter := newAudioGetter(s.store, s.youtube, s.fileStore, s.config, s.logger)
return audioGetter.GetAudio(ctx, mediaSet, numBins)
}
func (s *MediaSetService) getAudioFromFileStore(ctx context.Context, mediaSet store.MediaSet, numBins int) (GetAudioProgressReader, error) {
func (s *MediaSetService) getPeaksFromFileStore(ctx context.Context, mediaSet store.MediaSet, numBins int) (GetPeaksProgressReader, error) {
object, err := s.fileStore.GetObject(ctx, mediaSet.AudioRawS3Key.String)
if err != nil {
return nil, fmt.Errorf("error getting object from file store: %v", err)
}
getAudioProgressReader, err := newGetAudioProgressReader(
getPeaksProgressReader, err := newGetPeaksProgressReader(
int64(mediaSet.AudioFrames.Int64),
int(mediaSet.AudioChannels),
numBins,
@ -287,8 +289,8 @@ func (s *MediaSetService) getAudioFromFileStore(ctx context.Context, mediaSet st
return nil, fmt.Errorf("error creating audio reader: %v", err)
}
state := getAudioFromFileStoreState{
getAudioProgressReader: getAudioProgressReader,
state := getPeaksFromFileStoreState{
getPeaksProgressReader: getPeaksProgressReader,
reader: NewModuloBufReader(object, int(mediaSet.AudioChannels)*SizeOfInt16),
fileStore: s.fileStore,
config: s.config,
@ -299,8 +301,8 @@ func (s *MediaSetService) getAudioFromFileStore(ctx context.Context, mediaSet st
return &state, nil
}
type getAudioFromFileStoreState struct {
*getAudioProgressReader
type getPeaksFromFileStoreState struct {
*getPeaksProgressReader
reader io.ReadCloser
fileStore FileStore
@ -308,7 +310,7 @@ type getAudioFromFileStoreState struct {
logger *zap.SugaredLogger
}
func (s *getAudioFromFileStoreState) run(ctx context.Context, mediaSet store.MediaSet) {
func (s *getPeaksFromFileStoreState) run(ctx context.Context, mediaSet store.MediaSet) {
done := make(chan error)
var err error
@ -350,7 +352,7 @@ outer:
}
}
func (s *MediaSetService) GetAudioSegment(ctx context.Context, id uuid.UUID, startFrame, endFrame int64, numBins int) ([]int16, error) {
func (s *MediaSetService) GetPeaksForSegment(ctx context.Context, id uuid.UUID, startFrame, endFrame int64, numBins int) ([]int16, error) {
if startFrame < 0 || endFrame < 0 || numBins <= 0 {
s.logger.With("startFrame", startFrame, "endFrame", endFrame, "numBins", numBins).Error("invalid arguments")
return nil, errors.New("invalid arguments")
@ -569,23 +571,23 @@ func (s *MediaSetService) getThumbnailFromYoutube(ctx context.Context, mediaSet
return VideoThumbnail{Width: int(thumbnail.Width), Height: int(thumbnail.Height), Data: imageData}, nil
}
// progressReader is a reader that prints progress logs as it reads.
type progressReader struct {
// logProgressReader is a reader that prints progress logs as it reads.
type logProgressReader struct {
io.Reader
total, exp int64
logger *zap.SugaredLogger
}
func newProgressReader(reader io.Reader, label string, exp int64, logger *zap.SugaredLogger) *progressReader {
return &progressReader{
func newLogProgressReader(reader io.Reader, label string, exp int64, logger *zap.SugaredLogger) *logProgressReader {
return &logProgressReader{
Reader: reader,
exp: exp,
logger: logger.Named(label),
}
}
func (r *progressReader) Read(p []byte) (int, error) {
func (r *logProgressReader) Read(p []byte) (int, error) {
n, err := r.Reader.Read(p)
r.total += int64(n)

View File

@ -19,7 +19,7 @@ import (
"go.uber.org/zap"
)
func TestGetAudioSegment(t *testing.T) {
func TestPeaksForSegment(t *testing.T) {
testCases := []struct {
name string
fixturePath string
@ -111,7 +111,7 @@ func TestGetAudioSegment(t *testing.T) {
Return(audioData, nil)
service := media.NewMediaSetService(store, nil, fileStore, config.Config{}, zap.NewNop().Sugar())
peaks, err := service.GetAudioSegment(context.Background(), mediaSet.ID, tc.startFrame, tc.endFrame, tc.numBins)
peaks, err := service.GetPeaksForSegment(context.Background(), mediaSet.ID, tc.startFrame, tc.endFrame, tc.numBins)
if tc.wantErr == "" {
assert.NoError(t, err)
@ -123,7 +123,7 @@ func TestGetAudioSegment(t *testing.T) {
}
}
func BenchmarkGetAudioSegment(b *testing.B) {
func BenchmarkGetPeaksForSegment(b *testing.B) {
const (
startFrame = 0
endFrame = 1323000
@ -156,7 +156,7 @@ func BenchmarkGetAudioSegment(b *testing.B) {
service := media.NewMediaSetService(store, nil, fileStore, config.Config{}, zap.NewNop().Sugar())
b.StartTimer()
_, err = service.GetAudioSegment(context.Background(), mediaSetID, startFrame, endFrame, numBins)
_, err = service.GetPeaksForSegment(context.Background(), mediaSetID, startFrame, endFrame, numBins)
require.NoError(b, err)
}
}

View File

@ -33,9 +33,9 @@ const (
)
const (
getAudioTimeout = time.Minute * 5
getAudioSegmentTimeout = time.Second * 10
getVideoTimeout = time.Minute * 5
getPeaksTimeout = time.Minute * 5
getPeaksForSegmentTimeout = time.Second * 10
getVideoTimeout = time.Minute * 5
)
type ResponseError struct {
@ -100,11 +100,11 @@ func (c *mediaSetServiceController) Get(ctx context.Context, request *pbmediaset
return &result, nil
}
// GetAudio returns a stream of GetAudioProgress relating to the entire audio
// GetPeaks returns a stream of GetPeaksProgress relating to the entire audio
// part of the MediaSet.
func (c *mediaSetServiceController) GetAudio(request *pbmediaset.GetAudioRequest, stream pbmediaset.MediaSetService_GetAudioServer) error {
func (c *mediaSetServiceController) GetPeaks(request *pbmediaset.GetPeaksRequest, stream pbmediaset.MediaSetService_GetPeaksServer) error {
// TODO: reduce timeout when fetching from S3
ctx, cancel := context.WithTimeout(context.Background(), getAudioTimeout)
ctx, cancel := context.WithTimeout(context.Background(), getPeaksTimeout)
defer cancel()
id, err := uuid.Parse(request.GetId())
@ -112,7 +112,7 @@ func (c *mediaSetServiceController) GetAudio(request *pbmediaset.GetAudioRequest
return newResponseError(err)
}
reader, err := c.mediaSetService.GetAudio(ctx, id, int(request.GetNumBins()))
reader, err := c.mediaSetService.GetPeaks(ctx, id, int(request.GetNumBins()))
if err != nil {
return newResponseError(err)
}
@ -128,7 +128,7 @@ func (c *mediaSetServiceController) GetAudio(request *pbmediaset.GetAudioRequest
peaks[i] = int32(p)
}
progressPb := pbmediaset.GetAudioProgress{
progressPb := pbmediaset.GetPeaksProgress{
PercentComplete: progress.PercentComplete,
Url: progress.URL,
Peaks: peaks,
@ -143,10 +143,10 @@ func (c *mediaSetServiceController) GetAudio(request *pbmediaset.GetAudioRequest
return nil
}
// GetAudioSegment returns a set of peaks for a segment of an audio part of a
// MediaSet.
func (c *mediaSetServiceController) GetAudioSegment(ctx context.Context, request *pbmediaset.GetAudioSegmentRequest) (*pbmediaset.GetAudioSegmentResponse, error) {
ctx, cancel := context.WithTimeout(ctx, getAudioSegmentTimeout)
// GetPeaksForSegment returns a set of peaks for a segment of an audio part of
// a MediaSet.
func (c *mediaSetServiceController) GetPeaksForSegment(ctx context.Context, request *pbmediaset.GetPeaksForSegmentRequest) (*pbmediaset.GetPeaksForSegmentResponse, error) {
ctx, cancel := context.WithTimeout(ctx, getPeaksForSegmentTimeout)
defer cancel()
id, err := uuid.Parse(request.GetId())
@ -154,7 +154,7 @@ func (c *mediaSetServiceController) GetAudioSegment(ctx context.Context, request
return nil, newResponseError(err)
}
peaks, err := c.mediaSetService.GetAudioSegment(ctx, id, request.StartFrame, request.EndFrame, int(request.GetNumBins()))
peaks, err := c.mediaSetService.GetPeaksForSegment(ctx, id, request.StartFrame, request.EndFrame, int(request.GetNumBins()))
if err != nil {
return nil, newResponseError(err)
}
@ -164,11 +164,7 @@ func (c *mediaSetServiceController) GetAudioSegment(ctx context.Context, request
peaks32[i] = int32(p)
}
response := pbmediaset.GetAudioSegmentResponse{
Peaks: peaks32,
}
return &response, nil
return &pbmediaset.GetPeaksForSegmentResponse{Peaks: peaks32}, nil
}
func (c *mediaSetServiceController) GetVideo(request *pbmediaset.GetVideoRequest, stream pbmediaset.MediaSetService_GetVideoServer) error {

View File

@ -3,7 +3,7 @@ import {
GrpcWebImpl,
MediaSetServiceClientImpl,
GetVideoProgress,
GetAudioProgress,
GetPeaksProgress,
} from './generated/media_set';
import { useState, useEffect, useRef, useCallback } from 'react';
@ -120,7 +120,7 @@ function App(): JSX.Element {
}
console.log('fetching audio...');
const service = new MediaSetServiceClientImpl(newRPC());
const audioProgressStream = service.GetAudio({
const audioProgressStream = service.GetPeaks({
id: mediaSet.id,
numBins: CanvasLogicalWidth,
});
@ -128,7 +128,7 @@ function App(): JSX.Element {
setOverviewPeaks(peaks);
const pipe = audioProgressStream.pipe(
first((progress: GetAudioProgress) => progress.url != '')
first((progress: GetPeaksProgress) => progress.url != '')
);
const progressWithURL = await firstValueFrom(pipe);

View File

@ -48,7 +48,7 @@ export const Waveform: React.FC<Props> = ({
console.log('fetch audio segment, frames', viewport);
const service = new MediaSetServiceClientImpl(newRPC());
const segment = await service.GetAudioSegment({
const segment = await service.GetPeaksForSegment({
id: mediaSet.id,
numBins: CanvasLogicalWidth,
startFrame: viewport.start,

View File

@ -139,7 +139,7 @@ export const Duration = {
return obj;
},
fromPartial(object: DeepPartial<Duration>): Duration {
fromPartial<I extends Exact<DeepPartial<Duration>, I>>(object: I): Duration {
const message = { ...baseDuration } as Duration;
message.seconds = object.seconds ?? 0;
message.nanos = object.nanos ?? 0;
@ -166,6 +166,7 @@ type Builtin =
| number
| boolean
| undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
@ -176,6 +177,14 @@ export type DeepPartial<T> = T extends Builtin
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
Exclude<keyof I, KeysOfUnion<P>>,
never
>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");

View File

@ -23,29 +23,29 @@ export interface MediaSet {
videoMimeType: string;
}
export interface GetAudioProgress {
export interface GetRequest {
youtubeId: string;
}
export interface GetPeaksRequest {
id: string;
numBins: number;
}
export interface GetPeaksProgress {
peaks: number[];
percentComplete: number;
url: string;
}
export interface GetRequest {
youtubeId: string;
}
export interface GetAudioRequest {
id: string;
numBins: number;
}
export interface GetAudioSegmentRequest {
export interface GetPeaksForSegmentRequest {
id: string;
numBins: number;
startFrame: number;
endFrame: number;
}
export interface GetAudioSegmentResponse {
export interface GetPeaksForSegmentResponse {
peaks: number[];
}
@ -245,7 +245,7 @@ export const MediaSet = {
return obj;
},
fromPartial(object: DeepPartial<MediaSet>): MediaSet {
fromPartial<I extends Exact<DeepPartial<MediaSet>, I>>(object: I): MediaSet {
const message = { ...baseMediaSet } as MediaSet;
message.id = object.id ?? "";
message.youtubeId = object.youtubeId ?? "";
@ -265,93 +265,6 @@ export const MediaSet = {
},
};
const baseGetAudioProgress: object = { peaks: 0, percentComplete: 0, url: "" };
export const GetAudioProgress = {
encode(
message: GetAudioProgress,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
writer.uint32(10).fork();
for (const v of message.peaks) {
writer.int32(v);
}
writer.ldelim();
if (message.percentComplete !== 0) {
writer.uint32(21).float(message.percentComplete);
}
if (message.url !== "") {
writer.uint32(26).string(message.url);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetAudioProgress {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseGetAudioProgress } as GetAudioProgress;
message.peaks = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if ((tag & 7) === 2) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.peaks.push(reader.int32());
}
} else {
message.peaks.push(reader.int32());
}
break;
case 2:
message.percentComplete = reader.float();
break;
case 3:
message.url = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): GetAudioProgress {
const message = { ...baseGetAudioProgress } as GetAudioProgress;
message.peaks = (object.peaks ?? []).map((e: any) => Number(e));
message.percentComplete =
object.percentComplete !== undefined && object.percentComplete !== null
? Number(object.percentComplete)
: 0;
message.url =
object.url !== undefined && object.url !== null ? String(object.url) : "";
return message;
},
toJSON(message: GetAudioProgress): unknown {
const obj: any = {};
if (message.peaks) {
obj.peaks = message.peaks.map((e) => e);
} else {
obj.peaks = [];
}
message.percentComplete !== undefined &&
(obj.percentComplete = message.percentComplete);
message.url !== undefined && (obj.url = message.url);
return obj;
},
fromPartial(object: DeepPartial<GetAudioProgress>): GetAudioProgress {
const message = { ...baseGetAudioProgress } as GetAudioProgress;
message.peaks = (object.peaks ?? []).map((e) => e);
message.percentComplete = object.percentComplete ?? 0;
message.url = object.url ?? "";
return message;
},
};
const baseGetRequest: object = { youtubeId: "" };
export const GetRequest = {
@ -398,18 +311,20 @@ export const GetRequest = {
return obj;
},
fromPartial(object: DeepPartial<GetRequest>): GetRequest {
fromPartial<I extends Exact<DeepPartial<GetRequest>, I>>(
object: I
): GetRequest {
const message = { ...baseGetRequest } as GetRequest;
message.youtubeId = object.youtubeId ?? "";
return message;
},
};
const baseGetAudioRequest: object = { id: "", numBins: 0 };
const baseGetPeaksRequest: object = { id: "", numBins: 0 };
export const GetAudioRequest = {
export const GetPeaksRequest = {
encode(
message: GetAudioRequest,
message: GetPeaksRequest,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== "") {
@ -421,10 +336,10 @@ export const GetAudioRequest = {
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetAudioRequest {
decode(input: _m0.Reader | Uint8Array, length?: number): GetPeaksRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseGetAudioRequest } as GetAudioRequest;
const message = { ...baseGetPeaksRequest } as GetPeaksRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@ -442,8 +357,8 @@ export const GetAudioRequest = {
return message;
},
fromJSON(object: any): GetAudioRequest {
const message = { ...baseGetAudioRequest } as GetAudioRequest;
fromJSON(object: any): GetPeaksRequest {
const message = { ...baseGetPeaksRequest } as GetPeaksRequest;
message.id =
object.id !== undefined && object.id !== null ? String(object.id) : "";
message.numBins =
@ -453,31 +368,122 @@ export const GetAudioRequest = {
return message;
},
toJSON(message: GetAudioRequest): unknown {
toJSON(message: GetPeaksRequest): unknown {
const obj: any = {};
message.id !== undefined && (obj.id = message.id);
message.numBins !== undefined && (obj.numBins = message.numBins);
return obj;
},
fromPartial(object: DeepPartial<GetAudioRequest>): GetAudioRequest {
const message = { ...baseGetAudioRequest } as GetAudioRequest;
fromPartial<I extends Exact<DeepPartial<GetPeaksRequest>, I>>(
object: I
): GetPeaksRequest {
const message = { ...baseGetPeaksRequest } as GetPeaksRequest;
message.id = object.id ?? "";
message.numBins = object.numBins ?? 0;
return message;
},
};
const baseGetAudioSegmentRequest: object = {
const baseGetPeaksProgress: object = { peaks: 0, percentComplete: 0, url: "" };
export const GetPeaksProgress = {
encode(
message: GetPeaksProgress,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
writer.uint32(10).fork();
for (const v of message.peaks) {
writer.int32(v);
}
writer.ldelim();
if (message.percentComplete !== 0) {
writer.uint32(21).float(message.percentComplete);
}
if (message.url !== "") {
writer.uint32(26).string(message.url);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetPeaksProgress {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseGetPeaksProgress } as GetPeaksProgress;
message.peaks = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if ((tag & 7) === 2) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.peaks.push(reader.int32());
}
} else {
message.peaks.push(reader.int32());
}
break;
case 2:
message.percentComplete = reader.float();
break;
case 3:
message.url = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): GetPeaksProgress {
const message = { ...baseGetPeaksProgress } as GetPeaksProgress;
message.peaks = (object.peaks ?? []).map((e: any) => Number(e));
message.percentComplete =
object.percentComplete !== undefined && object.percentComplete !== null
? Number(object.percentComplete)
: 0;
message.url =
object.url !== undefined && object.url !== null ? String(object.url) : "";
return message;
},
toJSON(message: GetPeaksProgress): unknown {
const obj: any = {};
if (message.peaks) {
obj.peaks = message.peaks.map((e) => e);
} else {
obj.peaks = [];
}
message.percentComplete !== undefined &&
(obj.percentComplete = message.percentComplete);
message.url !== undefined && (obj.url = message.url);
return obj;
},
fromPartial<I extends Exact<DeepPartial<GetPeaksProgress>, I>>(
object: I
): GetPeaksProgress {
const message = { ...baseGetPeaksProgress } as GetPeaksProgress;
message.peaks = object.peaks?.map((e) => e) || [];
message.percentComplete = object.percentComplete ?? 0;
message.url = object.url ?? "";
return message;
},
};
const baseGetPeaksForSegmentRequest: object = {
id: "",
numBins: 0,
startFrame: 0,
endFrame: 0,
};
export const GetAudioSegmentRequest = {
export const GetPeaksForSegmentRequest = {
encode(
message: GetAudioSegmentRequest,
message: GetPeaksForSegmentRequest,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== "") {
@ -498,10 +504,12 @@ export const GetAudioSegmentRequest = {
decode(
input: _m0.Reader | Uint8Array,
length?: number
): GetAudioSegmentRequest {
): GetPeaksForSegmentRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseGetAudioSegmentRequest } as GetAudioSegmentRequest;
const message = {
...baseGetPeaksForSegmentRequest,
} as GetPeaksForSegmentRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@ -525,8 +533,10 @@ export const GetAudioSegmentRequest = {
return message;
},
fromJSON(object: any): GetAudioSegmentRequest {
const message = { ...baseGetAudioSegmentRequest } as GetAudioSegmentRequest;
fromJSON(object: any): GetPeaksForSegmentRequest {
const message = {
...baseGetPeaksForSegmentRequest,
} as GetPeaksForSegmentRequest;
message.id =
object.id !== undefined && object.id !== null ? String(object.id) : "";
message.numBins =
@ -544,7 +554,7 @@ export const GetAudioSegmentRequest = {
return message;
},
toJSON(message: GetAudioSegmentRequest): unknown {
toJSON(message: GetPeaksForSegmentRequest): unknown {
const obj: any = {};
message.id !== undefined && (obj.id = message.id);
message.numBins !== undefined && (obj.numBins = message.numBins);
@ -553,10 +563,12 @@ export const GetAudioSegmentRequest = {
return obj;
},
fromPartial(
object: DeepPartial<GetAudioSegmentRequest>
): GetAudioSegmentRequest {
const message = { ...baseGetAudioSegmentRequest } as GetAudioSegmentRequest;
fromPartial<I extends Exact<DeepPartial<GetPeaksForSegmentRequest>, I>>(
object: I
): GetPeaksForSegmentRequest {
const message = {
...baseGetPeaksForSegmentRequest,
} as GetPeaksForSegmentRequest;
message.id = object.id ?? "";
message.numBins = object.numBins ?? 0;
message.startFrame = object.startFrame ?? 0;
@ -565,11 +577,11 @@ export const GetAudioSegmentRequest = {
},
};
const baseGetAudioSegmentResponse: object = { peaks: 0 };
const baseGetPeaksForSegmentResponse: object = { peaks: 0 };
export const GetAudioSegmentResponse = {
export const GetPeaksForSegmentResponse = {
encode(
message: GetAudioSegmentResponse,
message: GetPeaksForSegmentResponse,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
writer.uint32(10).fork();
@ -583,12 +595,12 @@ export const GetAudioSegmentResponse = {
decode(
input: _m0.Reader | Uint8Array,
length?: number
): GetAudioSegmentResponse {
): GetPeaksForSegmentResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseGetAudioSegmentResponse,
} as GetAudioSegmentResponse;
...baseGetPeaksForSegmentResponse,
} as GetPeaksForSegmentResponse;
message.peaks = [];
while (reader.pos < end) {
const tag = reader.uint32();
@ -611,15 +623,15 @@ export const GetAudioSegmentResponse = {
return message;
},
fromJSON(object: any): GetAudioSegmentResponse {
fromJSON(object: any): GetPeaksForSegmentResponse {
const message = {
...baseGetAudioSegmentResponse,
} as GetAudioSegmentResponse;
...baseGetPeaksForSegmentResponse,
} as GetPeaksForSegmentResponse;
message.peaks = (object.peaks ?? []).map((e: any) => Number(e));
return message;
},
toJSON(message: GetAudioSegmentResponse): unknown {
toJSON(message: GetPeaksForSegmentResponse): unknown {
const obj: any = {};
if (message.peaks) {
obj.peaks = message.peaks.map((e) => e);
@ -629,13 +641,13 @@ export const GetAudioSegmentResponse = {
return obj;
},
fromPartial(
object: DeepPartial<GetAudioSegmentResponse>
): GetAudioSegmentResponse {
fromPartial<I extends Exact<DeepPartial<GetPeaksForSegmentResponse>, I>>(
object: I
): GetPeaksForSegmentResponse {
const message = {
...baseGetAudioSegmentResponse,
} as GetAudioSegmentResponse;
message.peaks = (object.peaks ?? []).map((e) => e);
...baseGetPeaksForSegmentResponse,
} as GetPeaksForSegmentResponse;
message.peaks = object.peaks?.map((e) => e) || [];
return message;
},
};
@ -684,7 +696,9 @@ export const GetVideoRequest = {
return obj;
},
fromPartial(object: DeepPartial<GetVideoRequest>): GetVideoRequest {
fromPartial<I extends Exact<DeepPartial<GetVideoRequest>, I>>(
object: I
): GetVideoRequest {
const message = { ...baseGetVideoRequest } as GetVideoRequest;
message.id = object.id ?? "";
return message;
@ -747,7 +761,9 @@ export const GetVideoProgress = {
return obj;
},
fromPartial(object: DeepPartial<GetVideoProgress>): GetVideoProgress {
fromPartial<I extends Exact<DeepPartial<GetVideoProgress>, I>>(
object: I
): GetVideoProgress {
const message = { ...baseGetVideoProgress } as GetVideoProgress;
message.percentComplete = object.percentComplete ?? 0;
message.url = object.url ?? "";
@ -806,8 +822,8 @@ export const GetVideoThumbnailRequest = {
return obj;
},
fromPartial(
object: DeepPartial<GetVideoThumbnailRequest>
fromPartial<I extends Exact<DeepPartial<GetVideoThumbnailRequest>, I>>(
object: I
): GetVideoThumbnailRequest {
const message = {
...baseGetVideoThumbnailRequest,
@ -896,8 +912,8 @@ export const GetVideoThumbnailResponse = {
return obj;
},
fromPartial(
object: DeepPartial<GetVideoThumbnailResponse>
fromPartial<I extends Exact<DeepPartial<GetVideoThumbnailResponse>, I>>(
object: I
): GetVideoThumbnailResponse {
const message = {
...baseGetVideoThumbnailResponse,
@ -914,14 +930,14 @@ export interface MediaSetService {
request: DeepPartial<GetRequest>,
metadata?: grpc.Metadata
): Promise<MediaSet>;
GetAudio(
request: DeepPartial<GetAudioRequest>,
GetPeaks(
request: DeepPartial<GetPeaksRequest>,
metadata?: grpc.Metadata
): Observable<GetAudioProgress>;
GetAudioSegment(
request: DeepPartial<GetAudioSegmentRequest>,
): Observable<GetPeaksProgress>;
GetPeaksForSegment(
request: DeepPartial<GetPeaksForSegmentRequest>,
metadata?: grpc.Metadata
): Promise<GetAudioSegmentResponse>;
): Promise<GetPeaksForSegmentResponse>;
GetVideo(
request: DeepPartial<GetVideoRequest>,
metadata?: grpc.Metadata
@ -938,8 +954,8 @@ export class MediaSetServiceClientImpl implements MediaSetService {
constructor(rpc: Rpc) {
this.rpc = rpc;
this.Get = this.Get.bind(this);
this.GetAudio = this.GetAudio.bind(this);
this.GetAudioSegment = this.GetAudioSegment.bind(this);
this.GetPeaks = this.GetPeaks.bind(this);
this.GetPeaksForSegment = this.GetPeaksForSegment.bind(this);
this.GetVideo = this.GetVideo.bind(this);
this.GetVideoThumbnail = this.GetVideoThumbnail.bind(this);
}
@ -955,24 +971,24 @@ export class MediaSetServiceClientImpl implements MediaSetService {
);
}
GetAudio(
request: DeepPartial<GetAudioRequest>,
GetPeaks(
request: DeepPartial<GetPeaksRequest>,
metadata?: grpc.Metadata
): Observable<GetAudioProgress> {
): Observable<GetPeaksProgress> {
return this.rpc.invoke(
MediaSetServiceGetAudioDesc,
GetAudioRequest.fromPartial(request),
MediaSetServiceGetPeaksDesc,
GetPeaksRequest.fromPartial(request),
metadata
);
}
GetAudioSegment(
request: DeepPartial<GetAudioSegmentRequest>,
GetPeaksForSegment(
request: DeepPartial<GetPeaksForSegmentRequest>,
metadata?: grpc.Metadata
): Promise<GetAudioSegmentResponse> {
): Promise<GetPeaksForSegmentResponse> {
return this.rpc.unary(
MediaSetServiceGetAudioSegmentDesc,
GetAudioSegmentRequest.fromPartial(request),
MediaSetServiceGetPeaksForSegmentDesc,
GetPeaksForSegmentRequest.fromPartial(request),
metadata
);
}
@ -1026,20 +1042,20 @@ export const MediaSetServiceGetDesc: UnaryMethodDefinitionish = {
} as any,
};
export const MediaSetServiceGetAudioDesc: UnaryMethodDefinitionish = {
methodName: "GetAudio",
export const MediaSetServiceGetPeaksDesc: UnaryMethodDefinitionish = {
methodName: "GetPeaks",
service: MediaSetServiceDesc,
requestStream: false,
responseStream: true,
requestType: {
serializeBinary() {
return GetAudioRequest.encode(this).finish();
return GetPeaksRequest.encode(this).finish();
},
} as any,
responseType: {
deserializeBinary(data: Uint8Array) {
return {
...GetAudioProgress.decode(data),
...GetPeaksProgress.decode(data),
toObject() {
return this;
},
@ -1048,20 +1064,20 @@ export const MediaSetServiceGetAudioDesc: UnaryMethodDefinitionish = {
} as any,
};
export const MediaSetServiceGetAudioSegmentDesc: UnaryMethodDefinitionish = {
methodName: "GetAudioSegment",
export const MediaSetServiceGetPeaksForSegmentDesc: UnaryMethodDefinitionish = {
methodName: "GetPeaksForSegment",
service: MediaSetServiceDesc,
requestStream: false,
responseStream: false,
requestType: {
serializeBinary() {
return GetAudioSegmentRequest.encode(this).finish();
return GetPeaksForSegmentRequest.encode(this).finish();
},
} as any,
responseType: {
deserializeBinary(data: Uint8Array) {
return {
...GetAudioSegmentResponse.decode(data),
...GetPeaksForSegmentResponse.decode(data),
toObject() {
return this;
},
@ -1275,6 +1291,7 @@ type Builtin =
| number
| boolean
| undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
@ -1285,6 +1302,14 @@ export type DeepPartial<T> = T extends Builtin
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
Exclude<keyof I, KeysOfUnion<P>>,
never
>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");

View File

@ -17,10 +17,10 @@ var global = Function('return this')();
var google_protobuf_duration_pb = require('google-protobuf/google/protobuf/duration_pb.js');
goog.object.extend(proto, google_protobuf_duration_pb);
goog.exportSymbol('proto.media_set.GetAudioProgress', null, global);
goog.exportSymbol('proto.media_set.GetAudioRequest', null, global);
goog.exportSymbol('proto.media_set.GetAudioSegmentRequest', null, global);
goog.exportSymbol('proto.media_set.GetAudioSegmentResponse', null, global);
goog.exportSymbol('proto.media_set.GetPeaksForSegmentRequest', null, global);
goog.exportSymbol('proto.media_set.GetPeaksForSegmentResponse', null, global);
goog.exportSymbol('proto.media_set.GetPeaksProgress', null, global);
goog.exportSymbol('proto.media_set.GetPeaksRequest', null, global);
goog.exportSymbol('proto.media_set.GetRequest', null, global);
goog.exportSymbol('proto.media_set.GetVideoProgress', null, global);
goog.exportSymbol('proto.media_set.GetVideoRequest', null, global);
@ -48,27 +48,6 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.media_set.MediaSet.displayName = 'proto.media_set.MediaSet';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.media_set.GetAudioProgress = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.media_set.GetAudioProgress.repeatedFields_, null);
};
goog.inherits(proto.media_set.GetAudioProgress, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.media_set.GetAudioProgress.displayName = 'proto.media_set.GetAudioProgress';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
@ -100,16 +79,16 @@ if (goog.DEBUG && !COMPILED) {
* @extends {jspb.Message}
* @constructor
*/
proto.media_set.GetAudioRequest = function(opt_data) {
proto.media_set.GetPeaksRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.media_set.GetAudioRequest, jspb.Message);
goog.inherits(proto.media_set.GetPeaksRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.media_set.GetAudioRequest.displayName = 'proto.media_set.GetAudioRequest';
proto.media_set.GetPeaksRequest.displayName = 'proto.media_set.GetPeaksRequest';
}
/**
* Generated by JsPbCodeGenerator.
@ -121,16 +100,16 @@ if (goog.DEBUG && !COMPILED) {
* @extends {jspb.Message}
* @constructor
*/
proto.media_set.GetAudioSegmentRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
proto.media_set.GetPeaksProgress = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.media_set.GetPeaksProgress.repeatedFields_, null);
};
goog.inherits(proto.media_set.GetAudioSegmentRequest, jspb.Message);
goog.inherits(proto.media_set.GetPeaksProgress, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.media_set.GetAudioSegmentRequest.displayName = 'proto.media_set.GetAudioSegmentRequest';
proto.media_set.GetPeaksProgress.displayName = 'proto.media_set.GetPeaksProgress';
}
/**
* Generated by JsPbCodeGenerator.
@ -142,16 +121,37 @@ if (goog.DEBUG && !COMPILED) {
* @extends {jspb.Message}
* @constructor
*/
proto.media_set.GetAudioSegmentResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.media_set.GetAudioSegmentResponse.repeatedFields_, null);
proto.media_set.GetPeaksForSegmentRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.media_set.GetAudioSegmentResponse, jspb.Message);
goog.inherits(proto.media_set.GetPeaksForSegmentRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.media_set.GetAudioSegmentResponse.displayName = 'proto.media_set.GetAudioSegmentResponse';
proto.media_set.GetPeaksForSegmentRequest.displayName = 'proto.media_set.GetPeaksForSegmentRequest';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.media_set.GetPeaksForSegmentResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.media_set.GetPeaksForSegmentResponse.repeatedFields_, null);
};
goog.inherits(proto.media_set.GetPeaksForSegmentResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.media_set.GetPeaksForSegmentResponse.displayName = 'proto.media_set.GetPeaksForSegmentResponse';
}
/**
* Generated by JsPbCodeGenerator.
@ -689,224 +689,6 @@ proto.media_set.MediaSet.prototype.setVideoMimeType = function(value) {
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.media_set.GetAudioProgress.repeatedFields_ = [1];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.media_set.GetAudioProgress.prototype.toObject = function(opt_includeInstance) {
return proto.media_set.GetAudioProgress.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.media_set.GetAudioProgress} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.media_set.GetAudioProgress.toObject = function(includeInstance, msg) {
var f, obj = {
peaksList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f,
percentComplete: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0),
url: jspb.Message.getFieldWithDefault(msg, 3, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.media_set.GetAudioProgress}
*/
proto.media_set.GetAudioProgress.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.media_set.GetAudioProgress;
return proto.media_set.GetAudioProgress.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.media_set.GetAudioProgress} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.media_set.GetAudioProgress}
*/
proto.media_set.GetAudioProgress.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var values = /** @type {!Array<number>} */ (reader.isDelimited() ? reader.readPackedInt32() : [reader.readInt32()]);
for (var i = 0; i < values.length; i++) {
msg.addPeaks(values[i]);
}
break;
case 2:
var value = /** @type {number} */ (reader.readFloat());
msg.setPercentComplete(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setUrl(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.media_set.GetAudioProgress.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.media_set.GetAudioProgress.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.media_set.GetAudioProgress} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.media_set.GetAudioProgress.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPeaksList();
if (f.length > 0) {
writer.writePackedInt32(
1,
f
);
}
f = message.getPercentComplete();
if (f !== 0.0) {
writer.writeFloat(
2,
f
);
}
f = message.getUrl();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
};
/**
* repeated int32 peaks = 1;
* @return {!Array<number>}
*/
proto.media_set.GetAudioProgress.prototype.getPeaksList = function() {
return /** @type {!Array<number>} */ (jspb.Message.getRepeatedField(this, 1));
};
/**
* @param {!Array<number>} value
* @return {!proto.media_set.GetAudioProgress} returns this
*/
proto.media_set.GetAudioProgress.prototype.setPeaksList = function(value) {
return jspb.Message.setField(this, 1, value || []);
};
/**
* @param {number} value
* @param {number=} opt_index
* @return {!proto.media_set.GetAudioProgress} returns this
*/
proto.media_set.GetAudioProgress.prototype.addPeaks = function(value, opt_index) {
return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.media_set.GetAudioProgress} returns this
*/
proto.media_set.GetAudioProgress.prototype.clearPeaksList = function() {
return this.setPeaksList([]);
};
/**
* optional float percent_complete = 2;
* @return {number}
*/
proto.media_set.GetAudioProgress.prototype.getPercentComplete = function() {
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0));
};
/**
* @param {number} value
* @return {!proto.media_set.GetAudioProgress} returns this
*/
proto.media_set.GetAudioProgress.prototype.setPercentComplete = function(value) {
return jspb.Message.setProto3FloatField(this, 2, value);
};
/**
* optional string url = 3;
* @return {string}
*/
proto.media_set.GetAudioProgress.prototype.getUrl = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.media_set.GetAudioProgress} returns this
*/
proto.media_set.GetAudioProgress.prototype.setUrl = function(value) {
return jspb.Message.setProto3StringField(this, 3, value);
};
if (jspb.Message.GENERATE_TO_OBJECT) {
@ -1052,8 +834,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.media_set.GetAudioRequest.prototype.toObject = function(opt_includeInstance) {
return proto.media_set.GetAudioRequest.toObject(opt_includeInstance, this);
proto.media_set.GetPeaksRequest.prototype.toObject = function(opt_includeInstance) {
return proto.media_set.GetPeaksRequest.toObject(opt_includeInstance, this);
};
@ -1062,11 +844,11 @@ proto.media_set.GetAudioRequest.prototype.toObject = function(opt_includeInstanc
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.media_set.GetAudioRequest} msg The msg instance to transform.
* @param {!proto.media_set.GetPeaksRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.media_set.GetAudioRequest.toObject = function(includeInstance, msg) {
proto.media_set.GetPeaksRequest.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, ""),
numBins: jspb.Message.getFieldWithDefault(msg, 2, 0)
@ -1083,23 +865,23 @@ proto.media_set.GetAudioRequest.toObject = function(includeInstance, msg) {
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.media_set.GetAudioRequest}
* @return {!proto.media_set.GetPeaksRequest}
*/
proto.media_set.GetAudioRequest.deserializeBinary = function(bytes) {
proto.media_set.GetPeaksRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.media_set.GetAudioRequest;
return proto.media_set.GetAudioRequest.deserializeBinaryFromReader(msg, reader);
var msg = new proto.media_set.GetPeaksRequest;
return proto.media_set.GetPeaksRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.media_set.GetAudioRequest} msg The message object to deserialize into.
* @param {!proto.media_set.GetPeaksRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.media_set.GetAudioRequest}
* @return {!proto.media_set.GetPeaksRequest}
*/
proto.media_set.GetAudioRequest.deserializeBinaryFromReader = function(msg, reader) {
proto.media_set.GetPeaksRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@ -1127,9 +909,9 @@ proto.media_set.GetAudioRequest.deserializeBinaryFromReader = function(msg, read
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.media_set.GetAudioRequest.prototype.serializeBinary = function() {
proto.media_set.GetPeaksRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.media_set.GetAudioRequest.serializeBinaryToWriter(this, writer);
proto.media_set.GetPeaksRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
@ -1137,11 +919,11 @@ proto.media_set.GetAudioRequest.prototype.serializeBinary = function() {
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.media_set.GetAudioRequest} message
* @param {!proto.media_set.GetPeaksRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.media_set.GetAudioRequest.serializeBinaryToWriter = function(message, writer) {
proto.media_set.GetPeaksRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f.length > 0) {
@ -1164,16 +946,16 @@ proto.media_set.GetAudioRequest.serializeBinaryToWriter = function(message, writ
* optional string id = 1;
* @return {string}
*/
proto.media_set.GetAudioRequest.prototype.getId = function() {
proto.media_set.GetPeaksRequest.prototype.getId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.media_set.GetAudioRequest} returns this
* @return {!proto.media_set.GetPeaksRequest} returns this
*/
proto.media_set.GetAudioRequest.prototype.setId = function(value) {
proto.media_set.GetPeaksRequest.prototype.setId = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
@ -1182,21 +964,239 @@ proto.media_set.GetAudioRequest.prototype.setId = function(value) {
* optional int32 num_bins = 2;
* @return {number}
*/
proto.media_set.GetAudioRequest.prototype.getNumBins = function() {
proto.media_set.GetPeaksRequest.prototype.getNumBins = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {number} value
* @return {!proto.media_set.GetAudioRequest} returns this
* @return {!proto.media_set.GetPeaksRequest} returns this
*/
proto.media_set.GetAudioRequest.prototype.setNumBins = function(value) {
proto.media_set.GetPeaksRequest.prototype.setNumBins = function(value) {
return jspb.Message.setProto3IntField(this, 2, value);
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.media_set.GetPeaksProgress.repeatedFields_ = [1];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.media_set.GetPeaksProgress.prototype.toObject = function(opt_includeInstance) {
return proto.media_set.GetPeaksProgress.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.media_set.GetPeaksProgress} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.media_set.GetPeaksProgress.toObject = function(includeInstance, msg) {
var f, obj = {
peaksList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f,
percentComplete: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0),
url: jspb.Message.getFieldWithDefault(msg, 3, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.media_set.GetPeaksProgress}
*/
proto.media_set.GetPeaksProgress.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.media_set.GetPeaksProgress;
return proto.media_set.GetPeaksProgress.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.media_set.GetPeaksProgress} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.media_set.GetPeaksProgress}
*/
proto.media_set.GetPeaksProgress.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var values = /** @type {!Array<number>} */ (reader.isDelimited() ? reader.readPackedInt32() : [reader.readInt32()]);
for (var i = 0; i < values.length; i++) {
msg.addPeaks(values[i]);
}
break;
case 2:
var value = /** @type {number} */ (reader.readFloat());
msg.setPercentComplete(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setUrl(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.media_set.GetPeaksProgress.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.media_set.GetPeaksProgress.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.media_set.GetPeaksProgress} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.media_set.GetPeaksProgress.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPeaksList();
if (f.length > 0) {
writer.writePackedInt32(
1,
f
);
}
f = message.getPercentComplete();
if (f !== 0.0) {
writer.writeFloat(
2,
f
);
}
f = message.getUrl();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
};
/**
* repeated int32 peaks = 1;
* @return {!Array<number>}
*/
proto.media_set.GetPeaksProgress.prototype.getPeaksList = function() {
return /** @type {!Array<number>} */ (jspb.Message.getRepeatedField(this, 1));
};
/**
* @param {!Array<number>} value
* @return {!proto.media_set.GetPeaksProgress} returns this
*/
proto.media_set.GetPeaksProgress.prototype.setPeaksList = function(value) {
return jspb.Message.setField(this, 1, value || []);
};
/**
* @param {number} value
* @param {number=} opt_index
* @return {!proto.media_set.GetPeaksProgress} returns this
*/
proto.media_set.GetPeaksProgress.prototype.addPeaks = function(value, opt_index) {
return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.media_set.GetPeaksProgress} returns this
*/
proto.media_set.GetPeaksProgress.prototype.clearPeaksList = function() {
return this.setPeaksList([]);
};
/**
* optional float percent_complete = 2;
* @return {number}
*/
proto.media_set.GetPeaksProgress.prototype.getPercentComplete = function() {
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0));
};
/**
* @param {number} value
* @return {!proto.media_set.GetPeaksProgress} returns this
*/
proto.media_set.GetPeaksProgress.prototype.setPercentComplete = function(value) {
return jspb.Message.setProto3FloatField(this, 2, value);
};
/**
* optional string url = 3;
* @return {string}
*/
proto.media_set.GetPeaksProgress.prototype.getUrl = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.media_set.GetPeaksProgress} returns this
*/
proto.media_set.GetPeaksProgress.prototype.setUrl = function(value) {
return jspb.Message.setProto3StringField(this, 3, value);
};
if (jspb.Message.GENERATE_TO_OBJECT) {
@ -1212,8 +1212,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.media_set.GetAudioSegmentRequest.prototype.toObject = function(opt_includeInstance) {
return proto.media_set.GetAudioSegmentRequest.toObject(opt_includeInstance, this);
proto.media_set.GetPeaksForSegmentRequest.prototype.toObject = function(opt_includeInstance) {
return proto.media_set.GetPeaksForSegmentRequest.toObject(opt_includeInstance, this);
};
@ -1222,11 +1222,11 @@ proto.media_set.GetAudioSegmentRequest.prototype.toObject = function(opt_include
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.media_set.GetAudioSegmentRequest} msg The msg instance to transform.
* @param {!proto.media_set.GetPeaksForSegmentRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.media_set.GetAudioSegmentRequest.toObject = function(includeInstance, msg) {
proto.media_set.GetPeaksForSegmentRequest.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, ""),
numBins: jspb.Message.getFieldWithDefault(msg, 2, 0),
@ -1245,23 +1245,23 @@ proto.media_set.GetAudioSegmentRequest.toObject = function(includeInstance, msg)
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.media_set.GetAudioSegmentRequest}
* @return {!proto.media_set.GetPeaksForSegmentRequest}
*/
proto.media_set.GetAudioSegmentRequest.deserializeBinary = function(bytes) {
proto.media_set.GetPeaksForSegmentRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.media_set.GetAudioSegmentRequest;
return proto.media_set.GetAudioSegmentRequest.deserializeBinaryFromReader(msg, reader);
var msg = new proto.media_set.GetPeaksForSegmentRequest;
return proto.media_set.GetPeaksForSegmentRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.media_set.GetAudioSegmentRequest} msg The message object to deserialize into.
* @param {!proto.media_set.GetPeaksForSegmentRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.media_set.GetAudioSegmentRequest}
* @return {!proto.media_set.GetPeaksForSegmentRequest}
*/
proto.media_set.GetAudioSegmentRequest.deserializeBinaryFromReader = function(msg, reader) {
proto.media_set.GetPeaksForSegmentRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@ -1297,9 +1297,9 @@ proto.media_set.GetAudioSegmentRequest.deserializeBinaryFromReader = function(ms
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.media_set.GetAudioSegmentRequest.prototype.serializeBinary = function() {
proto.media_set.GetPeaksForSegmentRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.media_set.GetAudioSegmentRequest.serializeBinaryToWriter(this, writer);
proto.media_set.GetPeaksForSegmentRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
@ -1307,11 +1307,11 @@ proto.media_set.GetAudioSegmentRequest.prototype.serializeBinary = function() {
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.media_set.GetAudioSegmentRequest} message
* @param {!proto.media_set.GetPeaksForSegmentRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.media_set.GetAudioSegmentRequest.serializeBinaryToWriter = function(message, writer) {
proto.media_set.GetPeaksForSegmentRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f.length > 0) {
@ -1348,16 +1348,16 @@ proto.media_set.GetAudioSegmentRequest.serializeBinaryToWriter = function(messag
* optional string id = 1;
* @return {string}
*/
proto.media_set.GetAudioSegmentRequest.prototype.getId = function() {
proto.media_set.GetPeaksForSegmentRequest.prototype.getId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.media_set.GetAudioSegmentRequest} returns this
* @return {!proto.media_set.GetPeaksForSegmentRequest} returns this
*/
proto.media_set.GetAudioSegmentRequest.prototype.setId = function(value) {
proto.media_set.GetPeaksForSegmentRequest.prototype.setId = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
@ -1366,16 +1366,16 @@ proto.media_set.GetAudioSegmentRequest.prototype.setId = function(value) {
* optional int32 num_bins = 2;
* @return {number}
*/
proto.media_set.GetAudioSegmentRequest.prototype.getNumBins = function() {
proto.media_set.GetPeaksForSegmentRequest.prototype.getNumBins = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {number} value
* @return {!proto.media_set.GetAudioSegmentRequest} returns this
* @return {!proto.media_set.GetPeaksForSegmentRequest} returns this
*/
proto.media_set.GetAudioSegmentRequest.prototype.setNumBins = function(value) {
proto.media_set.GetPeaksForSegmentRequest.prototype.setNumBins = function(value) {
return jspb.Message.setProto3IntField(this, 2, value);
};
@ -1384,16 +1384,16 @@ proto.media_set.GetAudioSegmentRequest.prototype.setNumBins = function(value) {
* optional int64 start_frame = 3;
* @return {number}
*/
proto.media_set.GetAudioSegmentRequest.prototype.getStartFrame = function() {
proto.media_set.GetPeaksForSegmentRequest.prototype.getStartFrame = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {number} value
* @return {!proto.media_set.GetAudioSegmentRequest} returns this
* @return {!proto.media_set.GetPeaksForSegmentRequest} returns this
*/
proto.media_set.GetAudioSegmentRequest.prototype.setStartFrame = function(value) {
proto.media_set.GetPeaksForSegmentRequest.prototype.setStartFrame = function(value) {
return jspb.Message.setProto3IntField(this, 3, value);
};
@ -1402,16 +1402,16 @@ proto.media_set.GetAudioSegmentRequest.prototype.setStartFrame = function(value)
* optional int64 end_frame = 4;
* @return {number}
*/
proto.media_set.GetAudioSegmentRequest.prototype.getEndFrame = function() {
proto.media_set.GetPeaksForSegmentRequest.prototype.getEndFrame = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};
/**
* @param {number} value
* @return {!proto.media_set.GetAudioSegmentRequest} returns this
* @return {!proto.media_set.GetPeaksForSegmentRequest} returns this
*/
proto.media_set.GetAudioSegmentRequest.prototype.setEndFrame = function(value) {
proto.media_set.GetPeaksForSegmentRequest.prototype.setEndFrame = function(value) {
return jspb.Message.setProto3IntField(this, 4, value);
};
@ -1422,7 +1422,7 @@ proto.media_set.GetAudioSegmentRequest.prototype.setEndFrame = function(value) {
* @private {!Array<number>}
* @const
*/
proto.media_set.GetAudioSegmentResponse.repeatedFields_ = [1];
proto.media_set.GetPeaksForSegmentResponse.repeatedFields_ = [1];
@ -1439,8 +1439,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.media_set.GetAudioSegmentResponse.prototype.toObject = function(opt_includeInstance) {
return proto.media_set.GetAudioSegmentResponse.toObject(opt_includeInstance, this);
proto.media_set.GetPeaksForSegmentResponse.prototype.toObject = function(opt_includeInstance) {
return proto.media_set.GetPeaksForSegmentResponse.toObject(opt_includeInstance, this);
};
@ -1449,11 +1449,11 @@ proto.media_set.GetAudioSegmentResponse.prototype.toObject = function(opt_includ
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.media_set.GetAudioSegmentResponse} msg The msg instance to transform.
* @param {!proto.media_set.GetPeaksForSegmentResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.media_set.GetAudioSegmentResponse.toObject = function(includeInstance, msg) {
proto.media_set.GetPeaksForSegmentResponse.toObject = function(includeInstance, msg) {
var f, obj = {
peaksList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f
};
@ -1469,23 +1469,23 @@ proto.media_set.GetAudioSegmentResponse.toObject = function(includeInstance, msg
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.media_set.GetAudioSegmentResponse}
* @return {!proto.media_set.GetPeaksForSegmentResponse}
*/
proto.media_set.GetAudioSegmentResponse.deserializeBinary = function(bytes) {
proto.media_set.GetPeaksForSegmentResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.media_set.GetAudioSegmentResponse;
return proto.media_set.GetAudioSegmentResponse.deserializeBinaryFromReader(msg, reader);
var msg = new proto.media_set.GetPeaksForSegmentResponse;
return proto.media_set.GetPeaksForSegmentResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.media_set.GetAudioSegmentResponse} msg The message object to deserialize into.
* @param {!proto.media_set.GetPeaksForSegmentResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.media_set.GetAudioSegmentResponse}
* @return {!proto.media_set.GetPeaksForSegmentResponse}
*/
proto.media_set.GetAudioSegmentResponse.deserializeBinaryFromReader = function(msg, reader) {
proto.media_set.GetPeaksForSegmentResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@ -1511,9 +1511,9 @@ proto.media_set.GetAudioSegmentResponse.deserializeBinaryFromReader = function(m
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.media_set.GetAudioSegmentResponse.prototype.serializeBinary = function() {
proto.media_set.GetPeaksForSegmentResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.media_set.GetAudioSegmentResponse.serializeBinaryToWriter(this, writer);
proto.media_set.GetPeaksForSegmentResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
@ -1521,11 +1521,11 @@ proto.media_set.GetAudioSegmentResponse.prototype.serializeBinary = function() {
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.media_set.GetAudioSegmentResponse} message
* @param {!proto.media_set.GetPeaksForSegmentResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.media_set.GetAudioSegmentResponse.serializeBinaryToWriter = function(message, writer) {
proto.media_set.GetPeaksForSegmentResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPeaksList();
if (f.length > 0) {
@ -1541,16 +1541,16 @@ proto.media_set.GetAudioSegmentResponse.serializeBinaryToWriter = function(messa
* repeated int32 peaks = 1;
* @return {!Array<number>}
*/
proto.media_set.GetAudioSegmentResponse.prototype.getPeaksList = function() {
proto.media_set.GetPeaksForSegmentResponse.prototype.getPeaksList = function() {
return /** @type {!Array<number>} */ (jspb.Message.getRepeatedField(this, 1));
};
/**
* @param {!Array<number>} value
* @return {!proto.media_set.GetAudioSegmentResponse} returns this
* @return {!proto.media_set.GetPeaksForSegmentResponse} returns this
*/
proto.media_set.GetAudioSegmentResponse.prototype.setPeaksList = function(value) {
proto.media_set.GetPeaksForSegmentResponse.prototype.setPeaksList = function(value) {
return jspb.Message.setField(this, 1, value || []);
};
@ -1558,18 +1558,18 @@ proto.media_set.GetAudioSegmentResponse.prototype.setPeaksList = function(value)
/**
* @param {number} value
* @param {number=} opt_index
* @return {!proto.media_set.GetAudioSegmentResponse} returns this
* @return {!proto.media_set.GetPeaksForSegmentResponse} returns this
*/
proto.media_set.GetAudioSegmentResponse.prototype.addPeaks = function(value, opt_index) {
proto.media_set.GetPeaksForSegmentResponse.prototype.addPeaks = function(value, opt_index) {
return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.media_set.GetAudioSegmentResponse} returns this
* @return {!proto.media_set.GetPeaksForSegmentResponse} returns this
*/
proto.media_set.GetAudioSegmentResponse.prototype.clearPeaksList = function() {
proto.media_set.GetPeaksForSegmentResponse.prototype.clearPeaksList = function() {
return this.setPeaksList([]);
};

View File

@ -23,29 +23,29 @@ message MediaSet {
string video_mime_type = 11;
};
message GetAudioProgress {
message GetRequest {
string youtube_id = 1;
}
message GetPeaksRequest {
string id = 1;
int32 num_bins = 2;
}
message GetPeaksProgress {
repeated int32 peaks = 1;
float percent_complete = 2;
string url = 3;
}
message GetRequest {
string youtube_id = 1;
}
message GetAudioRequest {
string id = 1;
int32 num_bins = 2;
}
message GetAudioSegmentRequest {
message GetPeaksForSegmentRequest {
string id = 1;
int32 num_bins = 2;
int64 start_frame = 3;
int64 end_frame = 4;
}
message GetAudioSegmentResponse {
message GetPeaksForSegmentResponse {
repeated int32 peaks = 1;
}
@ -53,7 +53,6 @@ message GetVideoRequest {
string id = 1;
}
message GetVideoProgress {
float percent_complete = 1;
string url = 2;
@ -71,8 +70,8 @@ message GetVideoThumbnailResponse {
service MediaSetService {
rpc Get(GetRequest) returns (MediaSet) {}
rpc GetAudio(GetAudioRequest) returns (stream GetAudioProgress) {}
rpc GetAudioSegment(GetAudioSegmentRequest) returns (GetAudioSegmentResponse) {}
rpc GetPeaks(GetPeaksRequest) returns (stream GetPeaksProgress) {}
rpc GetPeaksForSegment(GetPeaksForSegmentRequest) returns (GetPeaksForSegmentResponse) {}
rpc GetVideo(GetVideoRequest) returns (stream GetVideoProgress) {}
rpc GetVideoThumbnail(GetVideoThumbnailRequest) returns (GetVideoThumbnailResponse) {}
}