How to use the token-types.UINT64_BE function in token-types

To help you get started, we’ve selected a few token-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Borewit / music-metadata / lib / ebml / EbmlParser.ts View on Github external
const segInfo: ISegmentInformation = {};

    while (this.tokenizer.position < posDone) {
      const e = await this.readElement();
      switch (e.id) {
        case 0x73a4: // SegmentUID
          segInfo.uid = await this.readBuffer(e);
          break;
        case 0x4489: // Duration
          segInfo.duration = await this.readFloat(e);
          break;
        case 0x2ad7b1: // TimecodeScale
          segInfo.timecodeScale = await this.readUint(e);
          break;
        case 0x4461: // DateUTC
          segInfo.dateUTC = await this.tokenizer.readNumber(Token.UINT64_BE);
          break;
        case 0x7ba9: // Title
          segInfo.title = await this.readString(e);
          break;
        case 0x4d80: // MuxingApp
          segInfo.muxingApp = await this.readString(e);
          break;
        case 0x5741: // WritingApp
          segInfo.writingApp = await this.readString(e);
          break;
        default:
          debug(`parseSegmentInformation: level=${level} unknown element: id=${e.id.toString(16)}`);
          await this.tokenizer.ignore(e.len); // ignore payload
      }
    }
    return segInfo;
github Borewit / music-metadata / lib / mp4 / AtomToken.ts View on Github external
return {
      length,
      name: FourCcToken.get(buf, off + 4)
    };
  },

  put: (buf: Buffer, off: number, hdr: IAtomHeader) => {
    Token.UINT32_BE.put(buf, off, hdr.length);
    return FourCcToken.put(buf, off + 4, hdr.name);
  }
};

/**
 * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html#//apple_ref/doc/uid/TP40000939-CH203-38190
 */
export const ExtendedSize = Token.UINT64_BE;

export const ftyp: IGetToken = {
  len: 4,

  get: (buf: Buffer, off: number): IAtomFtyp => {
    return {
      type: new Token.StringType(4, 'ascii').get(buf, off)
    };
  }
};

export const tkhd: IGetToken = {
  len: 4,

  get: (buf: Buffer, off: number): IAtomFtyp => {
    return {