From c35206761a36d6188d3bf40d952db5f9255ab3bc Mon Sep 17 00:00:00 2001 From: Luan Date: Wed, 18 Sep 2024 16:05:01 -0300 Subject: [PATCH] feat(protos): Add remaining onesie protos --- .../video_streaming/crypto_params.ts | 188 ++ .../video_streaming/encrypted_request.ts | 238 ++ .../video_streaming/media_capabilities.ts | 416 +++ .../generated/video_streaming/media_info.ts | 735 +++++ .../video_streaming/onesie_header.ts | 417 +++ .../video_streaming/onesie_header_type.ts | 186 ++ .../onesie_innertube_request.ts | 179 ++ .../onesie_innertube_response.ts | 165 ++ .../video_streaming/onesie_request.ts | 1 - .../generated/video_streaming/proxy_status.ts | 90 + .../video_streaming/streamer_context.ts | 643 +++++ .../video_playback_abr_request.ts | 2479 +++-------------- protos/video_streaming/crypto_params.proto | 13 + .../video_streaming/encrypted_request.proto | 13 + .../video_streaming/media_capabilities.proto | 24 + protos/video_streaming/media_info.proto | 48 + protos/video_streaming/onesie_header.proto | 27 + .../video_streaming/onesie_header_type.proto | 31 + .../onesie_innertube_request.proto | 13 + .../onesie_innertube_response.proto | 12 + protos/video_streaming/onesie_request.proto | 1 - protos/video_streaming/proxy_status.proto | 15 + protos/video_streaming/streamer_context.proto | 37 + .../video_playback_abr_request.proto | 104 +- 24 files changed, 3908 insertions(+), 2167 deletions(-) create mode 100644 protos/generated/video_streaming/crypto_params.ts create mode 100644 protos/generated/video_streaming/encrypted_request.ts create mode 100644 protos/generated/video_streaming/media_capabilities.ts create mode 100644 protos/generated/video_streaming/media_info.ts create mode 100644 protos/generated/video_streaming/onesie_header.ts create mode 100644 protos/generated/video_streaming/onesie_header_type.ts create mode 100644 protos/generated/video_streaming/onesie_innertube_request.ts create mode 100644 protos/generated/video_streaming/onesie_innertube_response.ts create mode 100644 protos/generated/video_streaming/proxy_status.ts create mode 100644 protos/generated/video_streaming/streamer_context.ts create mode 100644 protos/video_streaming/crypto_params.proto create mode 100644 protos/video_streaming/encrypted_request.proto create mode 100644 protos/video_streaming/media_capabilities.proto create mode 100644 protos/video_streaming/media_info.proto create mode 100644 protos/video_streaming/onesie_header.proto create mode 100644 protos/video_streaming/onesie_header_type.proto create mode 100644 protos/video_streaming/onesie_innertube_request.proto create mode 100644 protos/video_streaming/onesie_innertube_response.proto create mode 100644 protos/video_streaming/proxy_status.proto create mode 100644 protos/video_streaming/streamer_context.proto diff --git a/protos/generated/video_streaming/crypto_params.ts b/protos/generated/video_streaming/crypto_params.ts new file mode 100644 index 0000000..a389088 --- /dev/null +++ b/protos/generated/video_streaming/crypto_params.ts @@ -0,0 +1,188 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: video_streaming/crypto_params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "video_streaming"; + +export interface CryptoParams { + hmac?: Uint8Array | undefined; + iv?: Uint8Array | undefined; + compressionType?: CryptoParams_CompressionType | undefined; +} + +export enum CryptoParams_CompressionType { + VAL_0 = 0, + VAL_1 = 1, + VAL_2 = 2, + UNRECOGNIZED = -1, +} + +export function cryptoParams_CompressionTypeFromJSON(object: any): CryptoParams_CompressionType { + switch (object) { + case 0: + case "VAL_0": + return CryptoParams_CompressionType.VAL_0; + case 1: + case "VAL_1": + return CryptoParams_CompressionType.VAL_1; + case 2: + case "VAL_2": + return CryptoParams_CompressionType.VAL_2; + case -1: + case "UNRECOGNIZED": + default: + return CryptoParams_CompressionType.UNRECOGNIZED; + } +} + +export function cryptoParams_CompressionTypeToJSON(object: CryptoParams_CompressionType): string { + switch (object) { + case CryptoParams_CompressionType.VAL_0: + return "VAL_0"; + case CryptoParams_CompressionType.VAL_1: + return "VAL_1"; + case CryptoParams_CompressionType.VAL_2: + return "VAL_2"; + case CryptoParams_CompressionType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +function createBaseCryptoParams(): CryptoParams { + return { hmac: undefined, iv: undefined, compressionType: undefined }; +} + +export const CryptoParams: MessageFns = { + encode(message: CryptoParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hmac !== undefined) { + writer.uint32(34).bytes(message.hmac); + } + if (message.iv !== undefined) { + writer.uint32(42).bytes(message.iv); + } + if (message.compressionType !== undefined) { + writer.uint32(48).int32(message.compressionType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CryptoParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCryptoParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + if (tag !== 34) { + break; + } + + message.hmac = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.iv = reader.bytes(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.compressionType = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CryptoParams { + return { + hmac: isSet(object.hmac) ? bytesFromBase64(object.hmac) : undefined, + iv: isSet(object.iv) ? bytesFromBase64(object.iv) : undefined, + compressionType: isSet(object.compressionType) + ? cryptoParams_CompressionTypeFromJSON(object.compressionType) + : undefined, + }; + }, + + toJSON(message: CryptoParams): unknown { + const obj: any = {}; + if (message.hmac !== undefined) { + obj.hmac = base64FromBytes(message.hmac); + } + if (message.iv !== undefined) { + obj.iv = base64FromBytes(message.iv); + } + if (message.compressionType !== undefined) { + obj.compressionType = cryptoParams_CompressionTypeToJSON(message.compressionType); + } + return obj; + }, + + create, I>>(base?: I): CryptoParams { + return CryptoParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CryptoParams { + const message = createBaseCryptoParams(); + message.hmac = object.hmac ?? undefined; + message.iv = object.iv ?? undefined; + message.compressionType = object.compressionType ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/protos/generated/video_streaming/encrypted_request.ts b/protos/generated/video_streaming/encrypted_request.ts new file mode 100644 index 0000000..33328b7 --- /dev/null +++ b/protos/generated/video_streaming/encrypted_request.ts @@ -0,0 +1,238 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: video_streaming/encrypted_request.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "video_streaming"; + +export interface EncryptedRequest { + encryptedOnesieRequest?: Uint8Array | undefined; + encryptedClientKey?: Uint8Array | undefined; + iv?: Uint8Array | undefined; + hmac?: Uint8Array | undefined; + YP?: boolean | undefined; + pM?: boolean | undefined; + enableCompression?: boolean | undefined; + TQ?: boolean | undefined; +} + +function createBaseEncryptedRequest(): EncryptedRequest { + return { + encryptedOnesieRequest: undefined, + encryptedClientKey: undefined, + iv: undefined, + hmac: undefined, + YP: undefined, + pM: undefined, + enableCompression: undefined, + TQ: undefined, + }; +} + +export const EncryptedRequest: MessageFns = { + encode(message: EncryptedRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encryptedOnesieRequest !== undefined) { + writer.uint32(18).bytes(message.encryptedOnesieRequest); + } + if (message.encryptedClientKey !== undefined) { + writer.uint32(42).bytes(message.encryptedClientKey); + } + if (message.iv !== undefined) { + writer.uint32(50).bytes(message.iv); + } + if (message.hmac !== undefined) { + writer.uint32(58).bytes(message.hmac); + } + if (message.YP !== undefined) { + writer.uint32(80).bool(message.YP); + } + if (message.pM !== undefined) { + writer.uint32(104).bool(message.pM); + } + if (message.enableCompression !== undefined) { + writer.uint32(112).bool(message.enableCompression); + } + if (message.TQ !== undefined) { + writer.uint32(136).bool(message.TQ); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EncryptedRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEncryptedRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.encryptedOnesieRequest = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.encryptedClientKey = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.iv = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.hmac = reader.bytes(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.YP = reader.bool(); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.pM = reader.bool(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.enableCompression = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.TQ = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EncryptedRequest { + return { + encryptedOnesieRequest: isSet(object.encryptedOnesieRequest) + ? bytesFromBase64(object.encryptedOnesieRequest) + : undefined, + encryptedClientKey: isSet(object.encryptedClientKey) ? bytesFromBase64(object.encryptedClientKey) : undefined, + iv: isSet(object.iv) ? bytesFromBase64(object.iv) : undefined, + hmac: isSet(object.hmac) ? bytesFromBase64(object.hmac) : undefined, + YP: isSet(object.YP) ? globalThis.Boolean(object.YP) : undefined, + pM: isSet(object.pM) ? globalThis.Boolean(object.pM) : undefined, + enableCompression: isSet(object.enableCompression) ? globalThis.Boolean(object.enableCompression) : undefined, + TQ: isSet(object.TQ) ? globalThis.Boolean(object.TQ) : undefined, + }; + }, + + toJSON(message: EncryptedRequest): unknown { + const obj: any = {}; + if (message.encryptedOnesieRequest !== undefined) { + obj.encryptedOnesieRequest = base64FromBytes(message.encryptedOnesieRequest); + } + if (message.encryptedClientKey !== undefined) { + obj.encryptedClientKey = base64FromBytes(message.encryptedClientKey); + } + if (message.iv !== undefined) { + obj.iv = base64FromBytes(message.iv); + } + if (message.hmac !== undefined) { + obj.hmac = base64FromBytes(message.hmac); + } + if (message.YP !== undefined) { + obj.YP = message.YP; + } + if (message.pM !== undefined) { + obj.pM = message.pM; + } + if (message.enableCompression !== undefined) { + obj.enableCompression = message.enableCompression; + } + if (message.TQ !== undefined) { + obj.TQ = message.TQ; + } + return obj; + }, + + create, I>>(base?: I): EncryptedRequest { + return EncryptedRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EncryptedRequest { + const message = createBaseEncryptedRequest(); + message.encryptedOnesieRequest = object.encryptedOnesieRequest ?? undefined; + message.encryptedClientKey = object.encryptedClientKey ?? undefined; + message.iv = object.iv ?? undefined; + message.hmac = object.hmac ?? undefined; + message.YP = object.YP ?? undefined; + message.pM = object.pM ?? undefined; + message.enableCompression = object.enableCompression ?? undefined; + message.TQ = object.TQ ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/protos/generated/video_streaming/media_capabilities.ts b/protos/generated/video_streaming/media_capabilities.ts new file mode 100644 index 0000000..f8b2769 --- /dev/null +++ b/protos/generated/video_streaming/media_capabilities.ts @@ -0,0 +1,416 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: video_streaming/media_capabilities.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "video_streaming"; + +export interface MediaCapabilities { + videoFormatCapabilities: MediaCapabilities_VideoFormatCapability[]; + audioFormatCapabilities: MediaCapabilities_AudioFormatCapability[]; + hdrModeBitmask?: number | undefined; +} + +export interface MediaCapabilities_VideoFormatCapability { + videoCodec?: number | undefined; + maxHeight?: number | undefined; + maxWidth?: number | undefined; + maxFramerate?: number | undefined; + maxBitrateBps?: number | undefined; + is10BitSupported?: boolean | undefined; +} + +export interface MediaCapabilities_AudioFormatCapability { + audioCodec?: number | undefined; + numChannels?: number | undefined; + maxBitrateBps?: number | undefined; + spatialCapabilityBitmask?: number | undefined; +} + +function createBaseMediaCapabilities(): MediaCapabilities { + return { videoFormatCapabilities: [], audioFormatCapabilities: [], hdrModeBitmask: undefined }; +} + +export const MediaCapabilities: MessageFns = { + encode(message: MediaCapabilities, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.videoFormatCapabilities) { + MediaCapabilities_VideoFormatCapability.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.audioFormatCapabilities) { + MediaCapabilities_AudioFormatCapability.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.hdrModeBitmask !== undefined) { + writer.uint32(40).int32(message.hdrModeBitmask); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MediaCapabilities { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMediaCapabilities(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.videoFormatCapabilities.push(MediaCapabilities_VideoFormatCapability.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.audioFormatCapabilities.push(MediaCapabilities_AudioFormatCapability.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.hdrModeBitmask = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MediaCapabilities { + return { + videoFormatCapabilities: globalThis.Array.isArray(object?.videoFormatCapabilities) + ? object.videoFormatCapabilities.map((e: any) => MediaCapabilities_VideoFormatCapability.fromJSON(e)) + : [], + audioFormatCapabilities: globalThis.Array.isArray(object?.audioFormatCapabilities) + ? object.audioFormatCapabilities.map((e: any) => MediaCapabilities_AudioFormatCapability.fromJSON(e)) + : [], + hdrModeBitmask: isSet(object.hdrModeBitmask) ? globalThis.Number(object.hdrModeBitmask) : undefined, + }; + }, + + toJSON(message: MediaCapabilities): unknown { + const obj: any = {}; + if (message.videoFormatCapabilities?.length) { + obj.videoFormatCapabilities = message.videoFormatCapabilities.map((e) => + MediaCapabilities_VideoFormatCapability.toJSON(e) + ); + } + if (message.audioFormatCapabilities?.length) { + obj.audioFormatCapabilities = message.audioFormatCapabilities.map((e) => + MediaCapabilities_AudioFormatCapability.toJSON(e) + ); + } + if (message.hdrModeBitmask !== undefined) { + obj.hdrModeBitmask = Math.round(message.hdrModeBitmask); + } + return obj; + }, + + create, I>>(base?: I): MediaCapabilities { + return MediaCapabilities.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MediaCapabilities { + const message = createBaseMediaCapabilities(); + message.videoFormatCapabilities = + object.videoFormatCapabilities?.map((e) => MediaCapabilities_VideoFormatCapability.fromPartial(e)) || []; + message.audioFormatCapabilities = + object.audioFormatCapabilities?.map((e) => MediaCapabilities_AudioFormatCapability.fromPartial(e)) || []; + message.hdrModeBitmask = object.hdrModeBitmask ?? undefined; + return message; + }, +}; + +function createBaseMediaCapabilities_VideoFormatCapability(): MediaCapabilities_VideoFormatCapability { + return { + videoCodec: undefined, + maxHeight: undefined, + maxWidth: undefined, + maxFramerate: undefined, + maxBitrateBps: undefined, + is10BitSupported: undefined, + }; +} + +export const MediaCapabilities_VideoFormatCapability: MessageFns = { + encode(message: MediaCapabilities_VideoFormatCapability, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.videoCodec !== undefined) { + writer.uint32(8).int32(message.videoCodec); + } + if (message.maxHeight !== undefined) { + writer.uint32(24).int32(message.maxHeight); + } + if (message.maxWidth !== undefined) { + writer.uint32(32).int32(message.maxWidth); + } + if (message.maxFramerate !== undefined) { + writer.uint32(88).int32(message.maxFramerate); + } + if (message.maxBitrateBps !== undefined) { + writer.uint32(96).int32(message.maxBitrateBps); + } + if (message.is10BitSupported !== undefined) { + writer.uint32(120).bool(message.is10BitSupported); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MediaCapabilities_VideoFormatCapability { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMediaCapabilities_VideoFormatCapability(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.videoCodec = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxHeight = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.maxWidth = reader.int32(); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.maxFramerate = reader.int32(); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.maxBitrateBps = reader.int32(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.is10BitSupported = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MediaCapabilities_VideoFormatCapability { + return { + videoCodec: isSet(object.videoCodec) ? globalThis.Number(object.videoCodec) : undefined, + maxHeight: isSet(object.maxHeight) ? globalThis.Number(object.maxHeight) : undefined, + maxWidth: isSet(object.maxWidth) ? globalThis.Number(object.maxWidth) : undefined, + maxFramerate: isSet(object.maxFramerate) ? globalThis.Number(object.maxFramerate) : undefined, + maxBitrateBps: isSet(object.maxBitrateBps) ? globalThis.Number(object.maxBitrateBps) : undefined, + is10BitSupported: isSet(object.is10BitSupported) ? globalThis.Boolean(object.is10BitSupported) : undefined, + }; + }, + + toJSON(message: MediaCapabilities_VideoFormatCapability): unknown { + const obj: any = {}; + if (message.videoCodec !== undefined) { + obj.videoCodec = Math.round(message.videoCodec); + } + if (message.maxHeight !== undefined) { + obj.maxHeight = Math.round(message.maxHeight); + } + if (message.maxWidth !== undefined) { + obj.maxWidth = Math.round(message.maxWidth); + } + if (message.maxFramerate !== undefined) { + obj.maxFramerate = Math.round(message.maxFramerate); + } + if (message.maxBitrateBps !== undefined) { + obj.maxBitrateBps = Math.round(message.maxBitrateBps); + } + if (message.is10BitSupported !== undefined) { + obj.is10BitSupported = message.is10BitSupported; + } + return obj; + }, + + create, I>>( + base?: I, + ): MediaCapabilities_VideoFormatCapability { + return MediaCapabilities_VideoFormatCapability.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MediaCapabilities_VideoFormatCapability { + const message = createBaseMediaCapabilities_VideoFormatCapability(); + message.videoCodec = object.videoCodec ?? undefined; + message.maxHeight = object.maxHeight ?? undefined; + message.maxWidth = object.maxWidth ?? undefined; + message.maxFramerate = object.maxFramerate ?? undefined; + message.maxBitrateBps = object.maxBitrateBps ?? undefined; + message.is10BitSupported = object.is10BitSupported ?? undefined; + return message; + }, +}; + +function createBaseMediaCapabilities_AudioFormatCapability(): MediaCapabilities_AudioFormatCapability { + return { + audioCodec: undefined, + numChannels: undefined, + maxBitrateBps: undefined, + spatialCapabilityBitmask: undefined, + }; +} + +export const MediaCapabilities_AudioFormatCapability: MessageFns = { + encode(message: MediaCapabilities_AudioFormatCapability, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.audioCodec !== undefined) { + writer.uint32(8).int32(message.audioCodec); + } + if (message.numChannels !== undefined) { + writer.uint32(16).int32(message.numChannels); + } + if (message.maxBitrateBps !== undefined) { + writer.uint32(24).int32(message.maxBitrateBps); + } + if (message.spatialCapabilityBitmask !== undefined) { + writer.uint32(48).int32(message.spatialCapabilityBitmask); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MediaCapabilities_AudioFormatCapability { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMediaCapabilities_AudioFormatCapability(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.audioCodec = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.numChannels = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxBitrateBps = reader.int32(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.spatialCapabilityBitmask = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MediaCapabilities_AudioFormatCapability { + return { + audioCodec: isSet(object.audioCodec) ? globalThis.Number(object.audioCodec) : undefined, + numChannels: isSet(object.numChannels) ? globalThis.Number(object.numChannels) : undefined, + maxBitrateBps: isSet(object.maxBitrateBps) ? globalThis.Number(object.maxBitrateBps) : undefined, + spatialCapabilityBitmask: isSet(object.spatialCapabilityBitmask) + ? globalThis.Number(object.spatialCapabilityBitmask) + : undefined, + }; + }, + + toJSON(message: MediaCapabilities_AudioFormatCapability): unknown { + const obj: any = {}; + if (message.audioCodec !== undefined) { + obj.audioCodec = Math.round(message.audioCodec); + } + if (message.numChannels !== undefined) { + obj.numChannels = Math.round(message.numChannels); + } + if (message.maxBitrateBps !== undefined) { + obj.maxBitrateBps = Math.round(message.maxBitrateBps); + } + if (message.spatialCapabilityBitmask !== undefined) { + obj.spatialCapabilityBitmask = Math.round(message.spatialCapabilityBitmask); + } + return obj; + }, + + create, I>>( + base?: I, + ): MediaCapabilities_AudioFormatCapability { + return MediaCapabilities_AudioFormatCapability.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MediaCapabilities_AudioFormatCapability { + const message = createBaseMediaCapabilities_AudioFormatCapability(); + message.audioCodec = object.audioCodec ?? undefined; + message.numChannels = object.numChannels ?? undefined; + message.maxBitrateBps = object.maxBitrateBps ?? undefined; + message.spatialCapabilityBitmask = object.spatialCapabilityBitmask ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/protos/generated/video_streaming/media_info.ts b/protos/generated/video_streaming/media_info.ts new file mode 100644 index 0000000..e6103fb --- /dev/null +++ b/protos/generated/video_streaming/media_info.ts @@ -0,0 +1,735 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: video_streaming/media_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { MediaCapabilities } from "./media_capabilities.js"; + +export const protobufPackage = "video_streaming"; + +export interface MediaInfo { + timeSinceLastManualFormatSelectionMs?: number | undefined; + lastManualDirection?: number | undefined; + quality?: number | undefined; + detailedNetworkType?: number | undefined; + maxWidth?: number | undefined; + maxHeight?: number | undefined; + iea?: number | undefined; + r7?: number | undefined; + startTimeMs?: number | undefined; + timeSinceLastSeek?: number | undefined; + visibility?: number | undefined; + d8?: number | undefined; + mediaCapabilities?: MediaCapabilities | undefined; + lact?: + | number + | undefined; + /** optional int32 Gw = 40; */ + mediaType?: MediaInfo_MediaType | undefined; + playerState?: number | undefined; + a8?: boolean | undefined; + Jda?: number | undefined; + qw?: number | undefined; + Ky?: number | undefined; + Eq?: number | undefined; + l?: boolean | undefined; + G7?: number | undefined; + No?: boolean | undefined; + qj?: number | undefined; + Hx?: number | undefined; + isPrefetch?: boolean | undefined; + Iz?: number | undefined; + sabrLicenseConstraint?: Uint8Array | undefined; + allowProximaLiveLatency?: number | undefined; + sabrForceProxima?: number | undefined; + Tqb?: number | undefined; + c?: number | undefined; +} + +export enum MediaInfo_MediaType { + MEDIA_TYPE_DEFAULT = 0, + MEDIA_TYPE_AUDIO = 1, + MEDIA_TYPE_VIDEO = 2, + USE_SERVER_FORMAT_FILTER = 3, + UNRECOGNIZED = -1, +} + +export function mediaInfo_MediaTypeFromJSON(object: any): MediaInfo_MediaType { + switch (object) { + case 0: + case "MEDIA_TYPE_DEFAULT": + return MediaInfo_MediaType.MEDIA_TYPE_DEFAULT; + case 1: + case "MEDIA_TYPE_AUDIO": + return MediaInfo_MediaType.MEDIA_TYPE_AUDIO; + case 2: + case "MEDIA_TYPE_VIDEO": + return MediaInfo_MediaType.MEDIA_TYPE_VIDEO; + case 3: + case "USE_SERVER_FORMAT_FILTER": + return MediaInfo_MediaType.USE_SERVER_FORMAT_FILTER; + case -1: + case "UNRECOGNIZED": + default: + return MediaInfo_MediaType.UNRECOGNIZED; + } +} + +export function mediaInfo_MediaTypeToJSON(object: MediaInfo_MediaType): string { + switch (object) { + case MediaInfo_MediaType.MEDIA_TYPE_DEFAULT: + return "MEDIA_TYPE_DEFAULT"; + case MediaInfo_MediaType.MEDIA_TYPE_AUDIO: + return "MEDIA_TYPE_AUDIO"; + case MediaInfo_MediaType.MEDIA_TYPE_VIDEO: + return "MEDIA_TYPE_VIDEO"; + case MediaInfo_MediaType.USE_SERVER_FORMAT_FILTER: + return "USE_SERVER_FORMAT_FILTER"; + case MediaInfo_MediaType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +function createBaseMediaInfo(): MediaInfo { + return { + timeSinceLastManualFormatSelectionMs: undefined, + lastManualDirection: undefined, + quality: undefined, + detailedNetworkType: undefined, + maxWidth: undefined, + maxHeight: undefined, + iea: undefined, + r7: undefined, + startTimeMs: undefined, + timeSinceLastSeek: undefined, + visibility: undefined, + d8: undefined, + mediaCapabilities: undefined, + lact: undefined, + mediaType: undefined, + playerState: undefined, + a8: undefined, + Jda: undefined, + qw: undefined, + Ky: undefined, + Eq: undefined, + l: undefined, + G7: undefined, + No: undefined, + qj: undefined, + Hx: undefined, + isPrefetch: undefined, + Iz: undefined, + sabrLicenseConstraint: undefined, + allowProximaLiveLatency: undefined, + sabrForceProxima: undefined, + Tqb: undefined, + c: undefined, + }; +} + +export const MediaInfo: MessageFns = { + encode(message: MediaInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.timeSinceLastManualFormatSelectionMs !== undefined) { + writer.uint32(104).int32(message.timeSinceLastManualFormatSelectionMs); + } + if (message.lastManualDirection !== undefined) { + writer.uint32(112).int32(message.lastManualDirection); + } + if (message.quality !== undefined) { + writer.uint32(128).int32(message.quality); + } + if (message.detailedNetworkType !== undefined) { + writer.uint32(136).int32(message.detailedNetworkType); + } + if (message.maxWidth !== undefined) { + writer.uint32(144).int32(message.maxWidth); + } + if (message.maxHeight !== undefined) { + writer.uint32(152).int32(message.maxHeight); + } + if (message.iea !== undefined) { + writer.uint32(168).int32(message.iea); + } + if (message.r7 !== undefined) { + writer.uint32(184).int32(message.r7); + } + if (message.startTimeMs !== undefined) { + writer.uint32(224).int64(message.startTimeMs); + } + if (message.timeSinceLastSeek !== undefined) { + writer.uint32(232).int64(message.timeSinceLastSeek); + } + if (message.visibility !== undefined) { + writer.uint32(272).int32(message.visibility); + } + if (message.d8 !== undefined) { + writer.uint32(288).int64(message.d8); + } + if (message.mediaCapabilities !== undefined) { + MediaCapabilities.encode(message.mediaCapabilities, writer.uint32(306).fork()).join(); + } + if (message.lact !== undefined) { + writer.uint32(312).int32(message.lact); + } + if (message.mediaType !== undefined) { + writer.uint32(320).int32(message.mediaType); + } + if (message.playerState !== undefined) { + writer.uint32(352).int32(message.playerState); + } + if (message.a8 !== undefined) { + writer.uint32(368).bool(message.a8); + } + if (message.Jda !== undefined) { + writer.uint32(384).int32(message.Jda); + } + if (message.qw !== undefined) { + writer.uint32(400).int32(message.qw); + } + if (message.Ky !== undefined) { + writer.uint32(408).int32(message.Ky); + } + if (message.Eq !== undefined) { + writer.uint32(432).int32(message.Eq); + } + if (message.l !== undefined) { + writer.uint32(448).bool(message.l); + } + if (message.G7 !== undefined) { + writer.uint32(456).int32(message.G7); + } + if (message.No !== undefined) { + writer.uint32(464).bool(message.No); + } + if (message.qj !== undefined) { + writer.uint32(472).int32(message.qj); + } + if (message.Hx !== undefined) { + writer.uint32(480).int32(message.Hx); + } + if (message.isPrefetch !== undefined) { + writer.uint32(488).bool(message.isPrefetch); + } + if (message.Iz !== undefined) { + writer.uint32(496).int32(message.Iz); + } + if (message.sabrLicenseConstraint !== undefined) { + writer.uint32(506).bytes(message.sabrLicenseConstraint); + } + if (message.allowProximaLiveLatency !== undefined) { + writer.uint32(512).int32(message.allowProximaLiveLatency); + } + if (message.sabrForceProxima !== undefined) { + writer.uint32(528).int32(message.sabrForceProxima); + } + if (message.Tqb !== undefined) { + writer.uint32(536).int32(message.Tqb); + } + if (message.c !== undefined) { + writer.uint32(544).int32(message.c); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MediaInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMediaInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 13: + if (tag !== 104) { + break; + } + + message.timeSinceLastManualFormatSelectionMs = reader.int32(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.lastManualDirection = reader.int32(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.quality = reader.int32(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.detailedNetworkType = reader.int32(); + continue; + case 18: + if (tag !== 144) { + break; + } + + message.maxWidth = reader.int32(); + continue; + case 19: + if (tag !== 152) { + break; + } + + message.maxHeight = reader.int32(); + continue; + case 21: + if (tag !== 168) { + break; + } + + message.iea = reader.int32(); + continue; + case 23: + if (tag !== 184) { + break; + } + + message.r7 = reader.int32(); + continue; + case 28: + if (tag !== 224) { + break; + } + + message.startTimeMs = longToNumber(reader.int64()); + continue; + case 29: + if (tag !== 232) { + break; + } + + message.timeSinceLastSeek = longToNumber(reader.int64()); + continue; + case 34: + if (tag !== 272) { + break; + } + + message.visibility = reader.int32(); + continue; + case 36: + if (tag !== 288) { + break; + } + + message.d8 = longToNumber(reader.int64()); + continue; + case 38: + if (tag !== 306) { + break; + } + + message.mediaCapabilities = MediaCapabilities.decode(reader, reader.uint32()); + continue; + case 39: + if (tag !== 312) { + break; + } + + message.lact = reader.int32(); + continue; + case 40: + if (tag !== 320) { + break; + } + + message.mediaType = reader.int32() as any; + continue; + case 44: + if (tag !== 352) { + break; + } + + message.playerState = reader.int32(); + continue; + case 46: + if (tag !== 368) { + break; + } + + message.a8 = reader.bool(); + continue; + case 48: + if (tag !== 384) { + break; + } + + message.Jda = reader.int32(); + continue; + case 50: + if (tag !== 400) { + break; + } + + message.qw = reader.int32(); + continue; + case 51: + if (tag !== 408) { + break; + } + + message.Ky = reader.int32(); + continue; + case 54: + if (tag !== 432) { + break; + } + + message.Eq = reader.int32(); + continue; + case 56: + if (tag !== 448) { + break; + } + + message.l = reader.bool(); + continue; + case 57: + if (tag !== 456) { + break; + } + + message.G7 = reader.int32(); + continue; + case 58: + if (tag !== 464) { + break; + } + + message.No = reader.bool(); + continue; + case 59: + if (tag !== 472) { + break; + } + + message.qj = reader.int32(); + continue; + case 60: + if (tag !== 480) { + break; + } + + message.Hx = reader.int32(); + continue; + case 61: + if (tag !== 488) { + break; + } + + message.isPrefetch = reader.bool(); + continue; + case 62: + if (tag !== 496) { + break; + } + + message.Iz = reader.int32(); + continue; + case 63: + if (tag !== 506) { + break; + } + + message.sabrLicenseConstraint = reader.bytes(); + continue; + case 64: + if (tag !== 512) { + break; + } + + message.allowProximaLiveLatency = reader.int32(); + continue; + case 66: + if (tag !== 528) { + break; + } + + message.sabrForceProxima = reader.int32(); + continue; + case 67: + if (tag !== 536) { + break; + } + + message.Tqb = reader.int32(); + continue; + case 68: + if (tag !== 544) { + break; + } + + message.c = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MediaInfo { + return { + timeSinceLastManualFormatSelectionMs: isSet(object.timeSinceLastManualFormatSelectionMs) + ? globalThis.Number(object.timeSinceLastManualFormatSelectionMs) + : undefined, + lastManualDirection: isSet(object.lastManualDirection) + ? globalThis.Number(object.lastManualDirection) + : undefined, + quality: isSet(object.quality) ? globalThis.Number(object.quality) : undefined, + detailedNetworkType: isSet(object.detailedNetworkType) + ? globalThis.Number(object.detailedNetworkType) + : undefined, + maxWidth: isSet(object.maxWidth) ? globalThis.Number(object.maxWidth) : undefined, + maxHeight: isSet(object.maxHeight) ? globalThis.Number(object.maxHeight) : undefined, + iea: isSet(object.iea) ? globalThis.Number(object.iea) : undefined, + r7: isSet(object.r7) ? globalThis.Number(object.r7) : undefined, + startTimeMs: isSet(object.startTimeMs) ? globalThis.Number(object.startTimeMs) : undefined, + timeSinceLastSeek: isSet(object.timeSinceLastSeek) ? globalThis.Number(object.timeSinceLastSeek) : undefined, + visibility: isSet(object.visibility) ? globalThis.Number(object.visibility) : undefined, + d8: isSet(object.d8) ? globalThis.Number(object.d8) : undefined, + mediaCapabilities: isSet(object.mediaCapabilities) + ? MediaCapabilities.fromJSON(object.mediaCapabilities) + : undefined, + lact: isSet(object.lact) ? globalThis.Number(object.lact) : undefined, + mediaType: isSet(object.mediaType) ? mediaInfo_MediaTypeFromJSON(object.mediaType) : undefined, + playerState: isSet(object.playerState) ? globalThis.Number(object.playerState) : undefined, + a8: isSet(object.a8) ? globalThis.Boolean(object.a8) : undefined, + Jda: isSet(object.Jda) ? globalThis.Number(object.Jda) : undefined, + qw: isSet(object.qw) ? globalThis.Number(object.qw) : undefined, + Ky: isSet(object.Ky) ? globalThis.Number(object.Ky) : undefined, + Eq: isSet(object.Eq) ? globalThis.Number(object.Eq) : undefined, + l: isSet(object.l) ? globalThis.Boolean(object.l) : undefined, + G7: isSet(object.G7) ? globalThis.Number(object.G7) : undefined, + No: isSet(object.No) ? globalThis.Boolean(object.No) : undefined, + qj: isSet(object.qj) ? globalThis.Number(object.qj) : undefined, + Hx: isSet(object.Hx) ? globalThis.Number(object.Hx) : undefined, + isPrefetch: isSet(object.isPrefetch) ? globalThis.Boolean(object.isPrefetch) : undefined, + Iz: isSet(object.Iz) ? globalThis.Number(object.Iz) : undefined, + sabrLicenseConstraint: isSet(object.sabrLicenseConstraint) + ? bytesFromBase64(object.sabrLicenseConstraint) + : undefined, + allowProximaLiveLatency: isSet(object.allowProximaLiveLatency) + ? globalThis.Number(object.allowProximaLiveLatency) + : undefined, + sabrForceProxima: isSet(object.sabrForceProxima) ? globalThis.Number(object.sabrForceProxima) : undefined, + Tqb: isSet(object.Tqb) ? globalThis.Number(object.Tqb) : undefined, + c: isSet(object.c) ? globalThis.Number(object.c) : undefined, + }; + }, + + toJSON(message: MediaInfo): unknown { + const obj: any = {}; + if (message.timeSinceLastManualFormatSelectionMs !== undefined) { + obj.timeSinceLastManualFormatSelectionMs = Math.round(message.timeSinceLastManualFormatSelectionMs); + } + if (message.lastManualDirection !== undefined) { + obj.lastManualDirection = Math.round(message.lastManualDirection); + } + if (message.quality !== undefined) { + obj.quality = Math.round(message.quality); + } + if (message.detailedNetworkType !== undefined) { + obj.detailedNetworkType = Math.round(message.detailedNetworkType); + } + if (message.maxWidth !== undefined) { + obj.maxWidth = Math.round(message.maxWidth); + } + if (message.maxHeight !== undefined) { + obj.maxHeight = Math.round(message.maxHeight); + } + if (message.iea !== undefined) { + obj.iea = Math.round(message.iea); + } + if (message.r7 !== undefined) { + obj.r7 = Math.round(message.r7); + } + if (message.startTimeMs !== undefined) { + obj.startTimeMs = Math.round(message.startTimeMs); + } + if (message.timeSinceLastSeek !== undefined) { + obj.timeSinceLastSeek = Math.round(message.timeSinceLastSeek); + } + if (message.visibility !== undefined) { + obj.visibility = Math.round(message.visibility); + } + if (message.d8 !== undefined) { + obj.d8 = Math.round(message.d8); + } + if (message.mediaCapabilities !== undefined) { + obj.mediaCapabilities = MediaCapabilities.toJSON(message.mediaCapabilities); + } + if (message.lact !== undefined) { + obj.lact = Math.round(message.lact); + } + if (message.mediaType !== undefined) { + obj.mediaType = mediaInfo_MediaTypeToJSON(message.mediaType); + } + if (message.playerState !== undefined) { + obj.playerState = Math.round(message.playerState); + } + if (message.a8 !== undefined) { + obj.a8 = message.a8; + } + if (message.Jda !== undefined) { + obj.Jda = Math.round(message.Jda); + } + if (message.qw !== undefined) { + obj.qw = Math.round(message.qw); + } + if (message.Ky !== undefined) { + obj.Ky = Math.round(message.Ky); + } + if (message.Eq !== undefined) { + obj.Eq = Math.round(message.Eq); + } + if (message.l !== undefined) { + obj.l = message.l; + } + if (message.G7 !== undefined) { + obj.G7 = Math.round(message.G7); + } + if (message.No !== undefined) { + obj.No = message.No; + } + if (message.qj !== undefined) { + obj.qj = Math.round(message.qj); + } + if (message.Hx !== undefined) { + obj.Hx = Math.round(message.Hx); + } + if (message.isPrefetch !== undefined) { + obj.isPrefetch = message.isPrefetch; + } + if (message.Iz !== undefined) { + obj.Iz = Math.round(message.Iz); + } + if (message.sabrLicenseConstraint !== undefined) { + obj.sabrLicenseConstraint = base64FromBytes(message.sabrLicenseConstraint); + } + if (message.allowProximaLiveLatency !== undefined) { + obj.allowProximaLiveLatency = Math.round(message.allowProximaLiveLatency); + } + if (message.sabrForceProxima !== undefined) { + obj.sabrForceProxima = Math.round(message.sabrForceProxima); + } + if (message.Tqb !== undefined) { + obj.Tqb = Math.round(message.Tqb); + } + if (message.c !== undefined) { + obj.c = Math.round(message.c); + } + return obj; + }, + + create, I>>(base?: I): MediaInfo { + return MediaInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MediaInfo { + const message = createBaseMediaInfo(); + message.timeSinceLastManualFormatSelectionMs = object.timeSinceLastManualFormatSelectionMs ?? undefined; + message.lastManualDirection = object.lastManualDirection ?? undefined; + message.quality = object.quality ?? undefined; + message.detailedNetworkType = object.detailedNetworkType ?? undefined; + message.maxWidth = object.maxWidth ?? undefined; + message.maxHeight = object.maxHeight ?? undefined; + message.iea = object.iea ?? undefined; + message.r7 = object.r7 ?? undefined; + message.startTimeMs = object.startTimeMs ?? undefined; + message.timeSinceLastSeek = object.timeSinceLastSeek ?? undefined; + message.visibility = object.visibility ?? undefined; + message.d8 = object.d8 ?? undefined; + message.mediaCapabilities = (object.mediaCapabilities !== undefined && object.mediaCapabilities !== null) + ? MediaCapabilities.fromPartial(object.mediaCapabilities) + : undefined; + message.lact = object.lact ?? undefined; + message.mediaType = object.mediaType ?? undefined; + message.playerState = object.playerState ?? undefined; + message.a8 = object.a8 ?? undefined; + message.Jda = object.Jda ?? undefined; + message.qw = object.qw ?? undefined; + message.Ky = object.Ky ?? undefined; + message.Eq = object.Eq ?? undefined; + message.l = object.l ?? undefined; + message.G7 = object.G7 ?? undefined; + message.No = object.No ?? undefined; + message.qj = object.qj ?? undefined; + message.Hx = object.Hx ?? undefined; + message.isPrefetch = object.isPrefetch ?? undefined; + message.Iz = object.Iz ?? undefined; + message.sabrLicenseConstraint = object.sabrLicenseConstraint ?? undefined; + message.allowProximaLiveLatency = object.allowProximaLiveLatency ?? undefined; + message.sabrForceProxima = object.sabrForceProxima ?? undefined; + message.Tqb = object.Tqb ?? undefined; + message.c = object.c ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/protos/generated/video_streaming/onesie_header.ts b/protos/generated/video_streaming/onesie_header.ts new file mode 100644 index 0000000..336d29e --- /dev/null +++ b/protos/generated/video_streaming/onesie_header.ts @@ -0,0 +1,417 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: video_streaming/onesie_header.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { CryptoParams } from "./crypto_params.js"; +import { OnesieHeaderType, onesieHeaderTypeFromJSON, onesieHeaderTypeToJSON } from "./onesie_header_type.js"; + +export const protobufPackage = "video_streaming"; + +export interface OnesieHeader { + type?: OnesieHeaderType | undefined; + videoId?: string | undefined; + itag?: string | undefined; + cryptoParams?: CryptoParams | undefined; + lastModified?: number | undefined; + mediaSizeBytes?: number | undefined; + restrictedFormats: string[]; + xtags?: string | undefined; + sequenceNumber?: number | undefined; + field23?: OnesieHeader_Field23 | undefined; + field34?: OnesieHeader_Field34 | undefined; +} + +export interface OnesieHeader_Field23 { + videoId?: string | undefined; +} + +export interface OnesieHeader_Field34 { + itagDenylist: string[]; +} + +function createBaseOnesieHeader(): OnesieHeader { + return { + type: undefined, + videoId: undefined, + itag: undefined, + cryptoParams: undefined, + lastModified: undefined, + mediaSizeBytes: undefined, + restrictedFormats: [], + xtags: undefined, + sequenceNumber: undefined, + field23: undefined, + field34: undefined, + }; +} + +export const OnesieHeader: MessageFns = { + encode(message: OnesieHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined) { + writer.uint32(8).int32(message.type); + } + if (message.videoId !== undefined) { + writer.uint32(18).string(message.videoId); + } + if (message.itag !== undefined) { + writer.uint32(26).string(message.itag); + } + if (message.cryptoParams !== undefined) { + CryptoParams.encode(message.cryptoParams, writer.uint32(34).fork()).join(); + } + if (message.lastModified !== undefined) { + writer.uint32(40).uint64(message.lastModified); + } + if (message.mediaSizeBytes !== undefined) { + writer.uint32(56).int64(message.mediaSizeBytes); + } + for (const v of message.restrictedFormats) { + writer.uint32(90).string(v!); + } + if (message.xtags !== undefined) { + writer.uint32(122).string(message.xtags); + } + if (message.sequenceNumber !== undefined) { + writer.uint32(144).int64(message.sequenceNumber); + } + if (message.field23 !== undefined) { + OnesieHeader_Field23.encode(message.field23, writer.uint32(186).fork()).join(); + } + if (message.field34 !== undefined) { + OnesieHeader_Field34.encode(message.field34, writer.uint32(274).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OnesieHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOnesieHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.videoId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.itag = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.cryptoParams = CryptoParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.lastModified = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.mediaSizeBytes = longToNumber(reader.int64()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.restrictedFormats.push(reader.string()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.xtags = reader.string(); + continue; + case 18: + if (tag !== 144) { + break; + } + + message.sequenceNumber = longToNumber(reader.int64()); + continue; + case 23: + if (tag !== 186) { + break; + } + + message.field23 = OnesieHeader_Field23.decode(reader, reader.uint32()); + continue; + case 34: + if (tag !== 274) { + break; + } + + message.field34 = OnesieHeader_Field34.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OnesieHeader { + return { + type: isSet(object.type) ? onesieHeaderTypeFromJSON(object.type) : undefined, + videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : undefined, + itag: isSet(object.itag) ? globalThis.String(object.itag) : undefined, + cryptoParams: isSet(object.cryptoParams) ? CryptoParams.fromJSON(object.cryptoParams) : undefined, + lastModified: isSet(object.lastModified) ? globalThis.Number(object.lastModified) : undefined, + mediaSizeBytes: isSet(object.mediaSizeBytes) ? globalThis.Number(object.mediaSizeBytes) : undefined, + restrictedFormats: globalThis.Array.isArray(object?.restrictedFormats) + ? object.restrictedFormats.map((e: any) => globalThis.String(e)) + : [], + xtags: isSet(object.xtags) ? globalThis.String(object.xtags) : undefined, + sequenceNumber: isSet(object.sequenceNumber) ? globalThis.Number(object.sequenceNumber) : undefined, + field23: isSet(object.field23) ? OnesieHeader_Field23.fromJSON(object.field23) : undefined, + field34: isSet(object.field34) ? OnesieHeader_Field34.fromJSON(object.field34) : undefined, + }; + }, + + toJSON(message: OnesieHeader): unknown { + const obj: any = {}; + if (message.type !== undefined) { + obj.type = onesieHeaderTypeToJSON(message.type); + } + if (message.videoId !== undefined) { + obj.videoId = message.videoId; + } + if (message.itag !== undefined) { + obj.itag = message.itag; + } + if (message.cryptoParams !== undefined) { + obj.cryptoParams = CryptoParams.toJSON(message.cryptoParams); + } + if (message.lastModified !== undefined) { + obj.lastModified = Math.round(message.lastModified); + } + if (message.mediaSizeBytes !== undefined) { + obj.mediaSizeBytes = Math.round(message.mediaSizeBytes); + } + if (message.restrictedFormats?.length) { + obj.restrictedFormats = message.restrictedFormats; + } + if (message.xtags !== undefined) { + obj.xtags = message.xtags; + } + if (message.sequenceNumber !== undefined) { + obj.sequenceNumber = Math.round(message.sequenceNumber); + } + if (message.field23 !== undefined) { + obj.field23 = OnesieHeader_Field23.toJSON(message.field23); + } + if (message.field34 !== undefined) { + obj.field34 = OnesieHeader_Field34.toJSON(message.field34); + } + return obj; + }, + + create, I>>(base?: I): OnesieHeader { + return OnesieHeader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OnesieHeader { + const message = createBaseOnesieHeader(); + message.type = object.type ?? undefined; + message.videoId = object.videoId ?? undefined; + message.itag = object.itag ?? undefined; + message.cryptoParams = (object.cryptoParams !== undefined && object.cryptoParams !== null) + ? CryptoParams.fromPartial(object.cryptoParams) + : undefined; + message.lastModified = object.lastModified ?? undefined; + message.mediaSizeBytes = object.mediaSizeBytes ?? undefined; + message.restrictedFormats = object.restrictedFormats?.map((e) => e) || []; + message.xtags = object.xtags ?? undefined; + message.sequenceNumber = object.sequenceNumber ?? undefined; + message.field23 = (object.field23 !== undefined && object.field23 !== null) + ? OnesieHeader_Field23.fromPartial(object.field23) + : undefined; + message.field34 = (object.field34 !== undefined && object.field34 !== null) + ? OnesieHeader_Field34.fromPartial(object.field34) + : undefined; + return message; + }, +}; + +function createBaseOnesieHeader_Field23(): OnesieHeader_Field23 { + return { videoId: undefined }; +} + +export const OnesieHeader_Field23: MessageFns = { + encode(message: OnesieHeader_Field23, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.videoId !== undefined) { + writer.uint32(18).string(message.videoId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OnesieHeader_Field23 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOnesieHeader_Field23(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.videoId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OnesieHeader_Field23 { + return { videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : undefined }; + }, + + toJSON(message: OnesieHeader_Field23): unknown { + const obj: any = {}; + if (message.videoId !== undefined) { + obj.videoId = message.videoId; + } + return obj; + }, + + create, I>>(base?: I): OnesieHeader_Field23 { + return OnesieHeader_Field23.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OnesieHeader_Field23 { + const message = createBaseOnesieHeader_Field23(); + message.videoId = object.videoId ?? undefined; + return message; + }, +}; + +function createBaseOnesieHeader_Field34(): OnesieHeader_Field34 { + return { itagDenylist: [] }; +} + +export const OnesieHeader_Field34: MessageFns = { + encode(message: OnesieHeader_Field34, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.itagDenylist) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OnesieHeader_Field34 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOnesieHeader_Field34(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.itagDenylist.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OnesieHeader_Field34 { + return { + itagDenylist: globalThis.Array.isArray(object?.itagDenylist) + ? object.itagDenylist.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: OnesieHeader_Field34): unknown { + const obj: any = {}; + if (message.itagDenylist?.length) { + obj.itagDenylist = message.itagDenylist; + } + return obj; + }, + + create, I>>(base?: I): OnesieHeader_Field34 { + return OnesieHeader_Field34.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OnesieHeader_Field34 { + const message = createBaseOnesieHeader_Field34(); + message.itagDenylist = object.itagDenylist?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/protos/generated/video_streaming/onesie_header_type.ts b/protos/generated/video_streaming/onesie_header_type.ts new file mode 100644 index 0000000..20fcf00 --- /dev/null +++ b/protos/generated/video_streaming/onesie_header_type.ts @@ -0,0 +1,186 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: video_streaming/onesie_header_type.proto + +/* eslint-disable */ + +export const protobufPackage = "video_streaming"; + +export enum OnesieHeaderType { + PLAYER_RESPONSE = 0, + HEADER_TYPE_1 = 1, + MEDIA_DECRYPTION_KEY = 2, + HEADER_TYPE_3 = 3, + HEADER_TYPE_4 = 4, + HEADER_TYPE_5 = 5, + NEW_HOST = 6, + HEADER_TYPE_7 = 7, + HEADER_TYPE_8 = 8, + HEADER_TYPE_9 = 9, + HEADER_TYPE_10 = 10, + HEADER_TYPE_11 = 11, + HEADER_TYPE_12 = 12, + HEADER_TYPE_13 = 13, + RESTRICTED_FORMATS_HINT = 14, + HEADER_TYPE_15 = 15, + STREAM_METADATA = 16, + HEADER_TYPE_17 = 17, + HEADER_TYPE_18 = 18, + HEADER_TYPE_19 = 19, + HEADER_TYPE_20 = 20, + HEADER_TYPE_21 = 21, + HEADER_TYPE_22 = 22, + HEADER_TYPE_23 = 23, + HEADER_TYPE_24 = 24, + ENCRYPTED_INNERTUBE_RESPONSE_PART = 25, + UNRECOGNIZED = -1, +} + +export function onesieHeaderTypeFromJSON(object: any): OnesieHeaderType { + switch (object) { + case 0: + case "PLAYER_RESPONSE": + return OnesieHeaderType.PLAYER_RESPONSE; + case 1: + case "HEADER_TYPE_1": + return OnesieHeaderType.HEADER_TYPE_1; + case 2: + case "MEDIA_DECRYPTION_KEY": + return OnesieHeaderType.MEDIA_DECRYPTION_KEY; + case 3: + case "HEADER_TYPE_3": + return OnesieHeaderType.HEADER_TYPE_3; + case 4: + case "HEADER_TYPE_4": + return OnesieHeaderType.HEADER_TYPE_4; + case 5: + case "HEADER_TYPE_5": + return OnesieHeaderType.HEADER_TYPE_5; + case 6: + case "NEW_HOST": + return OnesieHeaderType.NEW_HOST; + case 7: + case "HEADER_TYPE_7": + return OnesieHeaderType.HEADER_TYPE_7; + case 8: + case "HEADER_TYPE_8": + return OnesieHeaderType.HEADER_TYPE_8; + case 9: + case "HEADER_TYPE_9": + return OnesieHeaderType.HEADER_TYPE_9; + case 10: + case "HEADER_TYPE_10": + return OnesieHeaderType.HEADER_TYPE_10; + case 11: + case "HEADER_TYPE_11": + return OnesieHeaderType.HEADER_TYPE_11; + case 12: + case "HEADER_TYPE_12": + return OnesieHeaderType.HEADER_TYPE_12; + case 13: + case "HEADER_TYPE_13": + return OnesieHeaderType.HEADER_TYPE_13; + case 14: + case "RESTRICTED_FORMATS_HINT": + return OnesieHeaderType.RESTRICTED_FORMATS_HINT; + case 15: + case "HEADER_TYPE_15": + return OnesieHeaderType.HEADER_TYPE_15; + case 16: + case "STREAM_METADATA": + return OnesieHeaderType.STREAM_METADATA; + case 17: + case "HEADER_TYPE_17": + return OnesieHeaderType.HEADER_TYPE_17; + case 18: + case "HEADER_TYPE_18": + return OnesieHeaderType.HEADER_TYPE_18; + case 19: + case "HEADER_TYPE_19": + return OnesieHeaderType.HEADER_TYPE_19; + case 20: + case "HEADER_TYPE_20": + return OnesieHeaderType.HEADER_TYPE_20; + case 21: + case "HEADER_TYPE_21": + return OnesieHeaderType.HEADER_TYPE_21; + case 22: + case "HEADER_TYPE_22": + return OnesieHeaderType.HEADER_TYPE_22; + case 23: + case "HEADER_TYPE_23": + return OnesieHeaderType.HEADER_TYPE_23; + case 24: + case "HEADER_TYPE_24": + return OnesieHeaderType.HEADER_TYPE_24; + case 25: + case "ENCRYPTED_INNERTUBE_RESPONSE_PART": + return OnesieHeaderType.ENCRYPTED_INNERTUBE_RESPONSE_PART; + case -1: + case "UNRECOGNIZED": + default: + return OnesieHeaderType.UNRECOGNIZED; + } +} + +export function onesieHeaderTypeToJSON(object: OnesieHeaderType): string { + switch (object) { + case OnesieHeaderType.PLAYER_RESPONSE: + return "PLAYER_RESPONSE"; + case OnesieHeaderType.HEADER_TYPE_1: + return "HEADER_TYPE_1"; + case OnesieHeaderType.MEDIA_DECRYPTION_KEY: + return "MEDIA_DECRYPTION_KEY"; + case OnesieHeaderType.HEADER_TYPE_3: + return "HEADER_TYPE_3"; + case OnesieHeaderType.HEADER_TYPE_4: + return "HEADER_TYPE_4"; + case OnesieHeaderType.HEADER_TYPE_5: + return "HEADER_TYPE_5"; + case OnesieHeaderType.NEW_HOST: + return "NEW_HOST"; + case OnesieHeaderType.HEADER_TYPE_7: + return "HEADER_TYPE_7"; + case OnesieHeaderType.HEADER_TYPE_8: + return "HEADER_TYPE_8"; + case OnesieHeaderType.HEADER_TYPE_9: + return "HEADER_TYPE_9"; + case OnesieHeaderType.HEADER_TYPE_10: + return "HEADER_TYPE_10"; + case OnesieHeaderType.HEADER_TYPE_11: + return "HEADER_TYPE_11"; + case OnesieHeaderType.HEADER_TYPE_12: + return "HEADER_TYPE_12"; + case OnesieHeaderType.HEADER_TYPE_13: + return "HEADER_TYPE_13"; + case OnesieHeaderType.RESTRICTED_FORMATS_HINT: + return "RESTRICTED_FORMATS_HINT"; + case OnesieHeaderType.HEADER_TYPE_15: + return "HEADER_TYPE_15"; + case OnesieHeaderType.STREAM_METADATA: + return "STREAM_METADATA"; + case OnesieHeaderType.HEADER_TYPE_17: + return "HEADER_TYPE_17"; + case OnesieHeaderType.HEADER_TYPE_18: + return "HEADER_TYPE_18"; + case OnesieHeaderType.HEADER_TYPE_19: + return "HEADER_TYPE_19"; + case OnesieHeaderType.HEADER_TYPE_20: + return "HEADER_TYPE_20"; + case OnesieHeaderType.HEADER_TYPE_21: + return "HEADER_TYPE_21"; + case OnesieHeaderType.HEADER_TYPE_22: + return "HEADER_TYPE_22"; + case OnesieHeaderType.HEADER_TYPE_23: + return "HEADER_TYPE_23"; + case OnesieHeaderType.HEADER_TYPE_24: + return "HEADER_TYPE_24"; + case OnesieHeaderType.ENCRYPTED_INNERTUBE_RESPONSE_PART: + return "ENCRYPTED_INNERTUBE_RESPONSE_PART"; + case OnesieHeaderType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} diff --git a/protos/generated/video_streaming/onesie_innertube_request.ts b/protos/generated/video_streaming/onesie_innertube_request.ts new file mode 100644 index 0000000..eb8b0b4 --- /dev/null +++ b/protos/generated/video_streaming/onesie_innertube_request.ts @@ -0,0 +1,179 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: video_streaming/onesie_innertube_request.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { EncryptedRequest } from "./encrypted_request.js"; +import { MediaInfo } from "./media_info.js"; +import { StreamerContext } from "./streamer_context.js"; + +export const protobufPackage = "video_streaming"; + +export interface OnesieInnertubeRequest { + mediaInfo?: MediaInfo | undefined; + encryptedRequest?: EncryptedRequest | undefined; + onesieUstreamerConfig?: Uint8Array | undefined; + streamerContext?: StreamerContext | undefined; +} + +function createBaseOnesieInnertubeRequest(): OnesieInnertubeRequest { + return { + mediaInfo: undefined, + encryptedRequest: undefined, + onesieUstreamerConfig: undefined, + streamerContext: undefined, + }; +} + +export const OnesieInnertubeRequest: MessageFns = { + encode(message: OnesieInnertubeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mediaInfo !== undefined) { + MediaInfo.encode(message.mediaInfo, writer.uint32(18).fork()).join(); + } + if (message.encryptedRequest !== undefined) { + EncryptedRequest.encode(message.encryptedRequest, writer.uint32(26).fork()).join(); + } + if (message.onesieUstreamerConfig !== undefined) { + writer.uint32(34).bytes(message.onesieUstreamerConfig); + } + if (message.streamerContext !== undefined) { + StreamerContext.encode(message.streamerContext, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OnesieInnertubeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOnesieInnertubeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.mediaInfo = MediaInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.encryptedRequest = EncryptedRequest.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.onesieUstreamerConfig = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.streamerContext = StreamerContext.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OnesieInnertubeRequest { + return { + mediaInfo: isSet(object.mediaInfo) ? MediaInfo.fromJSON(object.mediaInfo) : undefined, + encryptedRequest: isSet(object.encryptedRequest) ? EncryptedRequest.fromJSON(object.encryptedRequest) : undefined, + onesieUstreamerConfig: isSet(object.onesieUstreamerConfig) + ? bytesFromBase64(object.onesieUstreamerConfig) + : undefined, + streamerContext: isSet(object.streamerContext) ? StreamerContext.fromJSON(object.streamerContext) : undefined, + }; + }, + + toJSON(message: OnesieInnertubeRequest): unknown { + const obj: any = {}; + if (message.mediaInfo !== undefined) { + obj.mediaInfo = MediaInfo.toJSON(message.mediaInfo); + } + if (message.encryptedRequest !== undefined) { + obj.encryptedRequest = EncryptedRequest.toJSON(message.encryptedRequest); + } + if (message.onesieUstreamerConfig !== undefined) { + obj.onesieUstreamerConfig = base64FromBytes(message.onesieUstreamerConfig); + } + if (message.streamerContext !== undefined) { + obj.streamerContext = StreamerContext.toJSON(message.streamerContext); + } + return obj; + }, + + create, I>>(base?: I): OnesieInnertubeRequest { + return OnesieInnertubeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OnesieInnertubeRequest { + const message = createBaseOnesieInnertubeRequest(); + message.mediaInfo = (object.mediaInfo !== undefined && object.mediaInfo !== null) + ? MediaInfo.fromPartial(object.mediaInfo) + : undefined; + message.encryptedRequest = (object.encryptedRequest !== undefined && object.encryptedRequest !== null) + ? EncryptedRequest.fromPartial(object.encryptedRequest) + : undefined; + message.onesieUstreamerConfig = object.onesieUstreamerConfig ?? undefined; + message.streamerContext = (object.streamerContext !== undefined && object.streamerContext !== null) + ? StreamerContext.fromPartial(object.streamerContext) + : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/protos/generated/video_streaming/onesie_innertube_response.ts b/protos/generated/video_streaming/onesie_innertube_response.ts new file mode 100644 index 0000000..707a925 --- /dev/null +++ b/protos/generated/video_streaming/onesie_innertube_response.ts @@ -0,0 +1,165 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: video_streaming/onesie_innertube_response.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { HttpHeader } from "../misc/common.js"; +import { ProxyStatus, proxyStatusFromJSON, proxyStatusToJSON } from "./proxy_status.js"; + +export const protobufPackage = "video_streaming"; + +export interface OnesieInnertubeResponse { + proxyStatus?: ProxyStatus | undefined; + status?: number | undefined; + headers: HttpHeader[]; + body?: Uint8Array | undefined; +} + +function createBaseOnesieInnertubeResponse(): OnesieInnertubeResponse { + return { proxyStatus: undefined, status: undefined, headers: [], body: undefined }; +} + +export const OnesieInnertubeResponse: MessageFns = { + encode(message: OnesieInnertubeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proxyStatus !== undefined) { + writer.uint32(8).int32(message.proxyStatus); + } + if (message.status !== undefined) { + writer.uint32(16).int32(message.status); + } + for (const v of message.headers) { + HttpHeader.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.body !== undefined) { + writer.uint32(34).bytes(message.body); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OnesieInnertubeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOnesieInnertubeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proxyStatus = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.status = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.headers.push(HttpHeader.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.body = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OnesieInnertubeResponse { + return { + proxyStatus: isSet(object.proxyStatus) ? proxyStatusFromJSON(object.proxyStatus) : undefined, + status: isSet(object.status) ? globalThis.Number(object.status) : undefined, + headers: globalThis.Array.isArray(object?.headers) ? object.headers.map((e: any) => HttpHeader.fromJSON(e)) : [], + body: isSet(object.body) ? bytesFromBase64(object.body) : undefined, + }; + }, + + toJSON(message: OnesieInnertubeResponse): unknown { + const obj: any = {}; + if (message.proxyStatus !== undefined) { + obj.proxyStatus = proxyStatusToJSON(message.proxyStatus); + } + if (message.status !== undefined) { + obj.status = Math.round(message.status); + } + if (message.headers?.length) { + obj.headers = message.headers.map((e) => HttpHeader.toJSON(e)); + } + if (message.body !== undefined) { + obj.body = base64FromBytes(message.body); + } + return obj; + }, + + create, I>>(base?: I): OnesieInnertubeResponse { + return OnesieInnertubeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OnesieInnertubeResponse { + const message = createBaseOnesieInnertubeResponse(); + message.proxyStatus = object.proxyStatus ?? undefined; + message.status = object.status ?? undefined; + message.headers = object.headers?.map((e) => HttpHeader.fromPartial(e)) || []; + message.body = object.body ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/protos/generated/video_streaming/onesie_request.ts b/protos/generated/video_streaming/onesie_request.ts index f2ab07f..5556f1e 100644 --- a/protos/generated/video_streaming/onesie_request.ts +++ b/protos/generated/video_streaming/onesie_request.ts @@ -10,7 +10,6 @@ import { HttpHeader } from "../misc/common.js"; export const protobufPackage = "video_streaming"; -/** @TODO: Add the rest of the request. */ export interface OnesieRequest { url?: string | undefined; headers: HttpHeader[]; diff --git a/protos/generated/video_streaming/proxy_status.ts b/protos/generated/video_streaming/proxy_status.ts new file mode 100644 index 0000000..9cfe334 --- /dev/null +++ b/protos/generated/video_streaming/proxy_status.ts @@ -0,0 +1,90 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: video_streaming/proxy_status.proto + +/* eslint-disable */ + +export const protobufPackage = "video_streaming"; + +export enum ProxyStatus { + VAL_0 = 0, + OK = 1, + VAL_2 = 2, + VAL_3 = 3, + VAL_4 = 4, + VAL_5 = 5, + VAL_6 = 6, + VAL_7 = 7, + VAL_8 = 8, + VAL_9 = 9, + UNRECOGNIZED = -1, +} + +export function proxyStatusFromJSON(object: any): ProxyStatus { + switch (object) { + case 0: + case "VAL_0": + return ProxyStatus.VAL_0; + case 1: + case "OK": + return ProxyStatus.OK; + case 2: + case "VAL_2": + return ProxyStatus.VAL_2; + case 3: + case "VAL_3": + return ProxyStatus.VAL_3; + case 4: + case "VAL_4": + return ProxyStatus.VAL_4; + case 5: + case "VAL_5": + return ProxyStatus.VAL_5; + case 6: + case "VAL_6": + return ProxyStatus.VAL_6; + case 7: + case "VAL_7": + return ProxyStatus.VAL_7; + case 8: + case "VAL_8": + return ProxyStatus.VAL_8; + case 9: + case "VAL_9": + return ProxyStatus.VAL_9; + case -1: + case "UNRECOGNIZED": + default: + return ProxyStatus.UNRECOGNIZED; + } +} + +export function proxyStatusToJSON(object: ProxyStatus): string { + switch (object) { + case ProxyStatus.VAL_0: + return "VAL_0"; + case ProxyStatus.OK: + return "OK"; + case ProxyStatus.VAL_2: + return "VAL_2"; + case ProxyStatus.VAL_3: + return "VAL_3"; + case ProxyStatus.VAL_4: + return "VAL_4"; + case ProxyStatus.VAL_5: + return "VAL_5"; + case ProxyStatus.VAL_6: + return "VAL_6"; + case ProxyStatus.VAL_7: + return "VAL_7"; + case ProxyStatus.VAL_8: + return "VAL_8"; + case ProxyStatus.VAL_9: + return "VAL_9"; + case ProxyStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} diff --git a/protos/generated/video_streaming/streamer_context.ts b/protos/generated/video_streaming/streamer_context.ts new file mode 100644 index 0000000..c51ce7c --- /dev/null +++ b/protos/generated/video_streaming/streamer_context.ts @@ -0,0 +1,643 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: video_streaming/streamer_context.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "video_streaming"; + +export interface StreamerContext { + clientInfo?: StreamerContext_ClientInfo | undefined; + poToken?: Uint8Array | undefined; + playbackCookie?: Uint8Array | undefined; + gp?: Uint8Array | undefined; + field5: StreamerContext_Fqa[]; + field6: number[]; + field7?: string | undefined; + field8?: StreamerContext_Gqa | undefined; +} + +export interface StreamerContext_ClientInfo { + deviceMake?: string | undefined; + deviceModel?: string | undefined; + clientName?: number | undefined; + clientVersion?: string | undefined; + osName?: string | undefined; + osVersion?: string | undefined; +} + +export interface StreamerContext_Fqa { + type?: number | undefined; + value?: Uint8Array | undefined; +} + +export interface StreamerContext_Gqa { + field1?: Uint8Array | undefined; + field2?: StreamerContext_Gqa_Hqa | undefined; +} + +export interface StreamerContext_Gqa_Hqa { + code?: number | undefined; + message?: string | undefined; +} + +function createBaseStreamerContext(): StreamerContext { + return { + clientInfo: undefined, + poToken: undefined, + playbackCookie: undefined, + gp: undefined, + field5: [], + field6: [], + field7: undefined, + field8: undefined, + }; +} + +export const StreamerContext: MessageFns = { + encode(message: StreamerContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientInfo !== undefined) { + StreamerContext_ClientInfo.encode(message.clientInfo, writer.uint32(10).fork()).join(); + } + if (message.poToken !== undefined) { + writer.uint32(18).bytes(message.poToken); + } + if (message.playbackCookie !== undefined) { + writer.uint32(26).bytes(message.playbackCookie); + } + if (message.gp !== undefined) { + writer.uint32(34).bytes(message.gp); + } + for (const v of message.field5) { + StreamerContext_Fqa.encode(v!, writer.uint32(42).fork()).join(); + } + writer.uint32(50).fork(); + for (const v of message.field6) { + writer.int32(v); + } + writer.join(); + if (message.field7 !== undefined) { + writer.uint32(58).string(message.field7); + } + if (message.field8 !== undefined) { + StreamerContext_Gqa.encode(message.field8, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StreamerContext { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamerContext(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.clientInfo = StreamerContext_ClientInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.poToken = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.playbackCookie = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.gp = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.field5.push(StreamerContext_Fqa.decode(reader, reader.uint32())); + continue; + case 6: + if (tag === 48) { + message.field6.push(reader.int32()); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.field6.push(reader.int32()); + } + + continue; + } + + break; + case 7: + if (tag !== 58) { + break; + } + + message.field7 = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.field8 = StreamerContext_Gqa.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StreamerContext { + return { + clientInfo: isSet(object.clientInfo) ? StreamerContext_ClientInfo.fromJSON(object.clientInfo) : undefined, + poToken: isSet(object.poToken) ? bytesFromBase64(object.poToken) : undefined, + playbackCookie: isSet(object.playbackCookie) ? bytesFromBase64(object.playbackCookie) : undefined, + gp: isSet(object.gp) ? bytesFromBase64(object.gp) : undefined, + field5: globalThis.Array.isArray(object?.field5) + ? object.field5.map((e: any) => StreamerContext_Fqa.fromJSON(e)) + : [], + field6: globalThis.Array.isArray(object?.field6) ? object.field6.map((e: any) => globalThis.Number(e)) : [], + field7: isSet(object.field7) ? globalThis.String(object.field7) : undefined, + field8: isSet(object.field8) ? StreamerContext_Gqa.fromJSON(object.field8) : undefined, + }; + }, + + toJSON(message: StreamerContext): unknown { + const obj: any = {}; + if (message.clientInfo !== undefined) { + obj.clientInfo = StreamerContext_ClientInfo.toJSON(message.clientInfo); + } + if (message.poToken !== undefined) { + obj.poToken = base64FromBytes(message.poToken); + } + if (message.playbackCookie !== undefined) { + obj.playbackCookie = base64FromBytes(message.playbackCookie); + } + if (message.gp !== undefined) { + obj.gp = base64FromBytes(message.gp); + } + if (message.field5?.length) { + obj.field5 = message.field5.map((e) => StreamerContext_Fqa.toJSON(e)); + } + if (message.field6?.length) { + obj.field6 = message.field6.map((e) => Math.round(e)); + } + if (message.field7 !== undefined) { + obj.field7 = message.field7; + } + if (message.field8 !== undefined) { + obj.field8 = StreamerContext_Gqa.toJSON(message.field8); + } + return obj; + }, + + create, I>>(base?: I): StreamerContext { + return StreamerContext.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StreamerContext { + const message = createBaseStreamerContext(); + message.clientInfo = (object.clientInfo !== undefined && object.clientInfo !== null) + ? StreamerContext_ClientInfo.fromPartial(object.clientInfo) + : undefined; + message.poToken = object.poToken ?? undefined; + message.playbackCookie = object.playbackCookie ?? undefined; + message.gp = object.gp ?? undefined; + message.field5 = object.field5?.map((e) => StreamerContext_Fqa.fromPartial(e)) || []; + message.field6 = object.field6?.map((e) => e) || []; + message.field7 = object.field7 ?? undefined; + message.field8 = (object.field8 !== undefined && object.field8 !== null) + ? StreamerContext_Gqa.fromPartial(object.field8) + : undefined; + return message; + }, +}; + +function createBaseStreamerContext_ClientInfo(): StreamerContext_ClientInfo { + return { + deviceMake: undefined, + deviceModel: undefined, + clientName: undefined, + clientVersion: undefined, + osName: undefined, + osVersion: undefined, + }; +} + +export const StreamerContext_ClientInfo: MessageFns = { + encode(message: StreamerContext_ClientInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deviceMake !== undefined) { + writer.uint32(98).string(message.deviceMake); + } + if (message.deviceModel !== undefined) { + writer.uint32(106).string(message.deviceModel); + } + if (message.clientName !== undefined) { + writer.uint32(128).int32(message.clientName); + } + if (message.clientVersion !== undefined) { + writer.uint32(138).string(message.clientVersion); + } + if (message.osName !== undefined) { + writer.uint32(146).string(message.osName); + } + if (message.osVersion !== undefined) { + writer.uint32(154).string(message.osVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StreamerContext_ClientInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamerContext_ClientInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 12: + if (tag !== 98) { + break; + } + + message.deviceMake = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.deviceModel = reader.string(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.clientName = reader.int32(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.clientVersion = reader.string(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.osName = reader.string(); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.osVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StreamerContext_ClientInfo { + return { + deviceMake: isSet(object.deviceMake) ? globalThis.String(object.deviceMake) : undefined, + deviceModel: isSet(object.deviceModel) ? globalThis.String(object.deviceModel) : undefined, + clientName: isSet(object.clientName) ? globalThis.Number(object.clientName) : undefined, + clientVersion: isSet(object.clientVersion) ? globalThis.String(object.clientVersion) : undefined, + osName: isSet(object.osName) ? globalThis.String(object.osName) : undefined, + osVersion: isSet(object.osVersion) ? globalThis.String(object.osVersion) : undefined, + }; + }, + + toJSON(message: StreamerContext_ClientInfo): unknown { + const obj: any = {}; + if (message.deviceMake !== undefined) { + obj.deviceMake = message.deviceMake; + } + if (message.deviceModel !== undefined) { + obj.deviceModel = message.deviceModel; + } + if (message.clientName !== undefined) { + obj.clientName = Math.round(message.clientName); + } + if (message.clientVersion !== undefined) { + obj.clientVersion = message.clientVersion; + } + if (message.osName !== undefined) { + obj.osName = message.osName; + } + if (message.osVersion !== undefined) { + obj.osVersion = message.osVersion; + } + return obj; + }, + + create, I>>(base?: I): StreamerContext_ClientInfo { + return StreamerContext_ClientInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StreamerContext_ClientInfo { + const message = createBaseStreamerContext_ClientInfo(); + message.deviceMake = object.deviceMake ?? undefined; + message.deviceModel = object.deviceModel ?? undefined; + message.clientName = object.clientName ?? undefined; + message.clientVersion = object.clientVersion ?? undefined; + message.osName = object.osName ?? undefined; + message.osVersion = object.osVersion ?? undefined; + return message; + }, +}; + +function createBaseStreamerContext_Fqa(): StreamerContext_Fqa { + return { type: undefined, value: undefined }; +} + +export const StreamerContext_Fqa: MessageFns = { + encode(message: StreamerContext_Fqa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined) { + writer.uint32(8).int32(message.type); + } + if (message.value !== undefined) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StreamerContext_Fqa { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamerContext_Fqa(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StreamerContext_Fqa { + return { + type: isSet(object.type) ? globalThis.Number(object.type) : undefined, + value: isSet(object.value) ? bytesFromBase64(object.value) : undefined, + }; + }, + + toJSON(message: StreamerContext_Fqa): unknown { + const obj: any = {}; + if (message.type !== undefined) { + obj.type = Math.round(message.type); + } + if (message.value !== undefined) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): StreamerContext_Fqa { + return StreamerContext_Fqa.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StreamerContext_Fqa { + const message = createBaseStreamerContext_Fqa(); + message.type = object.type ?? undefined; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseStreamerContext_Gqa(): StreamerContext_Gqa { + return { field1: undefined, field2: undefined }; +} + +export const StreamerContext_Gqa: MessageFns = { + encode(message: StreamerContext_Gqa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.field1 !== undefined) { + writer.uint32(10).bytes(message.field1); + } + if (message.field2 !== undefined) { + StreamerContext_Gqa_Hqa.encode(message.field2, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StreamerContext_Gqa { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamerContext_Gqa(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.field1 = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.field2 = StreamerContext_Gqa_Hqa.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StreamerContext_Gqa { + return { + field1: isSet(object.field1) ? bytesFromBase64(object.field1) : undefined, + field2: isSet(object.field2) ? StreamerContext_Gqa_Hqa.fromJSON(object.field2) : undefined, + }; + }, + + toJSON(message: StreamerContext_Gqa): unknown { + const obj: any = {}; + if (message.field1 !== undefined) { + obj.field1 = base64FromBytes(message.field1); + } + if (message.field2 !== undefined) { + obj.field2 = StreamerContext_Gqa_Hqa.toJSON(message.field2); + } + return obj; + }, + + create, I>>(base?: I): StreamerContext_Gqa { + return StreamerContext_Gqa.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StreamerContext_Gqa { + const message = createBaseStreamerContext_Gqa(); + message.field1 = object.field1 ?? undefined; + message.field2 = (object.field2 !== undefined && object.field2 !== null) + ? StreamerContext_Gqa_Hqa.fromPartial(object.field2) + : undefined; + return message; + }, +}; + +function createBaseStreamerContext_Gqa_Hqa(): StreamerContext_Gqa_Hqa { + return { code: undefined, message: undefined }; +} + +export const StreamerContext_Gqa_Hqa: MessageFns = { + encode(message: StreamerContext_Gqa_Hqa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== undefined) { + writer.uint32(8).int32(message.code); + } + if (message.message !== undefined) { + writer.uint32(18).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StreamerContext_Gqa_Hqa { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamerContext_Gqa_Hqa(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StreamerContext_Gqa_Hqa { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : undefined, + message: isSet(object.message) ? globalThis.String(object.message) : undefined, + }; + }, + + toJSON(message: StreamerContext_Gqa_Hqa): unknown { + const obj: any = {}; + if (message.code !== undefined) { + obj.code = Math.round(message.code); + } + if (message.message !== undefined) { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): StreamerContext_Gqa_Hqa { + return StreamerContext_Gqa_Hqa.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StreamerContext_Gqa_Hqa { + const message = createBaseStreamerContext_Gqa_Hqa(); + message.code = object.code ?? undefined; + message.message = object.message ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/protos/generated/video_streaming/video_playback_abr_request.ts b/protos/generated/video_streaming/video_playback_abr_request.ts index af0a07d..c2fc148 100644 --- a/protos/generated/video_streaming/video_playback_abr_request.ts +++ b/protos/generated/video_streaming/video_playback_abr_request.ts @@ -7,6 +7,8 @@ /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { FormatId } from "../misc/common.js"; +import { MediaInfo } from "./media_info.js"; +import { StreamerContext } from "./streamer_context.js"; import { TimeRange } from "./time_range.js"; export const protobufPackage = "video_streaming"; @@ -19,113 +21,13 @@ export interface VideoPlaybackAbrRequest { lo?: Lo | undefined; audioFormatIds: FormatId[]; videoFormatIds: FormatId[]; - sc?: Upa | undefined; + streamerContext?: StreamerContext | undefined; field21?: OQa | undefined; field22?: number | undefined; field23?: number | undefined; field1000: Pqa[]; } -export interface MediaInfo { - timeSinceLastManualFormatSelectionMs?: number | undefined; - lastManualDirection?: number | undefined; - quality?: number | undefined; - detailedNetworkType?: number | undefined; - adjustedWidth?: number | undefined; - adjustedHeight?: number | undefined; - iea?: number | undefined; - r7?: number | undefined; - startTimeMs?: number | undefined; - timeSinceLastSeek?: number | undefined; - visibility?: number | undefined; - d8?: number | undefined; - mediaCapabilities?: MediaInfo_MediaCapabilities | undefined; - lact?: - | number - | undefined; - /** optional int32 Gw = 40; */ - mediaType?: MediaInfo_MediaType | undefined; - playerState?: number | undefined; - a8?: boolean | undefined; - Jda?: number | undefined; - qw?: number | undefined; - Ky?: number | undefined; - Eq?: number | undefined; - l?: boolean | undefined; - G7?: number | undefined; - No?: boolean | undefined; - qj?: number | undefined; - Hx?: number | undefined; - isPrefetch?: boolean | undefined; - Iz?: number | undefined; - sabrLicenseConstraint?: Uint8Array | undefined; - allowProximaLiveLatency?: number | undefined; - sabrForceProxima?: number | undefined; - Tqb?: number | undefined; - c?: number | undefined; -} - -export enum MediaInfo_MediaType { - MEDIA_TYPE_DEFAULT = 0, - MEDIA_TYPE_AUDIO = 1, - MEDIA_TYPE_VIDEO = 2, - UNRECOGNIZED = -1, -} - -export function mediaInfo_MediaTypeFromJSON(object: any): MediaInfo_MediaType { - switch (object) { - case 0: - case "MEDIA_TYPE_DEFAULT": - return MediaInfo_MediaType.MEDIA_TYPE_DEFAULT; - case 1: - case "MEDIA_TYPE_AUDIO": - return MediaInfo_MediaType.MEDIA_TYPE_AUDIO; - case 2: - case "MEDIA_TYPE_VIDEO": - return MediaInfo_MediaType.MEDIA_TYPE_VIDEO; - case -1: - case "UNRECOGNIZED": - default: - return MediaInfo_MediaType.UNRECOGNIZED; - } -} - -export function mediaInfo_MediaTypeToJSON(object: MediaInfo_MediaType): string { - switch (object) { - case MediaInfo_MediaType.MEDIA_TYPE_DEFAULT: - return "MEDIA_TYPE_DEFAULT"; - case MediaInfo_MediaType.MEDIA_TYPE_AUDIO: - return "MEDIA_TYPE_AUDIO"; - case MediaInfo_MediaType.MEDIA_TYPE_VIDEO: - return "MEDIA_TYPE_VIDEO"; - case MediaInfo_MediaType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface MediaInfo_MediaCapabilities { - videoFormatCapabilities: MediaInfo_MediaCapabilities_VideoFormatCapability[]; - audioFormatCapabilities: MediaInfo_MediaCapabilities_AudioFormatCapability[]; - hdrModeBitmask?: number | undefined; -} - -export interface MediaInfo_MediaCapabilities_VideoFormatCapability { - videoCodec?: number | undefined; - maxHeight?: number | undefined; - maxWidth?: number | undefined; - maxFramerate?: number | undefined; - maxBitrateBps?: number | undefined; - is10BitSupported?: boolean | undefined; -} - -export interface MediaInfo_MediaCapabilities_AudioFormatCapability { - audioCodec?: number | undefined; - numChannels?: number | undefined; - maxBitrateBps?: number | undefined; - spatialCapabilityBitmask?: number | undefined; -} - export interface Lo { formatId?: FormatId | undefined; Lj?: number | undefined; @@ -167,41 +69,6 @@ export interface Zpa { field12?: YPa | undefined; } -export interface Upa { - clientInfo?: Upa_ClientInfo | undefined; - poToken?: Uint8Array | undefined; - playbackCookie?: Uint8Array | undefined; - gp?: Uint8Array | undefined; - field5: Upa_Fqa[]; - field6: number[]; - field7?: string | undefined; - field8?: Upa_Gqa | undefined; -} - -export interface Upa_ClientInfo { - deviceMake?: string | undefined; - deviceModel?: string | undefined; - clientName?: number | undefined; - clientVersion?: string | undefined; - osName?: string | undefined; - osVersion?: string | undefined; -} - -export interface Upa_Fqa { - type?: number | undefined; - value?: Uint8Array | undefined; -} - -export interface Upa_Gqa { - field1?: Uint8Array | undefined; - field2?: Upa_Gqa_Hqa | undefined; -} - -export interface Upa_Gqa_Hqa { - code?: number | undefined; - message?: string | undefined; -} - export interface OQa { field1: string[]; field2?: Uint8Array | undefined; @@ -226,7 +93,7 @@ function createBaseVideoPlaybackAbrRequest(): VideoPlaybackAbrRequest { lo: undefined, audioFormatIds: [], videoFormatIds: [], - sc: undefined, + streamerContext: undefined, field21: undefined, field22: undefined, field23: undefined, @@ -257,8 +124,8 @@ export const VideoPlaybackAbrRequest: MessageFns = { for (const v of message.videoFormatIds) { FormatId.encode(v!, writer.uint32(138).fork()).join(); } - if (message.sc !== undefined) { - Upa.encode(message.sc, writer.uint32(154).fork()).join(); + if (message.streamerContext !== undefined) { + StreamerContext.encode(message.streamerContext, writer.uint32(154).fork()).join(); } if (message.field21 !== undefined) { OQa.encode(message.field21, writer.uint32(170).fork()).join(); @@ -336,7 +203,7 @@ export const VideoPlaybackAbrRequest: MessageFns = { break; } - message.sc = Upa.decode(reader, reader.uint32()); + message.streamerContext = StreamerContext.decode(reader, reader.uint32()); continue; case 21: if (tag !== 170) { @@ -392,13 +259,11 @@ export const VideoPlaybackAbrRequest: MessageFns = { videoFormatIds: globalThis.Array.isArray(object?.videoFormatIds) ? object.videoFormatIds.map((e: any) => FormatId.fromJSON(e)) : [], - sc: isSet(object.sc) ? Upa.fromJSON(object.sc) : undefined, + streamerContext: isSet(object.streamerContext) ? StreamerContext.fromJSON(object.streamerContext) : undefined, field21: isSet(object.field21) ? OQa.fromJSON(object.field21) : undefined, field22: isSet(object.field22) ? globalThis.Number(object.field22) : undefined, field23: isSet(object.field23) ? globalThis.Number(object.field23) : undefined, - field1000: globalThis.Array.isArray(object?.field1000) - ? object.field1000.map((e: any) => Pqa.fromJSON(e)) - : [], + field1000: globalThis.Array.isArray(object?.field1000) ? object.field1000.map((e: any) => Pqa.fromJSON(e)) : [], }; }, @@ -425,8 +290,8 @@ export const VideoPlaybackAbrRequest: MessageFns = { if (message.videoFormatIds?.length) { obj.videoFormatIds = message.videoFormatIds.map((e) => FormatId.toJSON(e)); } - if (message.sc !== undefined) { - obj.sc = Upa.toJSON(message.sc); + if (message.streamerContext !== undefined) { + obj.streamerContext = StreamerContext.toJSON(message.streamerContext); } if (message.field21 !== undefined) { obj.field21 = OQa.toJSON(message.field21); @@ -457,7 +322,9 @@ export const VideoPlaybackAbrRequest: MessageFns = { message.lo = (object.lo !== undefined && object.lo !== null) ? Lo.fromPartial(object.lo) : undefined; message.audioFormatIds = object.audioFormatIds?.map((e) => FormatId.fromPartial(e)) || []; message.videoFormatIds = object.videoFormatIds?.map((e) => FormatId.fromPartial(e)) || []; - message.sc = (object.sc !== undefined && object.sc !== null) ? Upa.fromPartial(object.sc) : undefined; + message.streamerContext = (object.streamerContext !== undefined && object.streamerContext !== null) + ? StreamerContext.fromPartial(object.streamerContext) + : undefined; message.field21 = (object.field21 !== undefined && object.field21 !== null) ? OQa.fromPartial(object.field21) : undefined; @@ -468,1870 +335,243 @@ export const VideoPlaybackAbrRequest: MessageFns = { }, }; -function createBaseMediaInfo(): MediaInfo { - return { - timeSinceLastManualFormatSelectionMs: undefined, - lastManualDirection: undefined, - quality: undefined, - detailedNetworkType: undefined, - adjustedWidth: undefined, - adjustedHeight: undefined, - iea: undefined, - r7: undefined, - startTimeMs: undefined, - timeSinceLastSeek: undefined, - visibility: undefined, - d8: undefined, - mediaCapabilities: undefined, - lact: undefined, - mediaType: undefined, - playerState: undefined, - a8: undefined, - Jda: undefined, - qw: undefined, - Ky: undefined, - Eq: undefined, - l: undefined, - G7: undefined, - No: undefined, - qj: undefined, - Hx: undefined, - isPrefetch: undefined, - Iz: undefined, - sabrLicenseConstraint: undefined, - allowProximaLiveLatency: undefined, - sabrForceProxima: undefined, - Tqb: undefined, - c: undefined, - }; +function createBaseLo(): Lo { + return { formatId: undefined, Lj: undefined, sequenceNumber: undefined, field4: undefined, MZ: undefined }; } -export const MediaInfo: MessageFns = { - encode(message: MediaInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.timeSinceLastManualFormatSelectionMs !== undefined) { - writer.uint32(104).int32(message.timeSinceLastManualFormatSelectionMs); - } - if (message.lastManualDirection !== undefined) { - writer.uint32(112).int32(message.lastManualDirection); - } - if (message.quality !== undefined) { - writer.uint32(128).int32(message.quality); - } - if (message.detailedNetworkType !== undefined) { - writer.uint32(136).int32(message.detailedNetworkType); - } - if (message.adjustedWidth !== undefined) { - writer.uint32(144).int32(message.adjustedWidth); - } - if (message.adjustedHeight !== undefined) { - writer.uint32(152).int32(message.adjustedHeight); - } - if (message.iea !== undefined) { - writer.uint32(168).int32(message.iea); - } - if (message.r7 !== undefined) { - writer.uint32(184).int32(message.r7); - } - if (message.startTimeMs !== undefined) { - writer.uint32(224).int64(message.startTimeMs); - } - if (message.timeSinceLastSeek !== undefined) { - writer.uint32(232).int64(message.timeSinceLastSeek); - } - if (message.visibility !== undefined) { - writer.uint32(272).int32(message.visibility); - } - if (message.d8 !== undefined) { - writer.uint32(288).int32(message.d8); - } - if (message.mediaCapabilities !== undefined) { - MediaInfo_MediaCapabilities.encode(message.mediaCapabilities, writer.uint32(306).fork()).join(); - } - if (message.lact !== undefined) { - writer.uint32(312).int32(message.lact); - } - if (message.mediaType !== undefined) { - writer.uint32(320).int32(message.mediaType); - } - if (message.playerState !== undefined) { - writer.uint32(352).int32(message.playerState); - } - if (message.a8 !== undefined) { - writer.uint32(368).bool(message.a8); - } - if (message.Jda !== undefined) { - writer.uint32(384).int32(message.Jda); - } - if (message.qw !== undefined) { - writer.uint32(400).int32(message.qw); - } - if (message.Ky !== undefined) { - writer.uint32(408).int32(message.Ky); - } - if (message.Eq !== undefined) { - writer.uint32(432).int32(message.Eq); - } - if (message.l !== undefined) { - writer.uint32(448).bool(message.l); - } - if (message.G7 !== undefined) { - writer.uint32(456).int32(message.G7); - } - if (message.No !== undefined) { - writer.uint32(464).bool(message.No); - } - if (message.qj !== undefined) { - writer.uint32(472).int32(message.qj); - } - if (message.Hx !== undefined) { - writer.uint32(480).int32(message.Hx); - } - if (message.isPrefetch !== undefined) { - writer.uint32(488).bool(message.isPrefetch); - } - if (message.Iz !== undefined) { - writer.uint32(496).int32(message.Iz); - } - if (message.sabrLicenseConstraint !== undefined) { - writer.uint32(506).bytes(message.sabrLicenseConstraint); +export const Lo: MessageFns = { + encode(message: Lo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.formatId !== undefined) { + FormatId.encode(message.formatId, writer.uint32(10).fork()).join(); } - if (message.allowProximaLiveLatency !== undefined) { - writer.uint32(512).int32(message.allowProximaLiveLatency); + if (message.Lj !== undefined) { + writer.uint32(16).int32(message.Lj); } - if (message.sabrForceProxima !== undefined) { - writer.uint32(528).int32(message.sabrForceProxima); + if (message.sequenceNumber !== undefined) { + writer.uint32(24).int32(message.sequenceNumber); } - if (message.Tqb !== undefined) { - writer.uint32(536).int32(message.Tqb); + if (message.field4 !== undefined) { + Lo_Field4.encode(message.field4, writer.uint32(34).fork()).join(); } - if (message.c !== undefined) { - writer.uint32(544).int32(message.c); + if (message.MZ !== undefined) { + writer.uint32(40).int32(message.MZ); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): MediaInfo { + decode(input: BinaryReader | Uint8Array, length?: number): Lo { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMediaInfo(); + const message = createBaseLo(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 13: - if (tag !== 104) { + case 1: + if (tag !== 10) { break; } - message.timeSinceLastManualFormatSelectionMs = reader.int32(); + message.formatId = FormatId.decode(reader, reader.uint32()); continue; - case 14: - if (tag !== 112) { + case 2: + if (tag !== 16) { break; } - message.lastManualDirection = reader.int32(); + message.Lj = reader.int32(); continue; - case 16: - if (tag !== 128) { + case 3: + if (tag !== 24) { break; } - message.quality = reader.int32(); + message.sequenceNumber = reader.int32(); continue; - case 17: - if (tag !== 136) { + case 4: + if (tag !== 34) { break; } - message.detailedNetworkType = reader.int32(); + message.field4 = Lo_Field4.decode(reader, reader.uint32()); continue; - case 18: - if (tag !== 144) { + case 5: + if (tag !== 40) { break; } - message.adjustedWidth = reader.int32(); + message.MZ = reader.int32(); continue; - case 19: - if (tag !== 152) { - break; - } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, - message.adjustedHeight = reader.int32(); - continue; - case 21: - if (tag !== 168) { - break; - } + fromJSON(object: any): Lo { + return { + formatId: isSet(object.formatId) ? FormatId.fromJSON(object.formatId) : undefined, + Lj: isSet(object.Lj) ? globalThis.Number(object.Lj) : undefined, + sequenceNumber: isSet(object.sequenceNumber) ? globalThis.Number(object.sequenceNumber) : undefined, + field4: isSet(object.field4) ? Lo_Field4.fromJSON(object.field4) : undefined, + MZ: isSet(object.MZ) ? globalThis.Number(object.MZ) : undefined, + }; + }, - message.iea = reader.int32(); - continue; - case 23: - if (tag !== 184) { - break; - } + toJSON(message: Lo): unknown { + const obj: any = {}; + if (message.formatId !== undefined) { + obj.formatId = FormatId.toJSON(message.formatId); + } + if (message.Lj !== undefined) { + obj.Lj = Math.round(message.Lj); + } + if (message.sequenceNumber !== undefined) { + obj.sequenceNumber = Math.round(message.sequenceNumber); + } + if (message.field4 !== undefined) { + obj.field4 = Lo_Field4.toJSON(message.field4); + } + if (message.MZ !== undefined) { + obj.MZ = Math.round(message.MZ); + } + return obj; + }, - message.r7 = reader.int32(); - continue; - case 28: - if (tag !== 224) { - break; - } + create, I>>(base?: I): Lo { + return Lo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Lo { + const message = createBaseLo(); + message.formatId = (object.formatId !== undefined && object.formatId !== null) + ? FormatId.fromPartial(object.formatId) + : undefined; + message.Lj = object.Lj ?? undefined; + message.sequenceNumber = object.sequenceNumber ?? undefined; + message.field4 = (object.field4 !== undefined && object.field4 !== null) + ? Lo_Field4.fromPartial(object.field4) + : undefined; + message.MZ = object.MZ ?? undefined; + return message; + }, +}; - message.startTimeMs = longToNumber(reader.int64()); - continue; - case 29: - if (tag !== 232) { - break; - } +function createBaseLo_Field4(): Lo_Field4 { + return { field1: undefined, field2: undefined, field3: undefined }; +} - message.timeSinceLastSeek = longToNumber(reader.int64()); - continue; - case 34: - if (tag !== 272) { - break; - } +export const Lo_Field4: MessageFns = { + encode(message: Lo_Field4, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.field1 !== undefined) { + writer.uint32(8).int32(message.field1); + } + if (message.field2 !== undefined) { + writer.uint32(16).int32(message.field2); + } + if (message.field3 !== undefined) { + writer.uint32(24).int32(message.field3); + } + return writer; + }, - message.visibility = reader.int32(); - continue; - case 36: - if (tag !== 288) { + decode(input: BinaryReader | Uint8Array, length?: number): Lo_Field4 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLo_Field4(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { break; } - message.d8 = reader.int32(); + message.field1 = reader.int32(); continue; - case 38: - if (tag !== 306) { + case 2: + if (tag !== 16) { break; } - message.mediaCapabilities = MediaInfo_MediaCapabilities.decode(reader, reader.uint32()); + message.field2 = reader.int32(); continue; - case 39: - if (tag !== 312) { + case 3: + if (tag !== 24) { break; } - message.lact = reader.int32(); + message.field3 = reader.int32(); continue; - case 40: - if (tag !== 320) { - break; - } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, - message.mediaType = reader.int32() as any; - continue; - case 44: - if (tag !== 352) { - break; - } + fromJSON(object: any): Lo_Field4 { + return { + field1: isSet(object.field1) ? globalThis.Number(object.field1) : undefined, + field2: isSet(object.field2) ? globalThis.Number(object.field2) : undefined, + field3: isSet(object.field3) ? globalThis.Number(object.field3) : undefined, + }; + }, - message.playerState = reader.int32(); - continue; - case 46: - if (tag !== 368) { - break; - } + toJSON(message: Lo_Field4): unknown { + const obj: any = {}; + if (message.field1 !== undefined) { + obj.field1 = Math.round(message.field1); + } + if (message.field2 !== undefined) { + obj.field2 = Math.round(message.field2); + } + if (message.field3 !== undefined) { + obj.field3 = Math.round(message.field3); + } + return obj; + }, - message.a8 = reader.bool(); - continue; - case 48: - if (tag !== 384) { - break; - } + create, I>>(base?: I): Lo_Field4 { + return Lo_Field4.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Lo_Field4 { + const message = createBaseLo_Field4(); + message.field1 = object.field1 ?? undefined; + message.field2 = object.field2 ?? undefined; + message.field3 = object.field3 ?? undefined; + return message; + }, +}; - message.Jda = reader.int32(); - continue; - case 50: - if (tag !== 400) { - break; - } +function createBaseKob(): Kob { + return { EW: [] }; +} - message.qw = reader.int32(); - continue; - case 51: - if (tag !== 408) { - break; - } - - message.Ky = reader.int32(); - continue; - case 54: - if (tag !== 432) { - break; - } - - message.Eq = reader.int32(); - continue; - case 56: - if (tag !== 448) { - break; - } - - message.l = reader.bool(); - continue; - case 57: - if (tag !== 456) { - break; - } - - message.G7 = reader.int32(); - continue; - case 58: - if (tag !== 464) { - break; - } - - message.No = reader.bool(); - continue; - case 59: - if (tag !== 472) { - break; - } - - message.qj = reader.int32(); - continue; - case 60: - if (tag !== 480) { - break; - } - - message.Hx = reader.int32(); - continue; - case 61: - if (tag !== 488) { - break; - } - - message.isPrefetch = reader.bool(); - continue; - case 62: - if (tag !== 496) { - break; - } - - message.Iz = reader.int32(); - continue; - case 63: - if (tag !== 506) { - break; - } - - message.sabrLicenseConstraint = reader.bytes(); - continue; - case 64: - if (tag !== 512) { - break; - } - - message.allowProximaLiveLatency = reader.int32(); - continue; - case 66: - if (tag !== 528) { - break; - } - - message.sabrForceProxima = reader.int32(); - continue; - case 67: - if (tag !== 536) { - break; - } - - message.Tqb = reader.int32(); - continue; - case 68: - if (tag !== 544) { - break; - } - - message.c = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): MediaInfo { - return { - timeSinceLastManualFormatSelectionMs: isSet(object.timeSinceLastManualFormatSelectionMs) - ? globalThis.Number(object.timeSinceLastManualFormatSelectionMs) - : undefined, - lastManualDirection: isSet(object.lastManualDirection) - ? globalThis.Number(object.lastManualDirection) - : undefined, - quality: isSet(object.quality) ? globalThis.Number(object.quality) : undefined, - detailedNetworkType: isSet(object.detailedNetworkType) - ? globalThis.Number(object.detailedNetworkType) - : undefined, - adjustedWidth: isSet(object.adjustedWidth) ? globalThis.Number(object.adjustedWidth) : undefined, - adjustedHeight: isSet(object.adjustedHeight) ? globalThis.Number(object.adjustedHeight) : undefined, - iea: isSet(object.iea) ? globalThis.Number(object.iea) : undefined, - r7: isSet(object.r7) ? globalThis.Number(object.r7) : undefined, - startTimeMs: isSet(object.startTimeMs) ? globalThis.Number(object.startTimeMs) : undefined, - timeSinceLastSeek: isSet(object.timeSinceLastSeek) ? globalThis.Number(object.timeSinceLastSeek) : undefined, - visibility: isSet(object.visibility) ? globalThis.Number(object.visibility) : undefined, - d8: isSet(object.d8) ? globalThis.Number(object.d8) : undefined, - mediaCapabilities: isSet(object.mediaCapabilities) - ? MediaInfo_MediaCapabilities.fromJSON(object.mediaCapabilities) - : undefined, - lact: isSet(object.lact) ? globalThis.Number(object.lact) : undefined, - mediaType: isSet(object.mediaType) ? mediaInfo_MediaTypeFromJSON(object.mediaType) : undefined, - playerState: isSet(object.playerState) ? globalThis.Number(object.playerState) : undefined, - a8: isSet(object.a8) ? globalThis.Boolean(object.a8) : undefined, - Jda: isSet(object.Jda) ? globalThis.Number(object.Jda) : undefined, - qw: isSet(object.qw) ? globalThis.Number(object.qw) : undefined, - Ky: isSet(object.Ky) ? globalThis.Number(object.Ky) : undefined, - Eq: isSet(object.Eq) ? globalThis.Number(object.Eq) : undefined, - l: isSet(object.l) ? globalThis.Boolean(object.l) : undefined, - G7: isSet(object.G7) ? globalThis.Number(object.G7) : undefined, - No: isSet(object.No) ? globalThis.Boolean(object.No) : undefined, - qj: isSet(object.qj) ? globalThis.Number(object.qj) : undefined, - Hx: isSet(object.Hx) ? globalThis.Number(object.Hx) : undefined, - isPrefetch: isSet(object.isPrefetch) ? globalThis.Boolean(object.isPrefetch) : undefined, - Iz: isSet(object.Iz) ? globalThis.Number(object.Iz) : undefined, - sabrLicenseConstraint: isSet(object.sabrLicenseConstraint) - ? bytesFromBase64(object.sabrLicenseConstraint) - : undefined, - allowProximaLiveLatency: isSet(object.allowProximaLiveLatency) - ? globalThis.Number(object.allowProximaLiveLatency) - : undefined, - sabrForceProxima: isSet(object.sabrForceProxima) ? globalThis.Number(object.sabrForceProxima) : undefined, - Tqb: isSet(object.Tqb) ? globalThis.Number(object.Tqb) : undefined, - c: isSet(object.c) ? globalThis.Number(object.c) : undefined, - }; - }, - - toJSON(message: MediaInfo): unknown { - const obj: any = {}; - if (message.timeSinceLastManualFormatSelectionMs !== undefined) { - obj.timeSinceLastManualFormatSelectionMs = Math.round(message.timeSinceLastManualFormatSelectionMs); - } - if (message.lastManualDirection !== undefined) { - obj.lastManualDirection = Math.round(message.lastManualDirection); - } - if (message.quality !== undefined) { - obj.quality = Math.round(message.quality); - } - if (message.detailedNetworkType !== undefined) { - obj.detailedNetworkType = Math.round(message.detailedNetworkType); - } - if (message.adjustedWidth !== undefined) { - obj.adjustedWidth = Math.round(message.adjustedWidth); - } - if (message.adjustedHeight !== undefined) { - obj.adjustedHeight = Math.round(message.adjustedHeight); - } - if (message.iea !== undefined) { - obj.iea = Math.round(message.iea); - } - if (message.r7 !== undefined) { - obj.r7 = Math.round(message.r7); - } - if (message.startTimeMs !== undefined) { - obj.startTimeMs = Math.round(message.startTimeMs); - } - if (message.timeSinceLastSeek !== undefined) { - obj.timeSinceLastSeek = Math.round(message.timeSinceLastSeek); - } - if (message.visibility !== undefined) { - obj.visibility = Math.round(message.visibility); - } - if (message.d8 !== undefined) { - obj.d8 = Math.round(message.d8); - } - if (message.mediaCapabilities !== undefined) { - obj.mediaCapabilities = MediaInfo_MediaCapabilities.toJSON(message.mediaCapabilities); - } - if (message.lact !== undefined) { - obj.lact = Math.round(message.lact); - } - if (message.mediaType !== undefined) { - obj.mediaType = mediaInfo_MediaTypeToJSON(message.mediaType); - } - if (message.playerState !== undefined) { - obj.playerState = Math.round(message.playerState); - } - if (message.a8 !== undefined) { - obj.a8 = message.a8; - } - if (message.Jda !== undefined) { - obj.Jda = Math.round(message.Jda); - } - if (message.qw !== undefined) { - obj.qw = Math.round(message.qw); - } - if (message.Ky !== undefined) { - obj.Ky = Math.round(message.Ky); - } - if (message.Eq !== undefined) { - obj.Eq = Math.round(message.Eq); - } - if (message.l !== undefined) { - obj.l = message.l; - } - if (message.G7 !== undefined) { - obj.G7 = Math.round(message.G7); - } - if (message.No !== undefined) { - obj.No = message.No; - } - if (message.qj !== undefined) { - obj.qj = Math.round(message.qj); - } - if (message.Hx !== undefined) { - obj.Hx = Math.round(message.Hx); - } - if (message.isPrefetch !== undefined) { - obj.isPrefetch = message.isPrefetch; - } - if (message.Iz !== undefined) { - obj.Iz = Math.round(message.Iz); - } - if (message.sabrLicenseConstraint !== undefined) { - obj.sabrLicenseConstraint = base64FromBytes(message.sabrLicenseConstraint); - } - if (message.allowProximaLiveLatency !== undefined) { - obj.allowProximaLiveLatency = Math.round(message.allowProximaLiveLatency); - } - if (message.sabrForceProxima !== undefined) { - obj.sabrForceProxima = Math.round(message.sabrForceProxima); - } - if (message.Tqb !== undefined) { - obj.Tqb = Math.round(message.Tqb); - } - if (message.c !== undefined) { - obj.c = Math.round(message.c); - } - return obj; - }, - - create, I>>(base?: I): MediaInfo { - return MediaInfo.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): MediaInfo { - const message = createBaseMediaInfo(); - message.timeSinceLastManualFormatSelectionMs = object.timeSinceLastManualFormatSelectionMs ?? undefined; - message.lastManualDirection = object.lastManualDirection ?? undefined; - message.quality = object.quality ?? undefined; - message.detailedNetworkType = object.detailedNetworkType ?? undefined; - message.adjustedWidth = object.adjustedWidth ?? undefined; - message.adjustedHeight = object.adjustedHeight ?? undefined; - message.iea = object.iea ?? undefined; - message.r7 = object.r7 ?? undefined; - message.startTimeMs = object.startTimeMs ?? undefined; - message.timeSinceLastSeek = object.timeSinceLastSeek ?? undefined; - message.visibility = object.visibility ?? undefined; - message.d8 = object.d8 ?? undefined; - message.mediaCapabilities = (object.mediaCapabilities !== undefined && object.mediaCapabilities !== null) - ? MediaInfo_MediaCapabilities.fromPartial(object.mediaCapabilities) - : undefined; - message.lact = object.lact ?? undefined; - message.mediaType = object.mediaType ?? undefined; - message.playerState = object.playerState ?? undefined; - message.a8 = object.a8 ?? undefined; - message.Jda = object.Jda ?? undefined; - message.qw = object.qw ?? undefined; - message.Ky = object.Ky ?? undefined; - message.Eq = object.Eq ?? undefined; - message.l = object.l ?? undefined; - message.G7 = object.G7 ?? undefined; - message.No = object.No ?? undefined; - message.qj = object.qj ?? undefined; - message.Hx = object.Hx ?? undefined; - message.isPrefetch = object.isPrefetch ?? undefined; - message.Iz = object.Iz ?? undefined; - message.sabrLicenseConstraint = object.sabrLicenseConstraint ?? undefined; - message.allowProximaLiveLatency = object.allowProximaLiveLatency ?? undefined; - message.sabrForceProxima = object.sabrForceProxima ?? undefined; - message.Tqb = object.Tqb ?? undefined; - message.c = object.c ?? undefined; - return message; - }, -}; - -function createBaseMediaInfo_MediaCapabilities(): MediaInfo_MediaCapabilities { - return { videoFormatCapabilities: [], audioFormatCapabilities: [], hdrModeBitmask: undefined }; -} - -export const MediaInfo_MediaCapabilities: MessageFns = { - encode(message: MediaInfo_MediaCapabilities, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.videoFormatCapabilities) { - MediaInfo_MediaCapabilities_VideoFormatCapability.encode(v!, writer.uint32(10).fork()).join(); - } - for (const v of message.audioFormatCapabilities) { - MediaInfo_MediaCapabilities_AudioFormatCapability.encode(v!, writer.uint32(18).fork()).join(); - } - if (message.hdrModeBitmask !== undefined) { - writer.uint32(40).int32(message.hdrModeBitmask); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): MediaInfo_MediaCapabilities { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMediaInfo_MediaCapabilities(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - - message.videoFormatCapabilities.push( - MediaInfo_MediaCapabilities_VideoFormatCapability.decode(reader, reader.uint32()), - ); - continue; - case 2: - if (tag !== 18) { - break; - } - - message.audioFormatCapabilities.push( - MediaInfo_MediaCapabilities_AudioFormatCapability.decode(reader, reader.uint32()), - ); - continue; - case 5: - if (tag !== 40) { - break; - } - - message.hdrModeBitmask = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): MediaInfo_MediaCapabilities { - return { - videoFormatCapabilities: globalThis.Array.isArray(object?.videoFormatCapabilities) - ? object.videoFormatCapabilities.map((e: any) => MediaInfo_MediaCapabilities_VideoFormatCapability.fromJSON(e)) - : [], - audioFormatCapabilities: globalThis.Array.isArray(object?.audioFormatCapabilities) - ? object.audioFormatCapabilities.map((e: any) => MediaInfo_MediaCapabilities_AudioFormatCapability.fromJSON(e)) - : [], - hdrModeBitmask: isSet(object.hdrModeBitmask) ? globalThis.Number(object.hdrModeBitmask) : undefined, - }; - }, - - toJSON(message: MediaInfo_MediaCapabilities): unknown { - const obj: any = {}; - if (message.videoFormatCapabilities?.length) { - obj.videoFormatCapabilities = message.videoFormatCapabilities.map((e) => - MediaInfo_MediaCapabilities_VideoFormatCapability.toJSON(e) - ); - } - if (message.audioFormatCapabilities?.length) { - obj.audioFormatCapabilities = message.audioFormatCapabilities.map((e) => - MediaInfo_MediaCapabilities_AudioFormatCapability.toJSON(e) - ); - } - if (message.hdrModeBitmask !== undefined) { - obj.hdrModeBitmask = Math.round(message.hdrModeBitmask); - } - return obj; - }, - - create, I>>(base?: I): MediaInfo_MediaCapabilities { - return MediaInfo_MediaCapabilities.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): MediaInfo_MediaCapabilities { - const message = createBaseMediaInfo_MediaCapabilities(); - message.videoFormatCapabilities = - object.videoFormatCapabilities?.map((e) => MediaInfo_MediaCapabilities_VideoFormatCapability.fromPartial(e)) || - []; - message.audioFormatCapabilities = - object.audioFormatCapabilities?.map((e) => MediaInfo_MediaCapabilities_AudioFormatCapability.fromPartial(e)) || - []; - message.hdrModeBitmask = object.hdrModeBitmask ?? undefined; - return message; - }, -}; - -function createBaseMediaInfo_MediaCapabilities_VideoFormatCapability(): MediaInfo_MediaCapabilities_VideoFormatCapability { - return { - videoCodec: undefined, - maxHeight: undefined, - maxWidth: undefined, - maxFramerate: undefined, - maxBitrateBps: undefined, - is10BitSupported: undefined, - }; -} - -export const MediaInfo_MediaCapabilities_VideoFormatCapability: MessageFns< - MediaInfo_MediaCapabilities_VideoFormatCapability -> = { - encode( - message: MediaInfo_MediaCapabilities_VideoFormatCapability, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.videoCodec !== undefined) { - writer.uint32(8).int32(message.videoCodec); - } - if (message.maxHeight !== undefined) { - writer.uint32(24).int32(message.maxHeight); - } - if (message.maxWidth !== undefined) { - writer.uint32(32).int32(message.maxWidth); - } - if (message.maxFramerate !== undefined) { - writer.uint32(88).int32(message.maxFramerate); - } - if (message.maxBitrateBps !== undefined) { - writer.uint32(96).int32(message.maxBitrateBps); - } - if (message.is10BitSupported !== undefined) { - writer.uint32(120).bool(message.is10BitSupported); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): MediaInfo_MediaCapabilities_VideoFormatCapability { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMediaInfo_MediaCapabilities_VideoFormatCapability(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - - message.videoCodec = reader.int32(); - continue; - case 3: - if (tag !== 24) { - break; - } - - message.maxHeight = reader.int32(); - continue; - case 4: - if (tag !== 32) { - break; - } - - message.maxWidth = reader.int32(); - continue; - case 11: - if (tag !== 88) { - break; - } - - message.maxFramerate = reader.int32(); - continue; - case 12: - if (tag !== 96) { - break; - } - - message.maxBitrateBps = reader.int32(); - continue; - case 15: - if (tag !== 120) { - break; - } - - message.is10BitSupported = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): MediaInfo_MediaCapabilities_VideoFormatCapability { - return { - videoCodec: isSet(object.videoCodec) ? globalThis.Number(object.videoCodec) : undefined, - maxHeight: isSet(object.maxHeight) ? globalThis.Number(object.maxHeight) : undefined, - maxWidth: isSet(object.maxWidth) ? globalThis.Number(object.maxWidth) : undefined, - maxFramerate: isSet(object.maxFramerate) ? globalThis.Number(object.maxFramerate) : undefined, - maxBitrateBps: isSet(object.maxBitrateBps) ? globalThis.Number(object.maxBitrateBps) : undefined, - is10BitSupported: isSet(object.is10BitSupported) ? globalThis.Boolean(object.is10BitSupported) : undefined, - }; - }, - - toJSON(message: MediaInfo_MediaCapabilities_VideoFormatCapability): unknown { - const obj: any = {}; - if (message.videoCodec !== undefined) { - obj.videoCodec = Math.round(message.videoCodec); - } - if (message.maxHeight !== undefined) { - obj.maxHeight = Math.round(message.maxHeight); - } - if (message.maxWidth !== undefined) { - obj.maxWidth = Math.round(message.maxWidth); - } - if (message.maxFramerate !== undefined) { - obj.maxFramerate = Math.round(message.maxFramerate); - } - if (message.maxBitrateBps !== undefined) { - obj.maxBitrateBps = Math.round(message.maxBitrateBps); - } - if (message.is10BitSupported !== undefined) { - obj.is10BitSupported = message.is10BitSupported; - } - return obj; - }, - - create, I>>( - base?: I, - ): MediaInfo_MediaCapabilities_VideoFormatCapability { - return MediaInfo_MediaCapabilities_VideoFormatCapability.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): MediaInfo_MediaCapabilities_VideoFormatCapability { - const message = createBaseMediaInfo_MediaCapabilities_VideoFormatCapability(); - message.videoCodec = object.videoCodec ?? undefined; - message.maxHeight = object.maxHeight ?? undefined; - message.maxWidth = object.maxWidth ?? undefined; - message.maxFramerate = object.maxFramerate ?? undefined; - message.maxBitrateBps = object.maxBitrateBps ?? undefined; - message.is10BitSupported = object.is10BitSupported ?? undefined; - return message; - }, -}; - -function createBaseMediaInfo_MediaCapabilities_AudioFormatCapability(): MediaInfo_MediaCapabilities_AudioFormatCapability { - return { - audioCodec: undefined, - numChannels: undefined, - maxBitrateBps: undefined, - spatialCapabilityBitmask: undefined, - }; -} - -export const MediaInfo_MediaCapabilities_AudioFormatCapability: MessageFns< - MediaInfo_MediaCapabilities_AudioFormatCapability -> = { - encode( - message: MediaInfo_MediaCapabilities_AudioFormatCapability, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.audioCodec !== undefined) { - writer.uint32(8).int32(message.audioCodec); - } - if (message.numChannels !== undefined) { - writer.uint32(16).int32(message.numChannels); - } - if (message.maxBitrateBps !== undefined) { - writer.uint32(24).int32(message.maxBitrateBps); - } - if (message.spatialCapabilityBitmask !== undefined) { - writer.uint32(48).int32(message.spatialCapabilityBitmask); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): MediaInfo_MediaCapabilities_AudioFormatCapability { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMediaInfo_MediaCapabilities_AudioFormatCapability(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - - message.audioCodec = reader.int32(); - continue; - case 2: - if (tag !== 16) { - break; - } - - message.numChannels = reader.int32(); - continue; - case 3: - if (tag !== 24) { - break; - } - - message.maxBitrateBps = reader.int32(); - continue; - case 6: - if (tag !== 48) { - break; - } - - message.spatialCapabilityBitmask = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): MediaInfo_MediaCapabilities_AudioFormatCapability { - return { - audioCodec: isSet(object.audioCodec) ? globalThis.Number(object.audioCodec) : undefined, - numChannels: isSet(object.numChannels) ? globalThis.Number(object.numChannels) : undefined, - maxBitrateBps: isSet(object.maxBitrateBps) ? globalThis.Number(object.maxBitrateBps) : undefined, - spatialCapabilityBitmask: isSet(object.spatialCapabilityBitmask) - ? globalThis.Number(object.spatialCapabilityBitmask) - : undefined, - }; - }, - - toJSON(message: MediaInfo_MediaCapabilities_AudioFormatCapability): unknown { - const obj: any = {}; - if (message.audioCodec !== undefined) { - obj.audioCodec = Math.round(message.audioCodec); - } - if (message.numChannels !== undefined) { - obj.numChannels = Math.round(message.numChannels); - } - if (message.maxBitrateBps !== undefined) { - obj.maxBitrateBps = Math.round(message.maxBitrateBps); - } - if (message.spatialCapabilityBitmask !== undefined) { - obj.spatialCapabilityBitmask = Math.round(message.spatialCapabilityBitmask); - } - return obj; - }, - - create, I>>( - base?: I, - ): MediaInfo_MediaCapabilities_AudioFormatCapability { - return MediaInfo_MediaCapabilities_AudioFormatCapability.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): MediaInfo_MediaCapabilities_AudioFormatCapability { - const message = createBaseMediaInfo_MediaCapabilities_AudioFormatCapability(); - message.audioCodec = object.audioCodec ?? undefined; - message.numChannels = object.numChannels ?? undefined; - message.maxBitrateBps = object.maxBitrateBps ?? undefined; - message.spatialCapabilityBitmask = object.spatialCapabilityBitmask ?? undefined; - return message; - }, -}; - -function createBaseLo(): Lo { - return { formatId: undefined, Lj: undefined, sequenceNumber: undefined, field4: undefined, MZ: undefined }; -} - -export const Lo: MessageFns = { - encode(message: Lo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.formatId !== undefined) { - FormatId.encode(message.formatId, writer.uint32(10).fork()).join(); - } - if (message.Lj !== undefined) { - writer.uint32(16).int32(message.Lj); - } - if (message.sequenceNumber !== undefined) { - writer.uint32(24).int32(message.sequenceNumber); - } - if (message.field4 !== undefined) { - Lo_Field4.encode(message.field4, writer.uint32(34).fork()).join(); - } - if (message.MZ !== undefined) { - writer.uint32(40).int32(message.MZ); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Lo { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseLo(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - - message.formatId = FormatId.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 16) { - break; - } - - message.Lj = reader.int32(); - continue; - case 3: - if (tag !== 24) { - break; - } - - message.sequenceNumber = reader.int32(); - continue; - case 4: - if (tag !== 34) { - break; - } - - message.field4 = Lo_Field4.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 40) { - break; - } - - message.MZ = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): Lo { - return { - formatId: isSet(object.formatId) ? FormatId.fromJSON(object.formatId) : undefined, - Lj: isSet(object.Lj) ? globalThis.Number(object.Lj) : undefined, - sequenceNumber: isSet(object.sequenceNumber) ? globalThis.Number(object.sequenceNumber) : undefined, - field4: isSet(object.field4) ? Lo_Field4.fromJSON(object.field4) : undefined, - MZ: isSet(object.MZ) ? globalThis.Number(object.MZ) : undefined, - }; - }, - - toJSON(message: Lo): unknown { - const obj: any = {}; - if (message.formatId !== undefined) { - obj.formatId = FormatId.toJSON(message.formatId); - } - if (message.Lj !== undefined) { - obj.Lj = Math.round(message.Lj); - } - if (message.sequenceNumber !== undefined) { - obj.sequenceNumber = Math.round(message.sequenceNumber); - } - if (message.field4 !== undefined) { - obj.field4 = Lo_Field4.toJSON(message.field4); - } - if (message.MZ !== undefined) { - obj.MZ = Math.round(message.MZ); - } - return obj; - }, - - create, I>>(base?: I): Lo { - return Lo.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): Lo { - const message = createBaseLo(); - message.formatId = (object.formatId !== undefined && object.formatId !== null) - ? FormatId.fromPartial(object.formatId) - : undefined; - message.Lj = object.Lj ?? undefined; - message.sequenceNumber = object.sequenceNumber ?? undefined; - message.field4 = (object.field4 !== undefined && object.field4 !== null) - ? Lo_Field4.fromPartial(object.field4) - : undefined; - message.MZ = object.MZ ?? undefined; - return message; - }, -}; - -function createBaseLo_Field4(): Lo_Field4 { - return { field1: undefined, field2: undefined, field3: undefined }; -} - -export const Lo_Field4: MessageFns = { - encode(message: Lo_Field4, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.field1 !== undefined) { - writer.uint32(8).int32(message.field1); - } - if (message.field2 !== undefined) { - writer.uint32(16).int32(message.field2); - } - if (message.field3 !== undefined) { - writer.uint32(24).int32(message.field3); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Lo_Field4 { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseLo_Field4(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - - message.field1 = reader.int32(); - continue; - case 2: - if (tag !== 16) { - break; - } - - message.field2 = reader.int32(); - continue; - case 3: - if (tag !== 24) { - break; - } - - message.field3 = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): Lo_Field4 { - return { - field1: isSet(object.field1) ? globalThis.Number(object.field1) : undefined, - field2: isSet(object.field2) ? globalThis.Number(object.field2) : undefined, - field3: isSet(object.field3) ? globalThis.Number(object.field3) : undefined, - }; - }, - - toJSON(message: Lo_Field4): unknown { - const obj: any = {}; - if (message.field1 !== undefined) { - obj.field1 = Math.round(message.field1); - } - if (message.field2 !== undefined) { - obj.field2 = Math.round(message.field2); - } - if (message.field3 !== undefined) { - obj.field3 = Math.round(message.field3); - } - return obj; - }, - - create, I>>(base?: I): Lo_Field4 { - return Lo_Field4.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): Lo_Field4 { - const message = createBaseLo_Field4(); - message.field1 = object.field1 ?? undefined; - message.field2 = object.field2 ?? undefined; - message.field3 = object.field3 ?? undefined; - return message; - }, -}; - -function createBaseKob(): Kob { - return { EW: [] }; -} - -export const Kob: MessageFns = { - encode(message: Kob, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.EW) { - Kob_Pa.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Kob { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseKob(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - - message.EW.push(Kob_Pa.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): Kob { - return { EW: globalThis.Array.isArray(object?.EW) ? object.EW.map((e: any) => Kob_Pa.fromJSON(e)) : [] }; - }, - - toJSON(message: Kob): unknown { - const obj: any = {}; - if (message.EW?.length) { - obj.EW = message.EW.map((e) => Kob_Pa.toJSON(e)); - } - return obj; - }, - - create, I>>(base?: I): Kob { - return Kob.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): Kob { - const message = createBaseKob(); - message.EW = object.EW?.map((e) => Kob_Pa.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseKob_Pa(): Kob_Pa { - return { videoId: undefined, lmt: undefined }; -} - -export const Kob_Pa: MessageFns = { - encode(message: Kob_Pa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.videoId !== undefined) { - writer.uint32(10).string(message.videoId); - } - if (message.lmt !== undefined) { - writer.uint32(16).uint64(message.lmt); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Kob_Pa { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseKob_Pa(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - - message.videoId = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - - message.lmt = longToNumber(reader.uint64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): Kob_Pa { - return { - videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : undefined, - lmt: isSet(object.lmt) ? globalThis.Number(object.lmt) : undefined, - }; - }, - - toJSON(message: Kob_Pa): unknown { - const obj: any = {}; - if (message.videoId !== undefined) { - obj.videoId = message.videoId; - } - if (message.lmt !== undefined) { - obj.lmt = Math.round(message.lmt); - } - return obj; - }, - - create, I>>(base?: I): Kob_Pa { - return Kob_Pa.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): Kob_Pa { - const message = createBaseKob_Pa(); - message.videoId = object.videoId ?? undefined; - message.lmt = object.lmt ?? undefined; - return message; - }, -}; - -function createBaseYPa(): YPa { - return { field1: undefined, field2: undefined, field3: undefined }; -} - -export const YPa: MessageFns = { - encode(message: YPa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.field1 !== undefined) { - writer.uint32(8).int32(message.field1); - } - if (message.field2 !== undefined) { - writer.uint32(16).int32(message.field2); - } - if (message.field3 !== undefined) { - writer.uint32(24).int32(message.field3); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): YPa { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseYPa(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - - message.field1 = reader.int32(); - continue; - case 2: - if (tag !== 16) { - break; - } - - message.field2 = reader.int32(); - continue; - case 3: - if (tag !== 24) { - break; - } - - message.field3 = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): YPa { - return { - field1: isSet(object.field1) ? globalThis.Number(object.field1) : undefined, - field2: isSet(object.field2) ? globalThis.Number(object.field2) : undefined, - field3: isSet(object.field3) ? globalThis.Number(object.field3) : undefined, - }; - }, - - toJSON(message: YPa): unknown { - const obj: any = {}; - if (message.field1 !== undefined) { - obj.field1 = Math.round(message.field1); - } - if (message.field2 !== undefined) { - obj.field2 = Math.round(message.field2); - } - if (message.field3 !== undefined) { - obj.field3 = Math.round(message.field3); - } - return obj; - }, - - create, I>>(base?: I): YPa { - return YPa.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): YPa { - const message = createBaseYPa(); - message.field1 = object.field1 ?? undefined; - message.field2 = object.field2 ?? undefined; - message.field3 = object.field3 ?? undefined; - return message; - }, -}; - -function createBaseZpa(): Zpa { - return { - formatId: undefined, - startTimeMs: 0, - durationMs: 0, - field4: 0, - sequenceNumber: 0, - timeRange: undefined, - field9: undefined, - field11: undefined, - field12: undefined, - }; -} - -export const Zpa: MessageFns = { - encode(message: Zpa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.formatId !== undefined) { - FormatId.encode(message.formatId, writer.uint32(10).fork()).join(); - } - if (message.startTimeMs !== 0) { - writer.uint32(16).int64(message.startTimeMs); - } - if (message.durationMs !== 0) { - writer.uint32(24).int64(message.durationMs); - } - if (message.field4 !== 0) { - writer.uint32(32).int32(message.field4); - } - if (message.sequenceNumber !== 0) { - writer.uint32(40).int32(message.sequenceNumber); - } - if (message.timeRange !== undefined) { - TimeRange.encode(message.timeRange, writer.uint32(50).fork()).join(); - } - if (message.field9 !== undefined) { - Kob.encode(message.field9, writer.uint32(74).fork()).join(); - } - if (message.field11 !== undefined) { - YPa.encode(message.field11, writer.uint32(90).fork()).join(); - } - if (message.field12 !== undefined) { - YPa.encode(message.field12, writer.uint32(98).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Zpa { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseZpa(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - - message.formatId = FormatId.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 16) { - break; - } - - message.startTimeMs = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - - message.durationMs = longToNumber(reader.int64()); - continue; - case 4: - if (tag !== 32) { - break; - } - - message.field4 = reader.int32(); - continue; - case 5: - if (tag !== 40) { - break; - } - - message.sequenceNumber = reader.int32(); - continue; - case 6: - if (tag !== 50) { - break; - } - - message.timeRange = TimeRange.decode(reader, reader.uint32()); - continue; - case 9: - if (tag !== 74) { - break; - } - - message.field9 = Kob.decode(reader, reader.uint32()); - continue; - case 11: - if (tag !== 90) { - break; - } - - message.field11 = YPa.decode(reader, reader.uint32()); - continue; - case 12: - if (tag !== 98) { - break; - } - - message.field12 = YPa.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): Zpa { - return { - formatId: isSet(object.formatId) ? FormatId.fromJSON(object.formatId) : undefined, - startTimeMs: isSet(object.startTimeMs) ? globalThis.Number(object.startTimeMs) : 0, - durationMs: isSet(object.durationMs) ? globalThis.Number(object.durationMs) : 0, - field4: isSet(object.field4) ? globalThis.Number(object.field4) : 0, - sequenceNumber: isSet(object.sequenceNumber) ? globalThis.Number(object.sequenceNumber) : 0, - timeRange: isSet(object.timeRange) ? TimeRange.fromJSON(object.timeRange) : undefined, - field9: isSet(object.field9) ? Kob.fromJSON(object.field9) : undefined, - field11: isSet(object.field11) ? YPa.fromJSON(object.field11) : undefined, - field12: isSet(object.field12) ? YPa.fromJSON(object.field12) : undefined, - }; - }, - - toJSON(message: Zpa): unknown { - const obj: any = {}; - if (message.formatId !== undefined) { - obj.formatId = FormatId.toJSON(message.formatId); - } - if (message.startTimeMs !== 0) { - obj.startTimeMs = Math.round(message.startTimeMs); - } - if (message.durationMs !== 0) { - obj.durationMs = Math.round(message.durationMs); - } - if (message.field4 !== 0) { - obj.field4 = Math.round(message.field4); - } - if (message.sequenceNumber !== 0) { - obj.sequenceNumber = Math.round(message.sequenceNumber); - } - if (message.timeRange !== undefined) { - obj.timeRange = TimeRange.toJSON(message.timeRange); - } - if (message.field9 !== undefined) { - obj.field9 = Kob.toJSON(message.field9); - } - if (message.field11 !== undefined) { - obj.field11 = YPa.toJSON(message.field11); - } - if (message.field12 !== undefined) { - obj.field12 = YPa.toJSON(message.field12); - } - return obj; - }, - - create, I>>(base?: I): Zpa { - return Zpa.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): Zpa { - const message = createBaseZpa(); - message.formatId = (object.formatId !== undefined && object.formatId !== null) - ? FormatId.fromPartial(object.formatId) - : undefined; - message.startTimeMs = object.startTimeMs ?? 0; - message.durationMs = object.durationMs ?? 0; - message.field4 = object.field4 ?? 0; - message.sequenceNumber = object.sequenceNumber ?? 0; - message.timeRange = (object.timeRange !== undefined && object.timeRange !== null) - ? TimeRange.fromPartial(object.timeRange) - : undefined; - message.field9 = (object.field9 !== undefined && object.field9 !== null) - ? Kob.fromPartial(object.field9) - : undefined; - message.field11 = (object.field11 !== undefined && object.field11 !== null) - ? YPa.fromPartial(object.field11) - : undefined; - message.field12 = (object.field12 !== undefined && object.field12 !== null) - ? YPa.fromPartial(object.field12) - : undefined; - return message; - }, -}; - -function createBaseUpa(): Upa { - return { - clientInfo: undefined, - poToken: undefined, - playbackCookie: undefined, - gp: undefined, - field5: [], - field6: [], - field7: undefined, - field8: undefined, - }; -} - -export const Upa: MessageFns = { - encode(message: Upa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.clientInfo !== undefined) { - Upa_ClientInfo.encode(message.clientInfo, writer.uint32(10).fork()).join(); - } - if (message.poToken !== undefined) { - writer.uint32(18).bytes(message.poToken); - } - if (message.playbackCookie !== undefined) { - writer.uint32(26).bytes(message.playbackCookie); - } - if (message.gp !== undefined) { - writer.uint32(34).bytes(message.gp); - } - for (const v of message.field5) { - Upa_Fqa.encode(v!, writer.uint32(42).fork()).join(); - } - writer.uint32(50).fork(); - for (const v of message.field6) { - writer.int32(v); - } - writer.join(); - if (message.field7 !== undefined) { - writer.uint32(58).string(message.field7); - } - if (message.field8 !== undefined) { - Upa_Gqa.encode(message.field8, writer.uint32(66).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Upa { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpa(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - - message.clientInfo = Upa_ClientInfo.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - - message.poToken = reader.bytes(); - continue; - case 3: - if (tag !== 26) { - break; - } - - message.playbackCookie = reader.bytes(); - continue; - case 4: - if (tag !== 34) { - break; - } - - message.gp = reader.bytes(); - continue; - case 5: - if (tag !== 42) { - break; - } - - message.field5.push(Upa_Fqa.decode(reader, reader.uint32())); - continue; - case 6: - if (tag === 48) { - message.field6.push(reader.int32()); - - continue; - } - - if (tag === 50) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.field6.push(reader.int32()); - } - - continue; - } - - break; - case 7: - if (tag !== 58) { - break; - } - - message.field7 = reader.string(); - continue; - case 8: - if (tag !== 66) { - break; - } - - message.field8 = Upa_Gqa.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): Upa { - return { - clientInfo: isSet(object.clientInfo) ? Upa_ClientInfo.fromJSON(object.clientInfo) : undefined, - poToken: isSet(object.poToken) ? bytesFromBase64(object.poToken) : undefined, - playbackCookie: isSet(object.playbackCookie) ? bytesFromBase64(object.playbackCookie) : undefined, - gp: isSet(object.gp) ? bytesFromBase64(object.gp) : undefined, - field5: globalThis.Array.isArray(object?.field5) ? object.field5.map((e: any) => Upa_Fqa.fromJSON(e)) : [], - field6: globalThis.Array.isArray(object?.field6) ? object.field6.map((e: any) => globalThis.Number(e)) : [], - field7: isSet(object.field7) ? globalThis.String(object.field7) : undefined, - field8: isSet(object.field8) ? Upa_Gqa.fromJSON(object.field8) : undefined, - }; - }, - - toJSON(message: Upa): unknown { - const obj: any = {}; - if (message.clientInfo !== undefined) { - obj.clientInfo = Upa_ClientInfo.toJSON(message.clientInfo); - } - if (message.poToken !== undefined) { - obj.poToken = base64FromBytes(message.poToken); - } - if (message.playbackCookie !== undefined) { - obj.playbackCookie = base64FromBytes(message.playbackCookie); - } - if (message.gp !== undefined) { - obj.gp = base64FromBytes(message.gp); - } - if (message.field5?.length) { - obj.field5 = message.field5.map((e) => Upa_Fqa.toJSON(e)); - } - if (message.field6?.length) { - obj.field6 = message.field6.map((e) => Math.round(e)); - } - if (message.field7 !== undefined) { - obj.field7 = message.field7; - } - if (message.field8 !== undefined) { - obj.field8 = Upa_Gqa.toJSON(message.field8); - } - return obj; - }, - - create, I>>(base?: I): Upa { - return Upa.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): Upa { - const message = createBaseUpa(); - message.clientInfo = (object.clientInfo !== undefined && object.clientInfo !== null) - ? Upa_ClientInfo.fromPartial(object.clientInfo) - : undefined; - message.poToken = object.poToken ?? undefined; - message.playbackCookie = object.playbackCookie ?? undefined; - message.gp = object.gp ?? undefined; - message.field5 = object.field5?.map((e) => Upa_Fqa.fromPartial(e)) || []; - message.field6 = object.field6?.map((e) => e) || []; - message.field7 = object.field7 ?? undefined; - message.field8 = (object.field8 !== undefined && object.field8 !== null) - ? Upa_Gqa.fromPartial(object.field8) - : undefined; - return message; - }, -}; - -function createBaseUpa_ClientInfo(): Upa_ClientInfo { - return { - deviceMake: undefined, - deviceModel: undefined, - clientName: undefined, - clientVersion: undefined, - osName: undefined, - osVersion: undefined, - }; -} - -export const Upa_ClientInfo: MessageFns = { - encode(message: Upa_ClientInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.deviceMake !== undefined) { - writer.uint32(98).string(message.deviceMake); - } - if (message.deviceModel !== undefined) { - writer.uint32(106).string(message.deviceModel); - } - if (message.clientName !== undefined) { - writer.uint32(128).int32(message.clientName); - } - if (message.clientVersion !== undefined) { - writer.uint32(138).string(message.clientVersion); - } - if (message.osName !== undefined) { - writer.uint32(146).string(message.osName); - } - if (message.osVersion !== undefined) { - writer.uint32(154).string(message.osVersion); +export const Kob: MessageFns = { + encode(message: Kob, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.EW) { + Kob_Pa.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): Upa_ClientInfo { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpa_ClientInfo(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 12: - if (tag !== 98) { - break; - } - - message.deviceMake = reader.string(); - continue; - case 13: - if (tag !== 106) { - break; - } - - message.deviceModel = reader.string(); - continue; - case 16: - if (tag !== 128) { - break; - } - - message.clientName = reader.int32(); - continue; - case 17: - if (tag !== 138) { - break; - } - - message.clientVersion = reader.string(); - continue; - case 18: - if (tag !== 146) { - break; - } - - message.osName = reader.string(); - continue; - case 19: - if (tag !== 154) { + decode(input: BinaryReader | Uint8Array, length?: number): Kob { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKob(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { break; } - message.osVersion = reader.string(); + message.EW.push(Kob_Pa.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { @@ -2342,90 +582,63 @@ export const Upa_ClientInfo: MessageFns = { return message; }, - fromJSON(object: any): Upa_ClientInfo { - return { - deviceMake: isSet(object.deviceMake) ? globalThis.String(object.deviceMake) : undefined, - deviceModel: isSet(object.deviceModel) ? globalThis.String(object.deviceModel) : undefined, - clientName: isSet(object.clientName) ? globalThis.Number(object.clientName) : undefined, - clientVersion: isSet(object.clientVersion) ? globalThis.String(object.clientVersion) : undefined, - osName: isSet(object.osName) ? globalThis.String(object.osName) : undefined, - osVersion: isSet(object.osVersion) ? globalThis.String(object.osVersion) : undefined, - }; + fromJSON(object: any): Kob { + return { EW: globalThis.Array.isArray(object?.EW) ? object.EW.map((e: any) => Kob_Pa.fromJSON(e)) : [] }; }, - toJSON(message: Upa_ClientInfo): unknown { + toJSON(message: Kob): unknown { const obj: any = {}; - if (message.deviceMake !== undefined) { - obj.deviceMake = message.deviceMake; - } - if (message.deviceModel !== undefined) { - obj.deviceModel = message.deviceModel; - } - if (message.clientName !== undefined) { - obj.clientName = Math.round(message.clientName); - } - if (message.clientVersion !== undefined) { - obj.clientVersion = message.clientVersion; - } - if (message.osName !== undefined) { - obj.osName = message.osName; - } - if (message.osVersion !== undefined) { - obj.osVersion = message.osVersion; + if (message.EW?.length) { + obj.EW = message.EW.map((e) => Kob_Pa.toJSON(e)); } return obj; }, - create, I>>(base?: I): Upa_ClientInfo { - return Upa_ClientInfo.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): Kob { + return Kob.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Upa_ClientInfo { - const message = createBaseUpa_ClientInfo(); - message.deviceMake = object.deviceMake ?? undefined; - message.deviceModel = object.deviceModel ?? undefined; - message.clientName = object.clientName ?? undefined; - message.clientVersion = object.clientVersion ?? undefined; - message.osName = object.osName ?? undefined; - message.osVersion = object.osVersion ?? undefined; + fromPartial, I>>(object: I): Kob { + const message = createBaseKob(); + message.EW = object.EW?.map((e) => Kob_Pa.fromPartial(e)) || []; return message; }, }; -function createBaseUpa_Fqa(): Upa_Fqa { - return { type: undefined, value: undefined }; +function createBaseKob_Pa(): Kob_Pa { + return { videoId: undefined, lmt: undefined }; } -export const Upa_Fqa: MessageFns = { - encode(message: Upa_Fqa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.type !== undefined) { - writer.uint32(8).int32(message.type); +export const Kob_Pa: MessageFns = { + encode(message: Kob_Pa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.videoId !== undefined) { + writer.uint32(10).string(message.videoId); } - if (message.value !== undefined) { - writer.uint32(18).bytes(message.value); + if (message.lmt !== undefined) { + writer.uint32(16).uint64(message.lmt); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): Upa_Fqa { + decode(input: BinaryReader | Uint8Array, length?: number): Kob_Pa { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpa_Fqa(); + const message = createBaseKob_Pa(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (tag !== 8) { + if (tag !== 10) { break; } - message.type = reader.int32(); + message.videoId = reader.string(); continue; case 2: - if (tag !== 18) { + if (tag !== 16) { break; } - message.value = reader.bytes(); + message.lmt = longToNumber(reader.uint64()); continue; } if ((tag & 7) === 4 || tag === 0) { @@ -2436,70 +649,80 @@ export const Upa_Fqa: MessageFns = { return message; }, - fromJSON(object: any): Upa_Fqa { + fromJSON(object: any): Kob_Pa { return { - type: isSet(object.type) ? globalThis.Number(object.type) : undefined, - value: isSet(object.value) ? bytesFromBase64(object.value) : undefined, + videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : undefined, + lmt: isSet(object.lmt) ? globalThis.Number(object.lmt) : undefined, }; }, - toJSON(message: Upa_Fqa): unknown { + toJSON(message: Kob_Pa): unknown { const obj: any = {}; - if (message.type !== undefined) { - obj.type = Math.round(message.type); + if (message.videoId !== undefined) { + obj.videoId = message.videoId; } - if (message.value !== undefined) { - obj.value = base64FromBytes(message.value); + if (message.lmt !== undefined) { + obj.lmt = Math.round(message.lmt); } return obj; }, - create, I>>(base?: I): Upa_Fqa { - return Upa_Fqa.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): Kob_Pa { + return Kob_Pa.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Upa_Fqa { - const message = createBaseUpa_Fqa(); - message.type = object.type ?? undefined; - message.value = object.value ?? undefined; + fromPartial, I>>(object: I): Kob_Pa { + const message = createBaseKob_Pa(); + message.videoId = object.videoId ?? undefined; + message.lmt = object.lmt ?? undefined; return message; }, }; -function createBaseUpa_Gqa(): Upa_Gqa { - return { field1: undefined, field2: undefined }; +function createBaseYPa(): YPa { + return { field1: undefined, field2: undefined, field3: undefined }; } -export const Upa_Gqa: MessageFns = { - encode(message: Upa_Gqa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { +export const YPa: MessageFns = { + encode(message: YPa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.field1 !== undefined) { - writer.uint32(10).bytes(message.field1); + writer.uint32(8).int32(message.field1); } if (message.field2 !== undefined) { - Upa_Gqa_Hqa.encode(message.field2, writer.uint32(18).fork()).join(); + writer.uint32(16).int32(message.field2); + } + if (message.field3 !== undefined) { + writer.uint32(24).int32(message.field3); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): Upa_Gqa { + decode(input: BinaryReader | Uint8Array, length?: number): YPa { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpa_Gqa(); + const message = createBaseYPa(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (tag !== 10) { + if (tag !== 8) { break; } - message.field1 = reader.bytes(); + message.field1 = reader.int32(); continue; case 2: - if (tag !== 18) { + if (tag !== 16) { + break; + } + + message.field2 = reader.int32(); + continue; + case 3: + if (tag !== 24) { break; } - message.field2 = Upa_Gqa_Hqa.decode(reader, reader.uint32()); + message.field3 = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { @@ -2510,72 +733,155 @@ export const Upa_Gqa: MessageFns = { return message; }, - fromJSON(object: any): Upa_Gqa { + fromJSON(object: any): YPa { return { - field1: isSet(object.field1) ? bytesFromBase64(object.field1) : undefined, - field2: isSet(object.field2) ? Upa_Gqa_Hqa.fromJSON(object.field2) : undefined, + field1: isSet(object.field1) ? globalThis.Number(object.field1) : undefined, + field2: isSet(object.field2) ? globalThis.Number(object.field2) : undefined, + field3: isSet(object.field3) ? globalThis.Number(object.field3) : undefined, }; }, - toJSON(message: Upa_Gqa): unknown { + toJSON(message: YPa): unknown { const obj: any = {}; if (message.field1 !== undefined) { - obj.field1 = base64FromBytes(message.field1); + obj.field1 = Math.round(message.field1); } if (message.field2 !== undefined) { - obj.field2 = Upa_Gqa_Hqa.toJSON(message.field2); + obj.field2 = Math.round(message.field2); + } + if (message.field3 !== undefined) { + obj.field3 = Math.round(message.field3); } return obj; }, - create, I>>(base?: I): Upa_Gqa { - return Upa_Gqa.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): YPa { + return YPa.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Upa_Gqa { - const message = createBaseUpa_Gqa(); + fromPartial, I>>(object: I): YPa { + const message = createBaseYPa(); message.field1 = object.field1 ?? undefined; - message.field2 = (object.field2 !== undefined && object.field2 !== null) - ? Upa_Gqa_Hqa.fromPartial(object.field2) - : undefined; + message.field2 = object.field2 ?? undefined; + message.field3 = object.field3 ?? undefined; return message; }, }; -function createBaseUpa_Gqa_Hqa(): Upa_Gqa_Hqa { - return { code: undefined, message: undefined }; +function createBaseZpa(): Zpa { + return { + formatId: undefined, + startTimeMs: 0, + durationMs: 0, + field4: 0, + sequenceNumber: 0, + timeRange: undefined, + field9: undefined, + field11: undefined, + field12: undefined, + }; } -export const Upa_Gqa_Hqa: MessageFns = { - encode(message: Upa_Gqa_Hqa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.code !== undefined) { - writer.uint32(8).int32(message.code); +export const Zpa: MessageFns = { + encode(message: Zpa, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.formatId !== undefined) { + FormatId.encode(message.formatId, writer.uint32(10).fork()).join(); + } + if (message.startTimeMs !== 0) { + writer.uint32(16).int64(message.startTimeMs); + } + if (message.durationMs !== 0) { + writer.uint32(24).int64(message.durationMs); + } + if (message.field4 !== 0) { + writer.uint32(32).int32(message.field4); + } + if (message.sequenceNumber !== 0) { + writer.uint32(40).int32(message.sequenceNumber); + } + if (message.timeRange !== undefined) { + TimeRange.encode(message.timeRange, writer.uint32(50).fork()).join(); + } + if (message.field9 !== undefined) { + Kob.encode(message.field9, writer.uint32(74).fork()).join(); + } + if (message.field11 !== undefined) { + YPa.encode(message.field11, writer.uint32(90).fork()).join(); } - if (message.message !== undefined) { - writer.uint32(18).string(message.message); + if (message.field12 !== undefined) { + YPa.encode(message.field12, writer.uint32(98).fork()).join(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): Upa_Gqa_Hqa { + decode(input: BinaryReader | Uint8Array, length?: number): Zpa { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpa_Gqa_Hqa(); + const message = createBaseZpa(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (tag !== 8) { + if (tag !== 10) { break; } - message.code = reader.int32(); + message.formatId = FormatId.decode(reader, reader.uint32()); continue; case 2: - if (tag !== 18) { + if (tag !== 16) { + break; + } + + message.startTimeMs = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.durationMs = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.field4 = reader.int32(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sequenceNumber = reader.int32(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.timeRange = TimeRange.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.field9 = Kob.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.field11 = YPa.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { break; } - message.message = reader.string(); + message.field12 = YPa.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { @@ -2586,31 +892,76 @@ export const Upa_Gqa_Hqa: MessageFns = { return message; }, - fromJSON(object: any): Upa_Gqa_Hqa { + fromJSON(object: any): Zpa { return { - code: isSet(object.code) ? globalThis.Number(object.code) : undefined, - message: isSet(object.message) ? globalThis.String(object.message) : undefined, + formatId: isSet(object.formatId) ? FormatId.fromJSON(object.formatId) : undefined, + startTimeMs: isSet(object.startTimeMs) ? globalThis.Number(object.startTimeMs) : 0, + durationMs: isSet(object.durationMs) ? globalThis.Number(object.durationMs) : 0, + field4: isSet(object.field4) ? globalThis.Number(object.field4) : 0, + sequenceNumber: isSet(object.sequenceNumber) ? globalThis.Number(object.sequenceNumber) : 0, + timeRange: isSet(object.timeRange) ? TimeRange.fromJSON(object.timeRange) : undefined, + field9: isSet(object.field9) ? Kob.fromJSON(object.field9) : undefined, + field11: isSet(object.field11) ? YPa.fromJSON(object.field11) : undefined, + field12: isSet(object.field12) ? YPa.fromJSON(object.field12) : undefined, }; }, - toJSON(message: Upa_Gqa_Hqa): unknown { + toJSON(message: Zpa): unknown { const obj: any = {}; - if (message.code !== undefined) { - obj.code = Math.round(message.code); + if (message.formatId !== undefined) { + obj.formatId = FormatId.toJSON(message.formatId); + } + if (message.startTimeMs !== 0) { + obj.startTimeMs = Math.round(message.startTimeMs); + } + if (message.durationMs !== 0) { + obj.durationMs = Math.round(message.durationMs); + } + if (message.field4 !== 0) { + obj.field4 = Math.round(message.field4); + } + if (message.sequenceNumber !== 0) { + obj.sequenceNumber = Math.round(message.sequenceNumber); + } + if (message.timeRange !== undefined) { + obj.timeRange = TimeRange.toJSON(message.timeRange); + } + if (message.field9 !== undefined) { + obj.field9 = Kob.toJSON(message.field9); } - if (message.message !== undefined) { - obj.message = message.message; + if (message.field11 !== undefined) { + obj.field11 = YPa.toJSON(message.field11); + } + if (message.field12 !== undefined) { + obj.field12 = YPa.toJSON(message.field12); } return obj; }, - create, I>>(base?: I): Upa_Gqa_Hqa { - return Upa_Gqa_Hqa.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): Zpa { + return Zpa.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Upa_Gqa_Hqa { - const message = createBaseUpa_Gqa_Hqa(); - message.code = object.code ?? undefined; - message.message = object.message ?? undefined; + fromPartial, I>>(object: I): Zpa { + const message = createBaseZpa(); + message.formatId = (object.formatId !== undefined && object.formatId !== null) + ? FormatId.fromPartial(object.formatId) + : undefined; + message.startTimeMs = object.startTimeMs ?? 0; + message.durationMs = object.durationMs ?? 0; + message.field4 = object.field4 ?? 0; + message.sequenceNumber = object.sequenceNumber ?? 0; + message.timeRange = (object.timeRange !== undefined && object.timeRange !== null) + ? TimeRange.fromPartial(object.timeRange) + : undefined; + message.field9 = (object.field9 !== undefined && object.field9 !== null) + ? Kob.fromPartial(object.field9) + : undefined; + message.field11 = (object.field11 !== undefined && object.field11 !== null) + ? YPa.fromPartial(object.field11) + : undefined; + message.field12 = (object.field12 !== undefined && object.field12 !== null) + ? YPa.fromPartial(object.field12) + : undefined; return message; }, }; diff --git a/protos/video_streaming/crypto_params.proto b/protos/video_streaming/crypto_params.proto new file mode 100644 index 0000000..0a570d9 --- /dev/null +++ b/protos/video_streaming/crypto_params.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package video_streaming; + +message CryptoParams { + enum CompressionType { + VAL_0 = 0; + VAL_1 = 1; + VAL_2 = 2; + } + optional bytes hmac = 4; + optional bytes iv = 5; + optional CompressionType compression_type = 6; +} \ No newline at end of file diff --git a/protos/video_streaming/encrypted_request.proto b/protos/video_streaming/encrypted_request.proto new file mode 100644 index 0000000..17ef716 --- /dev/null +++ b/protos/video_streaming/encrypted_request.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package video_streaming; + +message EncryptedRequest { + optional bytes encrypted_onesie_request = 2; + optional bytes encrypted_client_key = 5; + optional bytes iv = 6; + optional bytes hmac = 7; + optional bool YP = 10; + optional bool pM = 13; + optional bool enable_compression = 14; + optional bool TQ = 17; +} \ No newline at end of file diff --git a/protos/video_streaming/media_capabilities.proto b/protos/video_streaming/media_capabilities.proto new file mode 100644 index 0000000..a91c5a3 --- /dev/null +++ b/protos/video_streaming/media_capabilities.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +package video_streaming; + +message MediaCapabilities { + repeated VideoFormatCapability video_format_capabilities = 1; + repeated AudioFormatCapability audio_format_capabilities = 2; + optional int32 hdr_mode_bitmask = 5; + + message VideoFormatCapability { + optional int32 video_codec = 1; + optional int32 max_height = 3; + optional int32 max_width = 4; + optional int32 max_framerate = 11; + optional int32 max_bitrate_bps = 12; + optional bool is_10_bit_supported = 15; + } + + message AudioFormatCapability { + optional int32 audio_codec = 1; + optional int32 num_channels = 2; + optional int32 max_bitrate_bps = 3; + optional int32 spatial_capability_bitmask = 6; + } +} \ No newline at end of file diff --git a/protos/video_streaming/media_info.proto b/protos/video_streaming/media_info.proto new file mode 100644 index 0000000..ce2b112 --- /dev/null +++ b/protos/video_streaming/media_info.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; +package video_streaming; + +import "video_streaming/media_capabilities.proto"; + +message MediaInfo { + optional int32 time_since_last_manual_format_selection_ms = 13; + optional int32 last_manual_direction = 14; + optional int32 quality = 16; + optional int32 detailed_network_type = 17; + optional int32 max_width = 18; + optional int32 max_height = 19; + optional int32 iea = 21; + optional int32 r7 = 23; + optional int64 start_time_ms = 28; + optional int64 time_since_last_seek = 29; + optional int32 visibility = 34; + optional int64 d8 = 36; + optional MediaCapabilities media_capabilities = 38; + optional int32 lact = 39; + // optional int32 Gw = 40; + optional MediaType media_type = 40; + optional int32 player_state = 44; + optional bool a8 = 46; + optional int32 Jda = 48; + optional int32 qw = 50; + optional int32 Ky = 51; + optional int32 Eq = 54; + optional bool l = 56; + optional int32 G7 = 57; + optional bool No = 58; + optional int32 qj = 59; + optional int32 Hx = 60; + optional bool is_prefetch = 61; + optional int32 Iz = 62; + optional bytes sabr_license_constraint = 63; + optional int32 allow_proxima_live_latency = 64; + optional int32 sabr_force_proxima = 66; + optional int32 Tqb = 67; + optional int32 c = 68; + + enum MediaType { + MEDIA_TYPE_DEFAULT = 0; + MEDIA_TYPE_AUDIO = 1; + MEDIA_TYPE_VIDEO = 2; + USE_SERVER_FORMAT_FILTER = 3; + } +} \ No newline at end of file diff --git a/protos/video_streaming/onesie_header.proto b/protos/video_streaming/onesie_header.proto new file mode 100644 index 0000000..1bf91d7 --- /dev/null +++ b/protos/video_streaming/onesie_header.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package video_streaming; + +import "video_streaming/onesie_header_type.proto"; +import "video_streaming/crypto_params.proto"; + +message OnesieHeader { + message Field23 { + optional string video_id = 2; + } + + message Field34 { + repeated string itag_denylist = 1; + } + + optional OnesieHeaderType type = 1; + optional string video_id = 2; + optional string itag = 3; + optional CryptoParams crypto_params = 4; + optional uint64 last_modified = 5; + optional int64 media_size_bytes = 7; + repeated string restricted_formats = 11; + optional string xtags = 15; + optional int64 sequence_number = 18; + optional Field23 field23 = 23; + optional Field34 field34 = 34; +} \ No newline at end of file diff --git a/protos/video_streaming/onesie_header_type.proto b/protos/video_streaming/onesie_header_type.proto new file mode 100644 index 0000000..f82ae69 --- /dev/null +++ b/protos/video_streaming/onesie_header_type.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package video_streaming; + +enum OnesieHeaderType { + PLAYER_RESPONSE = 0; + HEADER_TYPE_1 = 1; + MEDIA_DECRYPTION_KEY = 2; + HEADER_TYPE_3 = 3; + HEADER_TYPE_4 = 4; + HEADER_TYPE_5 = 5; + NEW_HOST = 6; + HEADER_TYPE_7 = 7; + HEADER_TYPE_8 = 8; + HEADER_TYPE_9 = 9; + HEADER_TYPE_10 = 10; + HEADER_TYPE_11 = 11; + HEADER_TYPE_12 = 12; + HEADER_TYPE_13 = 13; + RESTRICTED_FORMATS_HINT = 14; + HEADER_TYPE_15 = 15; + STREAM_METADATA = 16; + HEADER_TYPE_17 = 17; + HEADER_TYPE_18 = 18; + HEADER_TYPE_19 = 19; + HEADER_TYPE_20 = 20; + HEADER_TYPE_21 = 21; + HEADER_TYPE_22 = 22; + HEADER_TYPE_23 = 23; + HEADER_TYPE_24 = 24; + ENCRYPTED_INNERTUBE_RESPONSE_PART = 25; +} \ No newline at end of file diff --git a/protos/video_streaming/onesie_innertube_request.proto b/protos/video_streaming/onesie_innertube_request.proto new file mode 100644 index 0000000..287fac1 --- /dev/null +++ b/protos/video_streaming/onesie_innertube_request.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package video_streaming; + +import "video_streaming/media_info.proto"; +import "video_streaming/encrypted_request.proto"; +import "video_streaming/streamer_context.proto"; + +message OnesieInnertubeRequest { + optional MediaInfo media_info = 2; + optional EncryptedRequest encrypted_request = 3; + optional bytes onesie_ustreamer_config = 4; + optional StreamerContext streamer_context = 10; +} \ No newline at end of file diff --git a/protos/video_streaming/onesie_innertube_response.proto b/protos/video_streaming/onesie_innertube_response.proto new file mode 100644 index 0000000..e720e64 --- /dev/null +++ b/protos/video_streaming/onesie_innertube_response.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package video_streaming; + +import "misc/common.proto"; +import "video_streaming/proxy_status.proto"; + +message OnesieInnertubeResponse { + optional ProxyStatus proxy_status = 1; + optional int32 status = 2; + repeated .misc.HttpHeader headers = 3; + optional bytes body = 4; +} \ No newline at end of file diff --git a/protos/video_streaming/onesie_request.proto b/protos/video_streaming/onesie_request.proto index 08f273e..64c6c16 100644 --- a/protos/video_streaming/onesie_request.proto +++ b/protos/video_streaming/onesie_request.proto @@ -3,7 +3,6 @@ package video_streaming; import "misc/common.proto"; -// @TODO: Add the rest of the request. message OnesieRequest { optional string url = 1; repeated misc.HttpHeader headers = 2; diff --git a/protos/video_streaming/proxy_status.proto b/protos/video_streaming/proxy_status.proto new file mode 100644 index 0000000..91c7559 --- /dev/null +++ b/protos/video_streaming/proxy_status.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package video_streaming; + +enum ProxyStatus { + VAL_0 = 0; + OK = 1; + VAL_2 = 2; + VAL_3 = 3; + VAL_4 = 4; + VAL_5 = 5; + VAL_6 = 6; + VAL_7 = 7; + VAL_8 = 8; + VAL_9 = 9; +} \ No newline at end of file diff --git a/protos/video_streaming/streamer_context.proto b/protos/video_streaming/streamer_context.proto new file mode 100644 index 0000000..044fdee --- /dev/null +++ b/protos/video_streaming/streamer_context.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package video_streaming; + +message StreamerContext { + message ClientInfo { + optional string device_make = 12; + optional string device_model = 13; + optional int32 client_name = 16; + optional string client_version = 17; + optional string os_name = 18; + optional string os_version = 19; + } + + message Fqa { + optional int32 type = 1; + optional bytes value = 2; + } + + message Gqa { + message Hqa { + optional int32 code = 1; + optional string message = 2; + } + + optional bytes field1 = 1; + optional Hqa field2 = 2; + } + + optional ClientInfo client_info = 1; + optional bytes po_token = 2; + optional bytes playback_cookie = 3; + optional bytes gp = 4; + repeated Fqa field5 = 5; + repeated int32 field6 = 6; + optional string field7 = 7; + optional Gqa field8 = 8; +} \ No newline at end of file diff --git a/protos/video_streaming/video_playback_abr_request.proto b/protos/video_streaming/video_playback_abr_request.proto index 8b6c3ce..4b72595 100644 --- a/protos/video_streaming/video_playback_abr_request.proto +++ b/protos/video_streaming/video_playback_abr_request.proto @@ -2,7 +2,9 @@ syntax = "proto3"; package video_streaming; import "misc/common.proto"; +import "video_streaming/media_info.proto"; import "video_streaming/time_range.proto"; +import "video_streaming/streamer_context.proto"; message VideoPlaybackAbrRequest { optional MediaInfo media_info = 1; @@ -12,78 +14,13 @@ message VideoPlaybackAbrRequest { optional Lo lo = 6; repeated .misc.FormatId audio_format_ids = 16; repeated .misc.FormatId video_format_ids = 17; - optional Upa sc = 19; + optional StreamerContext streamer_context = 19; optional OQa field21 = 21; optional int32 field22 = 22; optional int32 field23 = 23; repeated Pqa field1000 = 1000; } -message MediaInfo { - message MediaCapabilities { - repeated VideoFormatCapability video_format_capabilities = 1; - repeated AudioFormatCapability audio_format_capabilities = 2; - optional int32 hdr_mode_bitmask = 5; - - message VideoFormatCapability { - optional int32 video_codec = 1; - optional int32 max_height = 3; - optional int32 max_width = 4; - optional int32 max_framerate = 11; - optional int32 max_bitrate_bps = 12; - optional bool is_10_bit_supported = 15; - } - - message AudioFormatCapability { - optional int32 audio_codec = 1; - optional int32 num_channels = 2; - optional int32 max_bitrate_bps = 3; - optional int32 spatial_capability_bitmask = 6; - } - } - - optional int32 time_since_last_manual_format_selection_ms = 13; - optional int32 last_manual_direction = 14; - optional int32 quality = 16; - optional int32 detailed_network_type = 17; - optional int32 adjusted_width = 18; - optional int32 adjusted_height = 19; - optional int32 iea = 21; - optional int32 r7 = 23; - optional int64 start_time_ms = 28; - optional int64 time_since_last_seek = 29; - optional int32 visibility = 34; - optional int32 d8 = 36; - optional MediaCapabilities media_capabilities = 38; - optional int32 lact = 39; - // optional int32 Gw = 40; - optional MediaType media_type = 40; - optional int32 player_state = 44; - optional bool a8 = 46; - optional int32 Jda = 48; - optional int32 qw = 50; - optional int32 Ky = 51; - optional int32 Eq = 54; - optional bool l = 56; - optional int32 G7 = 57; - optional bool No = 58; - optional int32 qj = 59; - optional int32 Hx = 60; - optional bool is_prefetch = 61; - optional int32 Iz = 62; - optional bytes sabr_license_constraint = 63; - optional int32 allow_proxima_live_latency = 64; - optional int32 sabr_force_proxima = 66; - optional int32 Tqb = 67; - optional int32 c = 68; - - enum MediaType { - MEDIA_TYPE_DEFAULT = 0; - MEDIA_TYPE_AUDIO = 1; - MEDIA_TYPE_VIDEO = 2; - } -} - message Lo { message Field4 { optional int32 field1 = 1; @@ -123,41 +60,6 @@ message Zpa { optional YPa field12 = 12; } -message Upa { - message ClientInfo { - optional string device_make = 12; - optional string device_model = 13; - optional int32 client_name = 16; - optional string client_version = 17; - optional string os_name = 18; - optional string os_version = 19; - } - - message Fqa { - optional int32 type = 1; - optional bytes value = 2; - } - - message Gqa { - message Hqa { - optional int32 code = 1; - optional string message = 2; - } - - optional bytes field1 = 1; - optional Hqa field2 = 2; - } - - optional ClientInfo client_info = 1; - optional bytes po_token = 2; - optional bytes playback_cookie = 3; - optional bytes gp = 4; - repeated Fqa field5 = 5; - repeated int32 field6 = 6; - optional string field7 = 7; - optional Gqa field8 = 8; -} - message OQa { repeated string field1 = 1; optional bytes field2 = 2;