UNPKG

googlevideo

Version:

A set of utilities for working with Google Video APIs.

69 lines (68 loc) 2.46 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.2.0 // protoc v3.21.12 // source: video_streaming/time_range.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "video_streaming"; function createBaseTimeRange() { return { start: 0, duration: 0, timescale: 0 }; } export const TimeRange = { encode(message, writer = new BinaryWriter()) { if (message.start !== undefined && message.start !== 0) { writer.uint32(8).int64(message.start); } if (message.duration !== undefined && message.duration !== 0) { writer.uint32(16).int64(message.duration); } if (message.timescale !== undefined && message.timescale !== 0) { writer.uint32(24).int32(message.timescale); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTimeRange(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 8) { break; } message.start = longToNumber(reader.int64()); continue; case 2: if (tag !== 16) { break; } message.duration = longToNumber(reader.int64()); continue; case 3: if (tag !== 24) { break; } message.timescale = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, }; function longToNumber(int64) { 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; }