tests/contents/utils/patchSegmentWithTimeOffset.js
/**
   * Process styp and make sure lmsg presence follows the lmsg flag parameter.
   * @param {Uint8Array} input
   * @return {Uint8Array} patched box
   */
Process styp and make sure lmsg presence follows the lmsg flag parameter.
@param {Uint8Array} input
@return {Uint8Array} patched box
Process styp and make sure lmsg presence follows the lmsg flag parameter . @param { Uint8Array } input @return { Uint8Array } patched box
function patchStyp(input) {
    const size = be4toi(input, 0);
    let pos = 8;
    const brands = [];
    while (pos < size) {
      const brand = input.subarray(pos, pos + 4);
      if (bytesToStr(brand) !== "lmsg") {
        brands.push(brand);
      }
      pos += 4;
    }
    if (lmsg) {
      brands.push(strToBytes("lmsg"));
    }
    const dataSize = brands.length * 4;
    const stypData = new Uint8Array(dataSize);
    for (let i = 0; i < brands.length; i++) {
      stypData.set(brands[i], i * 4);
    }
    return Atom("styp", stypData);
  }
function patchStyp ( input ) { const size = be4toi ( input , 0 ) ; let pos = 8 ; const brands = [ ] ; while ( pos < size ) { const brand = input . subarray ( pos , pos + 4 ) ; if ( bytesToStr ( brand ) !== "lmsg" ) { brands . push ( brand ) ; } pos += 4 ; } if ( lmsg ) { brands . push ( strToBytes ( "lmsg" ) ) ; } const dataSize = brands . length * 4 ; const stypData = new Uint8Array ( dataSize ) ; for ( let i = 0 ; i < brands . length ; i ++ ) { stypData . set ( brands [ i ] , i * 4 ) ; } return Atom ( "styp" , stypData ) ; }
Process styp and make sure lmsg presence follows the lmsg flag parameter.
Process styp and make sure lmsg presence follows the lmsg flag parameter .