static parseFromAdaptationSet(elements, ignoreDrmInfo, keySystemsByURI) {
    const ContentProtection = shaka.dash.ContentProtection;
    const ManifestParserUtils = shaka.util.ManifestParserUtils;
    const parsed = ContentProtection.parseElements_(elements);
    /** @type {Array<shaka.extern.InitDataOverride>} */
    let defaultInit = null;
    /** @type {!Array<shaka.extern.DrmInfo>} */
    let drmInfos = [];
    let parsedNonCenc = [];
    /** @type {?shaka.dash.ContentProtection.Aes128Info} */
    let aes128Info = null;

    // Get the default key ID; if there are multiple, they must all match.
    const keyIds = new Set(parsed.map((element) => element.keyId));
    // Remove any possible null value (elements may have no key ids).
    keyIds.delete(null);

    let encryptionScheme = 'cenc';

    if (keyIds.size > 1) {
      throw new shaka.util.Error(
          shaka.util.Error.Severity.CRITICAL,
          shaka.util.Error.Category.MANIFEST,
          shaka.util.Error.Code.DASH_CONFLICTING_KEY_IDS);
    }

    if (!ignoreDrmInfo) {
      const aes128Elements = parsed.filter((elem) => {
        return elem.schemeUri == ContentProtection.Aes128Protection_;
      });

      if (aes128Elements.length > 1) {
        throw new shaka.util.Error(
            shaka.util.Error.Severity.CRITICAL,
            shaka.util.Error.Category.MANIFEST,
            shaka.util.Error.Code.DASH_CONFLICTING_AES_128);
      }

      if (aes128Elements.length) {
        aes128Info = ContentProtection.parseAes128_(aes128Elements[0]);
      }

      const mp4ProtectionParsed = parsed.find((elem) => {
        return elem.schemeUri == ContentProtection.MP4Protection_;
      });

      if (mp4ProtectionParsed && mp4ProtectionParsed.encryptionScheme) {
        encryptionScheme = mp4ProtectionParsed.encryptionScheme;
      }

      // Find the default key ID and init data.  Create a new array of all the
      // non-CENC elements.
      parsedNonCenc = parsed.filter((elem) => {
        if (elem.schemeUri == ContentProtection.MP4Protection_) {
          goog.asserts.assert(!elem.init || elem.init.length,
              'Init data must be null or non-empty.');
          defaultInit = elem.init || defaultInit;
          return false;
        } else {
          return elem.schemeUri != ContentProtection.Aes128Protection_;
        }
      });

      if (parsedNonCenc.length) {
        drmInfos = ContentProtection.convertElements_(defaultInit,
            encryptionScheme, parsedNonCenc, keySystemsByURI, keyIds);

        // If there are no drmInfos after parsing, then add a dummy entry.
        // This may be removed in parseKeyIds.
        if (drmInfos.length == 0) {
          drmInfos = [ManifestParserUtils.createDrmInfo(
              '', encryptionScheme, defaultInit)];
        }
      }
    }

    // If there are only CENC element(s) or ignoreDrmInfo flag is set, assume
    // all key-systems are supported.
    if (parsed.length && !aes128Info &&
        (ignoreDrmInfo || !parsedNonCenc.length)) {
      drmInfos = [];

      for (const keySystem of Object.values(keySystemsByURI)) {
        // If the manifest doesn't specify any key systems, we shouldn't
        // put clearkey in this list.  Otherwise, it may be triggered when
        // a real key system should be used instead.
        if (keySystem != 'org.w3.clearkey') {
          const info = ManifestParserUtils.createDrmInfo(
              keySystem, encryptionScheme, defaultInit);
          drmInfos.push(info);
        }
      }
    }

    // If we have a default key id, apply it to every initData.
    const defaultKeyId = Array.from(keyIds)[0] || null;

    if (defaultKeyId) {
      for (const info of drmInfos) {
        for (const initData of info.initData) {
          initData.keyId = defaultKeyId;
        }
      }
    }

    return {
      defaultKeyId: defaultKeyId,
      defaultInit: defaultInit,
      drmInfos: drmInfos,
      aes128Info: aes128Info,
      firstRepresentation: true,
    };
  }
Parses info from the ContentProtection elements at the AdaptationSet level.

@param {!Array<!shaka.extern.xml.Node>} elements
@param {boolean} ignoreDrmInfo
@param {!Object<string, string>} keySystemsByURI
@return {shaka.dash.ContentProtection.Context}