android.media.MediaCrypto#android.media.MediaCryptoException源码实例Demo

下面列出了android.media.MediaCrypto#android.media.MediaCryptoException 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MediaSDK   文件: FrameworkMediaDrm.java
@Override
public FrameworkMediaCrypto createMediaCrypto(byte[] initData) throws MediaCryptoException {
  // Work around a bug prior to Lollipop where L1 Widevine forced into L3 mode would still
  // indicate that it required secure video decoders [Internal ref: b/11428937].
  boolean forceAllowInsecureDecoderComponents = Util.SDK_INT < 21
      && C.WIDEVINE_UUID.equals(uuid) && "L3".equals(getPropertyString("securityLevel"));
  return new FrameworkMediaCrypto(
      adjustUuid(uuid), initData, forceAllowInsecureDecoderComponents);
}
 
源代码2 项目: MediaSDK   文件: MediaCodecRenderer.java
@TargetApi(23)
private void updateDrmSessionOrReinitializeCodecV23() throws ExoPlaybackException {
  FrameworkMediaCrypto sessionMediaCrypto = sourceDrmSession.getMediaCrypto();
  if (sessionMediaCrypto == null) {
    // We'd only expect this to happen if the CDM from which the pending session is obtained needs
    // provisioning. This is unlikely to happen (it probably requires a switch from one DRM scheme
    // to another, where the new CDM hasn't been used before and needs provisioning). It would be
    // possible to handle this case more efficiently (i.e. with a new renderer state that waits
    // for provisioning to finish and then calls mediaCrypto.setMediaDrmSession), but the extra
    // complexity is not warranted given how unlikely the case is to occur.
    reinitializeCodec();
    return;
  }
  if (C.PLAYREADY_UUID.equals(sessionMediaCrypto.uuid)) {
    // The PlayReady CDM does not implement setMediaDrmSession.
    // TODO: Add API check once [Internal ref: b/128835874] is fixed.
    reinitializeCodec();
    return;
  }

  if (flushOrReinitializeCodec()) {
    // The codec was reinitialized. The new codec will be using the new DRM session, so there's
    // nothing more to do.
    return;
  }

  try {
    mediaCrypto.setMediaDrmSession(sessionMediaCrypto.sessionId);
  } catch (MediaCryptoException e) {
    throw createRendererException(e, inputFormat);
  }
  setCodecDrmSession(sourceDrmSession);
  codecDrainState = DRAIN_STATE_NONE;
  codecDrainAction = DRAIN_ACTION_NONE;
}
 
源代码3 项目: TelePlus-Android   文件: FrameworkMediaDrm.java
@Override
public FrameworkMediaCrypto createMediaCrypto(byte[] initData) throws MediaCryptoException {
  // Work around a bug prior to Lollipop where L1 Widevine forced into L3 mode would still
  // indicate that it required secure video decoders [Internal ref: b/11428937].
  boolean forceAllowInsecureDecoderComponents = Util.SDK_INT < 21
      && C.WIDEVINE_UUID.equals(uuid) && "L3".equals(getPropertyString("securityLevel"));
  return new FrameworkMediaCrypto(new MediaCrypto(uuid, initData),
      forceAllowInsecureDecoderComponents);
}
 
源代码4 项目: TelePlus-Android   文件: FrameworkMediaDrm.java
@Override
public FrameworkMediaCrypto createMediaCrypto(byte[] initData) throws MediaCryptoException {
  // Work around a bug prior to Lollipop where L1 Widevine forced into L3 mode would still
  // indicate that it required secure video decoders [Internal ref: b/11428937].
  boolean forceAllowInsecureDecoderComponents = Util.SDK_INT < 21
      && C.WIDEVINE_UUID.equals(uuid) && "L3".equals(getPropertyString("securityLevel"));
  return new FrameworkMediaCrypto(new MediaCrypto(uuid, initData),
      forceAllowInsecureDecoderComponents);
}
 
源代码5 项目: no-player   文件: LocalDrmSessionManagerTest.java
@Before
public void setUp() throws MediaDrmException, MediaCryptoException {
    frameworkMediaCrypto = FrameworkMediaCryptoFixture.aFrameworkMediaCrypto().build();
    given(mediaDrm.openSession()).willReturn(SESSION_ID.asBytes());

    localDrmSessionManager = new LocalDrmSessionManager(
            KEY_SET_ID_TO_RESTORE,
            mediaDrm,
            DRM_SCHEME,
            handler,
            eventListener
    );
}
 
源代码6 项目: no-player   文件: LocalDrmSessionManagerTest.java
@Test
public void givenValidMediaDrm_whenAcquiringSession_thenRestoresKeys() throws MediaCryptoException {
    given(mediaDrm.createMediaCrypto(SESSION_ID.asBytes())).willReturn(frameworkMediaCrypto);

    localDrmSessionManager.acquireSession(IGNORED_LOOPER, IGNORED_DRM_DATA);

    verify(mediaDrm).restoreKeys(SESSION_ID.asBytes(), KEY_SET_ID_TO_RESTORE.asBytes());
}
 
源代码7 项目: no-player   文件: LocalDrmSessionManagerTest.java
@Test
public void givenValidMediaDrm_whenAcquiringSession_thenReturnsLocalDrmSession() throws MediaCryptoException {
    given(mediaDrm.createMediaCrypto(SESSION_ID.asBytes())).willReturn(frameworkMediaCrypto);

    DrmSession<FrameworkMediaCrypto> drmSession = localDrmSessionManager.acquireSession(IGNORED_LOOPER, IGNORED_DRM_DATA);

    LocalDrmSession localDrmSession = new LocalDrmSession(frameworkMediaCrypto, KEY_SET_ID_TO_RESTORE, SESSION_ID);
    assertThat(drmSession).isEqualTo(localDrmSession);
}
 
源代码8 项目: Telegram-FOSS   文件: FrameworkMediaDrm.java
@Override
public FrameworkMediaCrypto createMediaCrypto(byte[] initData) throws MediaCryptoException {
  // Work around a bug prior to Lollipop where L1 Widevine forced into L3 mode would still
  // indicate that it required secure video decoders [Internal ref: b/11428937].
  boolean forceAllowInsecureDecoderComponents = Util.SDK_INT < 21
      && C.WIDEVINE_UUID.equals(uuid) && "L3".equals(getPropertyString("securityLevel"));
  return new FrameworkMediaCrypto(
      adjustUuid(uuid), initData, forceAllowInsecureDecoderComponents);
}
 
源代码9 项目: Telegram-FOSS   文件: MediaCodecRenderer.java
@TargetApi(23)
private void updateDrmSessionOrReinitializeCodecV23() throws ExoPlaybackException {
  FrameworkMediaCrypto sessionMediaCrypto = sourceDrmSession.getMediaCrypto();
  if (sessionMediaCrypto == null) {
    // We'd only expect this to happen if the CDM from which the pending session is obtained needs
    // provisioning. This is unlikely to happen (it probably requires a switch from one DRM scheme
    // to another, where the new CDM hasn't been used before and needs provisioning). It would be
    // possible to handle this case more efficiently (i.e. with a new renderer state that waits
    // for provisioning to finish and then calls mediaCrypto.setMediaDrmSession), but the extra
    // complexity is not warranted given how unlikely the case is to occur.
    reinitializeCodec();
    return;
  }
  if (C.PLAYREADY_UUID.equals(sessionMediaCrypto.uuid)) {
    // The PlayReady CDM does not implement setMediaDrmSession.
    // TODO: Add API check once [Internal ref: b/128835874] is fixed.
    reinitializeCodec();
    return;
  }

  if (flushOrReinitializeCodec()) {
    // The codec was reinitialized. The new codec will be using the new DRM session, so there's
    // nothing more to do.
    return;
  }

  try {
    mediaCrypto.setMediaDrmSession(sessionMediaCrypto.sessionId);
  } catch (MediaCryptoException e) {
    throw ExoPlaybackException.createForRenderer(e, getIndex());
  }
  setCodecDrmSession(sourceDrmSession);
  codecDrainState = DRAIN_STATE_NONE;
  codecDrainAction = DRAIN_ACTION_NONE;
}
 
源代码10 项目: Telegram   文件: FrameworkMediaDrm.java
@Override
public FrameworkMediaCrypto createMediaCrypto(byte[] initData) throws MediaCryptoException {
  // Work around a bug prior to Lollipop where L1 Widevine forced into L3 mode would still
  // indicate that it required secure video decoders [Internal ref: b/11428937].
  boolean forceAllowInsecureDecoderComponents = Util.SDK_INT < 21
      && C.WIDEVINE_UUID.equals(uuid) && "L3".equals(getPropertyString("securityLevel"));
  return new FrameworkMediaCrypto(
      adjustUuid(uuid), initData, forceAllowInsecureDecoderComponents);
}
 
源代码11 项目: Telegram   文件: MediaCodecRenderer.java
@TargetApi(23)
private void updateDrmSessionOrReinitializeCodecV23() throws ExoPlaybackException {
  FrameworkMediaCrypto sessionMediaCrypto = sourceDrmSession.getMediaCrypto();
  if (sessionMediaCrypto == null) {
    // We'd only expect this to happen if the CDM from which the pending session is obtained needs
    // provisioning. This is unlikely to happen (it probably requires a switch from one DRM scheme
    // to another, where the new CDM hasn't been used before and needs provisioning). It would be
    // possible to handle this case more efficiently (i.e. with a new renderer state that waits
    // for provisioning to finish and then calls mediaCrypto.setMediaDrmSession), but the extra
    // complexity is not warranted given how unlikely the case is to occur.
    reinitializeCodec();
    return;
  }
  if (C.PLAYREADY_UUID.equals(sessionMediaCrypto.uuid)) {
    // The PlayReady CDM does not implement setMediaDrmSession.
    // TODO: Add API check once [Internal ref: b/128835874] is fixed.
    reinitializeCodec();
    return;
  }

  if (flushOrReinitializeCodec()) {
    // The codec was reinitialized. The new codec will be using the new DRM session, so there's
    // nothing more to do.
    return;
  }

  try {
    mediaCrypto.setMediaDrmSession(sessionMediaCrypto.sessionId);
  } catch (MediaCryptoException e) {
    throw ExoPlaybackException.createForRenderer(e, getIndex());
  }
  setCodecDrmSession(sourceDrmSession);
  codecDrainState = DRAIN_STATE_NONE;
  codecDrainAction = DRAIN_ACTION_NONE;
}
 
源代码12 项目: no-player   文件: FrameworkMediaCryptoFixture.java
private FrameworkMediaCryptoFixture() throws MediaCryptoException {
    // Static factory method.
}
 
源代码13 项目: no-player   文件: FrameworkMediaCryptoFixture.java
public static FrameworkMediaCryptoFixture aFrameworkMediaCrypto() throws MediaCryptoException {
    return new FrameworkMediaCryptoFixture();
}
 
源代码14 项目: K-Sonic   文件: FrameworkMediaDrm.java
@Override
public FrameworkMediaCrypto createMediaCrypto(UUID uuid, byte[] initData)
    throws MediaCryptoException {
  return new FrameworkMediaCrypto(new MediaCrypto(uuid, initData));
}
 
源代码15 项目: MediaSDK   文件: ExoMediaDrm.java
/**
 * @see android.media.MediaCrypto#MediaCrypto(UUID, byte[])
 * @param sessionId The DRM session ID.
 * @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data.
 * @throws MediaCryptoException If the instance can't be created.
 */
T createMediaCrypto(byte[] sessionId) throws MediaCryptoException;
 
源代码16 项目: TelePlus-Android   文件: ExoMediaDrm.java
/**
 * @see android.media.MediaCrypto#MediaCrypto(UUID, byte[])
 *
 * @param initData Opaque initialization data specific to the crypto scheme.
 * @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data.
 * @throws MediaCryptoException If the instance can't be created.
 */
T createMediaCrypto(byte[] initData) throws MediaCryptoException;
 
源代码17 项目: TelePlus-Android   文件: ExoMediaDrm.java
/**
 * @see android.media.MediaCrypto#MediaCrypto(UUID, byte[])
 *
 * @param initData Opaque initialization data specific to the crypto scheme.
 * @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data.
 * @throws MediaCryptoException If the instance can't be created.
 */
T createMediaCrypto(byte[] initData) throws MediaCryptoException;
 
源代码18 项目: K-Sonic   文件: ExoMediaDrm.java
/**
 * @see android.media.MediaCrypto#MediaCrypto(UUID, byte[])
 *
 * @param uuid The UUID of the crypto scheme.
 * @param initData Opaque initialization data specific to the crypto scheme.
 * @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data.
 * @throws MediaCryptoException
 */
T createMediaCrypto(UUID uuid, byte[] initData) throws MediaCryptoException;
 
源代码19 项目: Telegram-FOSS   文件: ExoMediaDrm.java
/**
 * @see android.media.MediaCrypto#MediaCrypto(UUID, byte[])
 * @param sessionId The DRM session ID.
 * @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data.
 * @throws MediaCryptoException If the instance can't be created.
 */
T createMediaCrypto(byte[] sessionId) throws MediaCryptoException;
 
源代码20 项目: Telegram   文件: ExoMediaDrm.java
/**
 * @see android.media.MediaCrypto#MediaCrypto(UUID, byte[])
 * @param sessionId The DRM session ID.
 * @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data.
 * @throws MediaCryptoException If the instance can't be created.
 */
T createMediaCrypto(byte[] sessionId) throws MediaCryptoException;