当前位置: 首页>>代码示例>>Java>>正文


Java MediaCrypto类代码示例

本文整理汇总了Java中android.media.MediaCrypto的典型用法代码示例。如果您正苦于以下问题:Java MediaCrypto类的具体用法?Java MediaCrypto怎么用?Java MediaCrypto使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MediaCrypto类属于android.media包,在下文中一共展示了MediaCrypto类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureAudio

import android.media.MediaCrypto; //导入依赖的package包/类
@CalledByNative
private boolean configureAudio(MediaFormat format, MediaCrypto crypto, int flags,
        boolean playAudio) {
    try {
        mMediaCodec.configure(format, null, crypto, flags);
        if (playAudio) {
            int sampleRate = format.getInteger(MediaFormat.KEY_SAMPLE_RATE);
            int channelCount = format.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
            int channelConfig = (channelCount == 1) ? AudioFormat.CHANNEL_OUT_MONO :
                    AudioFormat.CHANNEL_OUT_STEREO;
            // Using 16bit PCM for output. Keep this value in sync with
            // kBytesPerAudioOutputSample in media_codec_bridge.cc.
            int minBufferSize = AudioTrack.getMinBufferSize(sampleRate, channelConfig,
                    AudioFormat.ENCODING_PCM_16BIT);
            mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, channelConfig,
                    AudioFormat.ENCODING_PCM_16BIT, minBufferSize, AudioTrack.MODE_STREAM);
        }
        return true;
    } catch (IllegalStateException e) {
        Log.e(TAG, "Cannot configure the audio codec " + e.toString());
    }
    return false;
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:24,代码来源:MediaCodecBridge.java

示例2: configureCodec

import android.media.MediaCrypto; //导入依赖的package包/类
@Override
protected void configureCodec(MediaCodecInfo codecInfo, MediaCodec codec, Format format,
    MediaCrypto crypto) throws DecoderQueryException {
  codecMaxValues = getCodecMaxValues(codecInfo, format, streamFormats);
  MediaFormat mediaFormat = getMediaFormat(format, codecMaxValues, deviceNeedsAutoFrcWorkaround,
      tunnelingAudioSessionId);
  if (surface == null) {
    Assertions.checkState(shouldUseDummySurface(codecInfo.secure));
    if (dummySurface == null) {
      dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure);
    }
    surface = dummySurface;
  }
  codec.configure(mediaFormat, surface, crypto, 0);
  if (Util.SDK_INT >= 23 && tunneling) {
    tunnelingOnFrameRenderedListener = new OnFrameRenderedListenerV23(codec);
  }
}
 
开发者ID:y20k,项目名称:transistor,代码行数:19,代码来源:MediaCodecVideoRenderer.java

示例3: configureAudio

import android.media.MediaCrypto; //导入依赖的package包/类
@CalledByNative
private boolean configureAudio(MediaFormat format, MediaCrypto crypto, int flags,
        boolean playAudio) {
    try {
        mMediaCodec.configure(format, null, crypto, flags);
        if (playAudio) {
            int sampleRate = format.getInteger(MediaFormat.KEY_SAMPLE_RATE);
            int channelCount = format.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
            int channelConfig = getAudioFormat(channelCount);
            // Using 16bit PCM for output. Keep this value in sync with
            // kBytesPerAudioOutputSample in media_codec_bridge.cc.
            int minBufferSize = AudioTrack.getMinBufferSize(sampleRate, channelConfig,
                    AudioFormat.ENCODING_PCM_16BIT);
            mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, channelConfig,
                    AudioFormat.ENCODING_PCM_16BIT, minBufferSize, AudioTrack.MODE_STREAM);
            if (mAudioTrack.getState() == AudioTrack.STATE_UNINITIALIZED) {
                mAudioTrack = null;
                return false;
            }
        }
        return true;
    } catch (IllegalStateException e) {
        Log.e(TAG, "Cannot configure the audio codec", e);
    }
    return false;
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:27,代码来源:MediaCodecBridge.java

示例4: getMediaCrypto

import android.media.MediaCrypto; //导入依赖的package包/类
@Override
public final MediaCrypto getMediaCrypto() {
  if (state != STATE_OPENED && state != STATE_OPENED_WITH_KEYS) {
    throw new IllegalStateException();
  }
  return mediaCrypto;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:8,代码来源:StreamingDrmSessionManager.java

示例5: configureCodec

import android.media.MediaCrypto; //导入依赖的package包/类
@Override
protected void configureCodec(MediaCodecInfo codecInfo, MediaCodec codec, Format format,
    MediaCrypto crypto) {
  codecNeedsDiscardChannelsWorkaround = codecNeedsDiscardChannelsWorkaround(codecInfo.name);
  if (passthroughEnabled) {
    // Override the MIME type used to configure the codec if we are using a passthrough decoder.
    passthroughMediaFormat = format.getFrameworkMediaFormatV16();
    passthroughMediaFormat.setString(MediaFormat.KEY_MIME, MimeTypes.AUDIO_RAW);
    codec.configure(passthroughMediaFormat, null, crypto, 0);
    passthroughMediaFormat.setString(MediaFormat.KEY_MIME, format.sampleMimeType);
  } else {
    codec.configure(format.getFrameworkMediaFormatV16(), null, crypto, 0);
    passthroughMediaFormat = null;
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:16,代码来源:MediaCodecAudioRenderer.java

示例6: configureCodec

import android.media.MediaCrypto; //导入依赖的package包/类
@Override
protected void configureCodec(MediaCodecInfo codecInfo, MediaCodec codec, Format format,
    MediaCrypto crypto) throws DecoderQueryException {
  codecMaxValues = getCodecMaxValues(codecInfo, format, streamFormats);
  MediaFormat mediaFormat = getMediaFormat(format, codecMaxValues, deviceNeedsAutoFrcWorkaround,
      tunnelingAudioSessionId);
  codec.configure(mediaFormat, surface, crypto, 0);
  if (Util.SDK_INT >= 23 && tunneling) {
    tunnelingOnFrameRenderedListener = new OnFrameRenderedListenerV23(codec);
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:12,代码来源:MediaCodecVideoRenderer.java

示例7: configureCodec

import android.media.MediaCrypto; //导入依赖的package包/类
@Override
protected void configureCodec(MediaCodec codec, String codecName, boolean codecIsAdaptive,
                              android.media.MediaFormat format, MediaCrypto crypto) {
    maybeSetMaxInputSize(format, codecIsAdaptive);
    codec.configure(format, surface, crypto, 0);
    codec.setVideoScalingMode(videoScalingMode);
}
 
开发者ID:quanhua92,项目名称:GLMediaPlayer,代码行数:8,代码来源:TextureVideoTrackRenderer.java

示例8: configureCodec

import android.media.MediaCrypto; //导入依赖的package包/类
@Override
protected void configureCodec(MediaCodec codec, Format format, MediaCrypto crypto) {
  if (passthroughEnabled) {
    // Override the MIME type used to configure the codec if we are using a passthrough decoder.
    passthroughMediaFormat = format.getFrameworkMediaFormatV16();
    passthroughMediaFormat.setString(MediaFormat.KEY_MIME, MimeTypes.AUDIO_RAW);
    codec.configure(passthroughMediaFormat, null, crypto, 0);
    passthroughMediaFormat.setString(MediaFormat.KEY_MIME, format.sampleMimeType);
  } else {
    codec.configure(format.getFrameworkMediaFormatV16(), null, crypto, 0);
    passthroughMediaFormat = null;
  }
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:14,代码来源:MediaCodecAudioRenderer.java

示例9: getMediaCrypto

import android.media.MediaCrypto; //导入依赖的package包/类
@Override
public MediaCrypto getMediaCrypto() {
  if (state != STATE_OPENED && state != STATE_OPENED_WITH_KEYS) {
    throw new IllegalStateException();
  }
  return mediaCrypto;
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:8,代码来源:StreamingDrmSessionManager.java

示例10: configureCodec

import android.media.MediaCrypto; //导入依赖的package包/类
@Override
protected void configureCodec(MediaCodecInfo codecInfo, MediaCodec codec, Format format,
    MediaCrypto crypto) throws DecoderQueryException {
  // If the codec is being initialized whilst the renderer is started, default behavior is to
  // render the first frame (i.e. the keyframe before the current position), then drop frames up
  // to the current playback position. For test runs that place a maximum limit on the number of
  // dropped frames allowed, this is not desired behavior. Hence we skip (rather than drop)
  // frames up to the current playback position [Internal: b/66494991].
  skipToPositionBeforeRenderingFirstFrame = getState() == Renderer.STATE_STARTED;
  super.configureCodec(codecInfo, codec, format, crypto);
}
 
开发者ID:y20k,项目名称:transistor,代码行数:12,代码来源:DebugRenderersFactory.java

示例11: createMediaCrypto

import android.media.MediaCrypto; //导入依赖的package包/类
@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);
}
 
开发者ID:y20k,项目名称:transistor,代码行数:10,代码来源:FrameworkMediaDrm.java

示例12: configureVideo

import android.media.MediaCrypto; //导入依赖的package包/类
@CalledByNative
private boolean configureVideo(MediaFormat format, Surface surface, MediaCrypto crypto,
        int flags) {
    try {
        mMediaCodec.configure(format, surface, crypto, flags);
        return true;
    } catch (IllegalStateException e) {
      Log.e(TAG, "Cannot configure the video codec " + e.toString());
    }
    return false;
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:12,代码来源:MediaCodecBridge.java

示例13: configureVideo

import android.media.MediaCrypto; //导入依赖的package包/类
@CalledByNative
private boolean configureVideo(MediaFormat format, Surface surface, MediaCrypto crypto,
        int flags) {
    try {
        mMediaCodec.configure(format, surface, crypto, flags);
        return true;
    } catch (IllegalStateException e) {
        Log.e(TAG, "Cannot configure the video codec " + e.toString());
    }
    return false;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:MediaCodecBridge.java

示例14: configureVideo

import android.media.MediaCrypto; //导入依赖的package包/类
@CalledByNative
private boolean configureVideo(MediaFormat format, Surface surface, MediaCrypto crypto,
        int flags) {
    try {
        mMediaCodec.configure(format, surface, crypto, flags);
        return true;
    } catch (IllegalStateException e) {
        Log.e(TAG, "Cannot configure the video codec", e);
    }
    return false;
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:12,代码来源:MediaCodecBridge.java

示例15: createMediaCrypto

import android.media.MediaCrypto; //导入依赖的package包/类
@Override
public FrameworkMediaCrypto createMediaCrypto(UUID uuid, 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);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:11,代码来源:FrameworkMediaDrm.java


注:本文中的android.media.MediaCrypto类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。