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


Java MediaExtractor.getSampleCryptoInfo方法代码示例

本文整理汇总了Java中android.media.MediaExtractor.getSampleCryptoInfo方法的典型用法代码示例。如果您正苦于以下问题:Java MediaExtractor.getSampleCryptoInfo方法的具体用法?Java MediaExtractor.getSampleCryptoInfo怎么用?Java MediaExtractor.getSampleCryptoInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.media.MediaExtractor的用法示例。


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

示例1: setFromExtractorV16

import android.media.MediaExtractor; //导入方法依赖的package包/类
/**
 * Equivalent to {@link MediaExtractor#getSampleCryptoInfo(android.media.MediaCodec.CryptoInfo)}.
 *
 * @param extractor The extractor from which to retrieve the crypto information.
 */
@TargetApi(16)
public void setFromExtractorV16(MediaExtractor extractor) {
  extractor.getSampleCryptoInfo(frameworkCryptoInfo);
  numSubSamples = frameworkCryptoInfo.numSubSamples;
  numBytesOfClearData = frameworkCryptoInfo.numBytesOfClearData;
  numBytesOfEncryptedData = frameworkCryptoInfo.numBytesOfEncryptedData;
  key = frameworkCryptoInfo.key;
  iv = frameworkCryptoInfo.iv;
  mode = frameworkCryptoInfo.mode;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:16,代码来源:CryptoInfo.java

示例2: writeSample

import android.media.MediaExtractor; //导入方法依赖的package包/类
/**
 * Write a media sample to the decoder.
 *
 * A "sample" here refers to a single atomic access unit in the media stream. The definition
 * of "access unit" is dependent on the type of encoding used, but it typically refers to
 * a single frame of video or a few seconds of audio. {@link MediaExtractor}
 * extracts data from a stream one sample at a time.
 *
 * @param extractor  Instance of {@link MediaExtractor} wrapping the media.
 *
 * @param presentationTimeUs The time, relative to the beginning of the media stream,
 * at which this buffer should be rendered.
 *
 * @param flags  Flags to pass to the decoder. See {@link MediaCodec#queueInputBuffer(int,
 * int, int, long, int)}
 *
 * @throws MediaCodec.CryptoException
 */
public boolean writeSample(final MediaExtractor extractor,
        final boolean isSecure,
        final long presentationTimeUs,
        int flags) {
    boolean result = false;
    boolean isEos = false;

    if (!mAvailableInputBuffers.isEmpty()) {
        int index = mAvailableInputBuffers.remove();
        ByteBuffer buffer = mInputBuffers[index];

        // reads the sample from the file using extractor into the buffer
        int size = extractor.readSampleData(buffer, 0);
        if (size <= 0) {
            flags |= MediaCodec.BUFFER_FLAG_END_OF_STREAM;
        }

        // Submit the buffer to the codec for decoding. The presentationTimeUs
        // indicates the position (play time) for the current sample.
        if (!isSecure) {
            mDecoder.queueInputBuffer(index, 0, size, presentationTimeUs, flags);
        } else {
            extractor.getSampleCryptoInfo(cryptoInfo);
            mDecoder.queueSecureInputBuffer(index, 0, cryptoInfo, presentationTimeUs, flags);
        }

        result = true;
    }
    return result;
}
 
开发者ID:stfalcon-studio,项目名称:patrol-android,代码行数:49,代码来源:MediaCodecWrapper.java


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