Java Code Examples for com.google.android.exoplayer2.util.Log#d()

The following examples show how to use com.google.android.exoplayer2.util.Log#d() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultDrmSession.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@RequiresNonNull("sessionId")
private void doLicense(boolean allowRetry) {
  if (isPlaceholderSession) {
    return;
  }
  byte[] sessionId = Util.castNonNull(this.sessionId);
  switch (mode) {
    case DefaultDrmSessionManager.MODE_PLAYBACK:
    case DefaultDrmSessionManager.MODE_QUERY:
      if (offlineLicenseKeySetId == null) {
        postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_STREAMING, allowRetry);
      } else if (state == STATE_OPENED_WITH_KEYS || restoreKeys()) {
        long licenseDurationRemainingSec = getLicenseDurationRemainingSec();
        if (mode == DefaultDrmSessionManager.MODE_PLAYBACK
            && licenseDurationRemainingSec <= MAX_LICENSE_DURATION_TO_RENEW_SECONDS) {
          Log.d(
              TAG,
              "Offline license has expired or will expire soon. "
                  + "Remaining seconds: "
                  + licenseDurationRemainingSec);
          postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
        } else if (licenseDurationRemainingSec <= 0) {
          onError(new KeysExpiredException());
        } else {
          state = STATE_OPENED_WITH_KEYS;
          eventDispatcher.dispatch(DefaultDrmSessionEventListener::onDrmKeysRestored);
        }
      }
      break;
    case DefaultDrmSessionManager.MODE_DOWNLOAD:
      if (offlineLicenseKeySetId == null || restoreKeys()) {
        postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
      }
      break;
    case DefaultDrmSessionManager.MODE_RELEASE:
      Assertions.checkNotNull(offlineLicenseKeySetId);
      Assertions.checkNotNull(this.sessionId);
      // It's not necessary to restore the key (and open a session to do that) before releasing it
      // but this serves as a good sanity/fast-failure check.
      if (restoreKeys()) {
        postKeyRequest(offlineLicenseKeySetId, ExoMediaDrm.KEY_TYPE_RELEASE, allowRetry);
      }
      break;
    default:
      break;
  }
}
 
Example 2
Source File: MetadataUtil.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/**
 * Parses a single userdata ilst element from a {@link ParsableByteArray}. The element is read
 * starting from the current position of the {@link ParsableByteArray}, and the position is
 * advanced by the size of the element. The position is advanced even if the element's type is
 * unrecognized.
 *
 * @param ilst Holds the data to be parsed.
 * @return The parsed element, or null if the element's type was not recognized.
 */
@Nullable
public static Metadata.Entry parseIlstElement(ParsableByteArray ilst) {
  int position = ilst.getPosition();
  int endPosition = position + ilst.readInt();
  int type = ilst.readInt();
  int typeTopByte = (type >> 24) & 0xFF;
  try {
    if (typeTopByte == TYPE_TOP_BYTE_COPYRIGHT || typeTopByte == TYPE_TOP_BYTE_REPLACEMENT) {
      int shortType = type & 0x00FFFFFF;
      if (shortType == SHORT_TYPE_COMMENT) {
        return parseCommentAttribute(type, ilst);
      } else if (shortType == SHORT_TYPE_NAME_1 || shortType == SHORT_TYPE_NAME_2) {
        return parseTextAttribute(type, "TIT2", ilst);
      } else if (shortType == SHORT_TYPE_COMPOSER_1 || shortType == SHORT_TYPE_COMPOSER_2) {
        return parseTextAttribute(type, "TCOM", ilst);
      } else if (shortType == SHORT_TYPE_YEAR) {
        return parseTextAttribute(type, "TDRC", ilst);
      } else if (shortType == SHORT_TYPE_ARTIST) {
        return parseTextAttribute(type, "TPE1", ilst);
      } else if (shortType == SHORT_TYPE_ENCODER) {
        return parseTextAttribute(type, "TSSE", ilst);
      } else if (shortType == SHORT_TYPE_ALBUM) {
        return parseTextAttribute(type, "TALB", ilst);
      } else if (shortType == SHORT_TYPE_LYRICS) {
        return parseTextAttribute(type, "USLT", ilst);
      } else if (shortType == SHORT_TYPE_GENRE) {
        return parseTextAttribute(type, "TCON", ilst);
      } else if (shortType == TYPE_GROUPING) {
        return parseTextAttribute(type, "TIT1", ilst);
      }
    } else if (type == TYPE_GENRE) {
      return parseStandardGenreAttribute(ilst);
    } else if (type == TYPE_DISK_NUMBER) {
      return parseIndexAndCountAttribute(type, "TPOS", ilst);
    } else if (type == TYPE_TRACK_NUMBER) {
      return parseIndexAndCountAttribute(type, "TRCK", ilst);
    } else if (type == TYPE_TEMPO) {
      return parseUint8Attribute(type, "TBPM", ilst, true, false);
    } else if (type == TYPE_COMPILATION) {
      return parseUint8Attribute(type, "TCMP", ilst, true, true);
    } else if (type == TYPE_COVER_ART) {
      return parseCoverArt(ilst);
    } else if (type == TYPE_ALBUM_ARTIST) {
      return parseTextAttribute(type, "TPE2", ilst);
    } else if (type == TYPE_SORT_TRACK_NAME) {
      return parseTextAttribute(type, "TSOT", ilst);
    } else if (type == TYPE_SORT_ALBUM) {
      return parseTextAttribute(type, "TSO2", ilst);
    } else if (type == TYPE_SORT_ARTIST) {
      return parseTextAttribute(type, "TSOA", ilst);
    } else if (type == TYPE_SORT_ALBUM_ARTIST) {
      return parseTextAttribute(type, "TSOP", ilst);
    } else if (type == TYPE_SORT_COMPOSER) {
      return parseTextAttribute(type, "TSOC", ilst);
    } else if (type == TYPE_RATING) {
      return parseUint8Attribute(type, "ITUNESADVISORY", ilst, false, false);
    } else if (type == TYPE_GAPLESS_ALBUM) {
      return parseUint8Attribute(type, "ITUNESGAPLESS", ilst, false, true);
    } else if (type == TYPE_TV_SORT_SHOW) {
      return parseTextAttribute(type, "TVSHOWSORT", ilst);
    } else if (type == TYPE_TV_SHOW) {
      return parseTextAttribute(type, "TVSHOW", ilst);
    } else if (type == TYPE_INTERNAL) {
      return parseInternalAttribute(ilst, endPosition);
    }
    Log.d(TAG, "Skipped unknown metadata entry: " + Atom.getAtomTypeString(type));
    return null;
  } finally {
    ilst.setPosition(endPosition);
  }
}
 
Example 3
Source File: PlatformScheduler.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private static void logd(String message) {
  if (DEBUG) {
    Log.d(TAG, message);
  }
}
 
Example 4
Source File: MediaCodecInfo.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private void logNoSupport(String message) {
  Log.d(TAG, "NoSupport [" + message + "] [" + name + ", " + mimeType + "] ["
      + Util.DEVICE_DEBUG_INFO + "]");
}
 
Example 5
Source File: MediaCodecInfo.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private void logAssumedSupport(String message) {
  Log.d(TAG, "AssumedSupport [" + message + "] [" + name + ", " + mimeType + "] ["
      + Util.DEVICE_DEBUG_INFO + "]");
}
 
Example 6
Source File: DefaultDrmSession.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@RequiresNonNull("sessionId")
private void doLicense(boolean allowRetry) {
  switch (mode) {
    case DefaultDrmSessionManager.MODE_PLAYBACK:
    case DefaultDrmSessionManager.MODE_QUERY:
      if (offlineLicenseKeySetId == null) {
        postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_STREAMING, allowRetry);
      } else if (state == STATE_OPENED_WITH_KEYS || restoreKeys()) {
        long licenseDurationRemainingSec = getLicenseDurationRemainingSec();
        if (mode == DefaultDrmSessionManager.MODE_PLAYBACK
            && licenseDurationRemainingSec <= MAX_LICENSE_DURATION_TO_RENEW) {
          Log.d(TAG, "Offline license has expired or will expire soon. "
              + "Remaining seconds: " + licenseDurationRemainingSec);
          postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
        } else if (licenseDurationRemainingSec <= 0) {
          onError(new KeysExpiredException());
        } else {
          state = STATE_OPENED_WITH_KEYS;
          eventDispatcher.dispatch(DefaultDrmSessionEventListener::onDrmKeysRestored);
        }
      }
      break;
    case DefaultDrmSessionManager.MODE_DOWNLOAD:
      if (offlineLicenseKeySetId == null) {
        postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
      } else {
        // Renew
        if (restoreKeys()) {
          postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
        }
      }
      break;
    case DefaultDrmSessionManager.MODE_RELEASE:
      Assertions.checkNotNull(offlineLicenseKeySetId);
      // It's not necessary to restore the key (and open a session to do that) before releasing it
      // but this serves as a good sanity/fast-failure check.
      if (restoreKeys()) {
        postKeyRequest(offlineLicenseKeySetId, ExoMediaDrm.KEY_TYPE_RELEASE, allowRetry);
      }
      break;
    default:
      break;
  }
}
 
Example 7
Source File: MetadataUtil.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Parses a single userdata ilst element from a {@link ParsableByteArray}. The element is read
 * starting from the current position of the {@link ParsableByteArray}, and the position is
 * advanced by the size of the element. The position is advanced even if the element's type is
 * unrecognized.
 *
 * @param ilst Holds the data to be parsed.
 * @return The parsed element, or null if the element's type was not recognized.
 */
@Nullable
public static Metadata.Entry parseIlstElement(ParsableByteArray ilst) {
  int position = ilst.getPosition();
  int endPosition = position + ilst.readInt();
  int type = ilst.readInt();
  int typeTopByte = (type >> 24) & 0xFF;
  try {
    if (typeTopByte == TYPE_TOP_BYTE_COPYRIGHT || typeTopByte == TYPE_TOP_BYTE_REPLACEMENT) {
      int shortType = type & 0x00FFFFFF;
      if (shortType == SHORT_TYPE_COMMENT) {
        return parseCommentAttribute(type, ilst);
      } else if (shortType == SHORT_TYPE_NAME_1 || shortType == SHORT_TYPE_NAME_2) {
        return parseTextAttribute(type, "TIT2", ilst);
      } else if (shortType == SHORT_TYPE_COMPOSER_1 || shortType == SHORT_TYPE_COMPOSER_2) {
        return parseTextAttribute(type, "TCOM", ilst);
      } else if (shortType == SHORT_TYPE_YEAR) {
        return parseTextAttribute(type, "TDRC", ilst);
      } else if (shortType == SHORT_TYPE_ARTIST) {
        return parseTextAttribute(type, "TPE1", ilst);
      } else if (shortType == SHORT_TYPE_ENCODER) {
        return parseTextAttribute(type, "TSSE", ilst);
      } else if (shortType == SHORT_TYPE_ALBUM) {
        return parseTextAttribute(type, "TALB", ilst);
      } else if (shortType == SHORT_TYPE_LYRICS) {
        return parseTextAttribute(type, "USLT", ilst);
      } else if (shortType == SHORT_TYPE_GENRE) {
        return parseTextAttribute(type, "TCON", ilst);
      } else if (shortType == TYPE_GROUPING) {
        return parseTextAttribute(type, "TIT1", ilst);
      }
    } else if (type == TYPE_GENRE) {
      return parseStandardGenreAttribute(ilst);
    } else if (type == TYPE_DISK_NUMBER) {
      return parseIndexAndCountAttribute(type, "TPOS", ilst);
    } else if (type == TYPE_TRACK_NUMBER) {
      return parseIndexAndCountAttribute(type, "TRCK", ilst);
    } else if (type == TYPE_TEMPO) {
      return parseUint8Attribute(type, "TBPM", ilst, true, false);
    } else if (type == TYPE_COMPILATION) {
      return parseUint8Attribute(type, "TCMP", ilst, true, true);
    } else if (type == TYPE_COVER_ART) {
      return parseCoverArt(ilst);
    } else if (type == TYPE_ALBUM_ARTIST) {
      return parseTextAttribute(type, "TPE2", ilst);
    } else if (type == TYPE_SORT_TRACK_NAME) {
      return parseTextAttribute(type, "TSOT", ilst);
    } else if (type == TYPE_SORT_ALBUM) {
      return parseTextAttribute(type, "TSO2", ilst);
    } else if (type == TYPE_SORT_ARTIST) {
      return parseTextAttribute(type, "TSOA", ilst);
    } else if (type == TYPE_SORT_ALBUM_ARTIST) {
      return parseTextAttribute(type, "TSOP", ilst);
    } else if (type == TYPE_SORT_COMPOSER) {
      return parseTextAttribute(type, "TSOC", ilst);
    } else if (type == TYPE_RATING) {
      return parseUint8Attribute(type, "ITUNESADVISORY", ilst, false, false);
    } else if (type == TYPE_GAPLESS_ALBUM) {
      return parseUint8Attribute(type, "ITUNESGAPLESS", ilst, false, true);
    } else if (type == TYPE_TV_SORT_SHOW) {
      return parseTextAttribute(type, "TVSHOWSORT", ilst);
    } else if (type == TYPE_TV_SHOW) {
      return parseTextAttribute(type, "TVSHOW", ilst);
    } else if (type == TYPE_INTERNAL) {
      return parseInternalAttribute(ilst, endPosition);
    }
    Log.d(TAG, "Skipped unknown metadata entry: " + Atom.getAtomTypeString(type));
    return null;
  } finally {
    ilst.setPosition(endPosition);
  }
}
 
Example 8
Source File: PlatformScheduler.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private static void logd(String message) {
  if (DEBUG) {
    Log.d(TAG, message);
  }
}
 
Example 9
Source File: MediaCodecInfo.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private void logNoSupport(String message) {
  Log.d(TAG, "NoSupport [" + message + "] [" + name + ", " + mimeType + "] ["
      + Util.DEVICE_DEBUG_INFO + "]");
}
 
Example 10
Source File: MediaCodecInfo.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private void logAssumedSupport(String message) {
  Log.d(TAG, "AssumedSupport [" + message + "] [" + name + ", " + mimeType + "] ["
      + Util.DEVICE_DEBUG_INFO + "]");
}
 
Example 11
Source File: DefaultDrmSession.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@RequiresNonNull("sessionId")
private void doLicense(boolean allowRetry) {
  switch (mode) {
    case DefaultDrmSessionManager.MODE_PLAYBACK:
    case DefaultDrmSessionManager.MODE_QUERY:
      if (offlineLicenseKeySetId == null) {
        postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_STREAMING, allowRetry);
      } else if (state == STATE_OPENED_WITH_KEYS || restoreKeys()) {
        long licenseDurationRemainingSec = getLicenseDurationRemainingSec();
        if (mode == DefaultDrmSessionManager.MODE_PLAYBACK
            && licenseDurationRemainingSec <= MAX_LICENSE_DURATION_TO_RENEW) {
          Log.d(TAG, "Offline license has expired or will expire soon. "
              + "Remaining seconds: " + licenseDurationRemainingSec);
          postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
        } else if (licenseDurationRemainingSec <= 0) {
          onError(new KeysExpiredException());
        } else {
          state = STATE_OPENED_WITH_KEYS;
          eventDispatcher.dispatch(DefaultDrmSessionEventListener::onDrmKeysRestored);
        }
      }
      break;
    case DefaultDrmSessionManager.MODE_DOWNLOAD:
      if (offlineLicenseKeySetId == null) {
        postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
      } else {
        // Renew
        if (restoreKeys()) {
          postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
        }
      }
      break;
    case DefaultDrmSessionManager.MODE_RELEASE:
      Assertions.checkNotNull(offlineLicenseKeySetId);
      // It's not necessary to restore the key (and open a session to do that) before releasing it
      // but this serves as a good sanity/fast-failure check.
      if (restoreKeys()) {
        postKeyRequest(offlineLicenseKeySetId, ExoMediaDrm.KEY_TYPE_RELEASE, allowRetry);
      }
      break;
    default:
      break;
  }
}
 
Example 12
Source File: MetadataUtil.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Parses a single userdata ilst element from a {@link ParsableByteArray}. The element is read
 * starting from the current position of the {@link ParsableByteArray}, and the position is
 * advanced by the size of the element. The position is advanced even if the element's type is
 * unrecognized.
 *
 * @param ilst Holds the data to be parsed.
 * @return The parsed element, or null if the element's type was not recognized.
 */
@Nullable
public static Metadata.Entry parseIlstElement(ParsableByteArray ilst) {
  int position = ilst.getPosition();
  int endPosition = position + ilst.readInt();
  int type = ilst.readInt();
  int typeTopByte = (type >> 24) & 0xFF;
  try {
    if (typeTopByte == TYPE_TOP_BYTE_COPYRIGHT || typeTopByte == TYPE_TOP_BYTE_REPLACEMENT) {
      int shortType = type & 0x00FFFFFF;
      if (shortType == SHORT_TYPE_COMMENT) {
        return parseCommentAttribute(type, ilst);
      } else if (shortType == SHORT_TYPE_NAME_1 || shortType == SHORT_TYPE_NAME_2) {
        return parseTextAttribute(type, "TIT2", ilst);
      } else if (shortType == SHORT_TYPE_COMPOSER_1 || shortType == SHORT_TYPE_COMPOSER_2) {
        return parseTextAttribute(type, "TCOM", ilst);
      } else if (shortType == SHORT_TYPE_YEAR) {
        return parseTextAttribute(type, "TDRC", ilst);
      } else if (shortType == SHORT_TYPE_ARTIST) {
        return parseTextAttribute(type, "TPE1", ilst);
      } else if (shortType == SHORT_TYPE_ENCODER) {
        return parseTextAttribute(type, "TSSE", ilst);
      } else if (shortType == SHORT_TYPE_ALBUM) {
        return parseTextAttribute(type, "TALB", ilst);
      } else if (shortType == SHORT_TYPE_LYRICS) {
        return parseTextAttribute(type, "USLT", ilst);
      } else if (shortType == SHORT_TYPE_GENRE) {
        return parseTextAttribute(type, "TCON", ilst);
      } else if (shortType == TYPE_GROUPING) {
        return parseTextAttribute(type, "TIT1", ilst);
      }
    } else if (type == TYPE_GENRE) {
      return parseStandardGenreAttribute(ilst);
    } else if (type == TYPE_DISK_NUMBER) {
      return parseIndexAndCountAttribute(type, "TPOS", ilst);
    } else if (type == TYPE_TRACK_NUMBER) {
      return parseIndexAndCountAttribute(type, "TRCK", ilst);
    } else if (type == TYPE_TEMPO) {
      return parseUint8Attribute(type, "TBPM", ilst, true, false);
    } else if (type == TYPE_COMPILATION) {
      return parseUint8Attribute(type, "TCMP", ilst, true, true);
    } else if (type == TYPE_COVER_ART) {
      return parseCoverArt(ilst);
    } else if (type == TYPE_ALBUM_ARTIST) {
      return parseTextAttribute(type, "TPE2", ilst);
    } else if (type == TYPE_SORT_TRACK_NAME) {
      return parseTextAttribute(type, "TSOT", ilst);
    } else if (type == TYPE_SORT_ALBUM) {
      return parseTextAttribute(type, "TSO2", ilst);
    } else if (type == TYPE_SORT_ARTIST) {
      return parseTextAttribute(type, "TSOA", ilst);
    } else if (type == TYPE_SORT_ALBUM_ARTIST) {
      return parseTextAttribute(type, "TSOP", ilst);
    } else if (type == TYPE_SORT_COMPOSER) {
      return parseTextAttribute(type, "TSOC", ilst);
    } else if (type == TYPE_RATING) {
      return parseUint8Attribute(type, "ITUNESADVISORY", ilst, false, false);
    } else if (type == TYPE_GAPLESS_ALBUM) {
      return parseUint8Attribute(type, "ITUNESGAPLESS", ilst, false, true);
    } else if (type == TYPE_TV_SORT_SHOW) {
      return parseTextAttribute(type, "TVSHOWSORT", ilst);
    } else if (type == TYPE_TV_SHOW) {
      return parseTextAttribute(type, "TVSHOW", ilst);
    } else if (type == TYPE_INTERNAL) {
      return parseInternalAttribute(ilst, endPosition);
    }
    Log.d(TAG, "Skipped unknown metadata entry: " + Atom.getAtomTypeString(type));
    return null;
  } finally {
    ilst.setPosition(endPosition);
  }
}
 
Example 13
Source File: PlatformScheduler.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private static void logd(String message) {
  if (DEBUG) {
    Log.d(TAG, message);
  }
}
 
Example 14
Source File: MediaCodecInfo.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private void logNoSupport(String message) {
  Log.d(TAG, "NoSupport [" + message + "] [" + name + ", " + mimeType + "] ["
      + Util.DEVICE_DEBUG_INFO + "]");
}
 
Example 15
Source File: MediaCodecInfo.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private void logAssumedSupport(String message) {
  Log.d(TAG, "AssumedSupport [" + message + "] [" + name + ", " + mimeType + "] ["
      + Util.DEVICE_DEBUG_INFO + "]");
}