mirror of
https://github.com/LuanRT/googlevideo.git
synced 2026-06-13 08:42:31 +00:00
153 lines
5.0 KiB
TypeScript
153 lines
5.0 KiB
TypeScript
// 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/playback_cookie.proto
|
|
|
|
/* eslint-disable */
|
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
import { FormatId } from "../misc/common.js";
|
|
|
|
export const protobufPackage = "video_streaming";
|
|
|
|
export interface PlaybackCookie {
|
|
/** Always 999999?? */
|
|
field1?: number | undefined;
|
|
field2?: number | undefined;
|
|
videoFmt?: FormatId | undefined;
|
|
audioFmt?: FormatId | undefined;
|
|
}
|
|
|
|
function createBasePlaybackCookie(): PlaybackCookie {
|
|
return { field1: 0, field2: 0, videoFmt: undefined, audioFmt: undefined };
|
|
}
|
|
|
|
export const PlaybackCookie: MessageFns<PlaybackCookie> = {
|
|
encode(message: PlaybackCookie, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.field1 !== undefined && message.field1 !== 0) {
|
|
writer.uint32(8).int32(message.field1);
|
|
}
|
|
if (message.field2 !== undefined && message.field2 !== 0) {
|
|
writer.uint32(16).int32(message.field2);
|
|
}
|
|
if (message.videoFmt !== undefined) {
|
|
FormatId.encode(message.videoFmt, writer.uint32(58).fork()).join();
|
|
}
|
|
if (message.audioFmt !== undefined) {
|
|
FormatId.encode(message.audioFmt, writer.uint32(66).fork()).join();
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): PlaybackCookie {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBasePlaybackCookie();
|
|
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 7:
|
|
if (tag !== 58) {
|
|
break;
|
|
}
|
|
|
|
message.videoFmt = FormatId.decode(reader, reader.uint32());
|
|
continue;
|
|
case 8:
|
|
if (tag !== 66) {
|
|
break;
|
|
}
|
|
|
|
message.audioFmt = FormatId.decode(reader, reader.uint32());
|
|
continue;
|
|
}
|
|
if ((tag & 7) === 4 || tag === 0) {
|
|
break;
|
|
}
|
|
reader.skip(tag & 7);
|
|
}
|
|
return message;
|
|
},
|
|
|
|
fromJSON(object: any): PlaybackCookie {
|
|
return {
|
|
field1: isSet(object.field1) ? globalThis.Number(object.field1) : 0,
|
|
field2: isSet(object.field2) ? globalThis.Number(object.field2) : 0,
|
|
videoFmt: isSet(object.videoFmt) ? FormatId.fromJSON(object.videoFmt) : undefined,
|
|
audioFmt: isSet(object.audioFmt) ? FormatId.fromJSON(object.audioFmt) : undefined,
|
|
};
|
|
},
|
|
|
|
toJSON(message: PlaybackCookie): unknown {
|
|
const obj: any = {};
|
|
if (message.field1 !== undefined && message.field1 !== 0) {
|
|
obj.field1 = Math.round(message.field1);
|
|
}
|
|
if (message.field2 !== undefined && message.field2 !== 0) {
|
|
obj.field2 = Math.round(message.field2);
|
|
}
|
|
if (message.videoFmt !== undefined) {
|
|
obj.videoFmt = FormatId.toJSON(message.videoFmt);
|
|
}
|
|
if (message.audioFmt !== undefined) {
|
|
obj.audioFmt = FormatId.toJSON(message.audioFmt);
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<PlaybackCookie>, I>>(base?: I): PlaybackCookie {
|
|
return PlaybackCookie.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<PlaybackCookie>, I>>(object: I): PlaybackCookie {
|
|
const message = createBasePlaybackCookie();
|
|
message.field1 = object.field1 ?? 0;
|
|
message.field2 = object.field2 ?? 0;
|
|
message.videoFmt = (object.videoFmt !== undefined && object.videoFmt !== null)
|
|
? FormatId.fromPartial(object.videoFmt)
|
|
: undefined;
|
|
message.audioFmt = (object.audioFmt !== undefined && object.audioFmt !== null)
|
|
? FormatId.fromPartial(object.audioFmt)
|
|
: undefined;
|
|
return message;
|
|
},
|
|
};
|
|
|
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
|
|
export type DeepPartial<T> = T extends Builtin ? T
|
|
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
: Partial<T>;
|
|
|
|
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
|
|
function isSet(value: any): boolean {
|
|
return value !== null && value !== undefined;
|
|
}
|
|
|
|
export interface MessageFns<T> {
|
|
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
fromJSON(object: any): T;
|
|
toJSON(message: T): unknown;
|
|
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
}
|