10c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/*
20c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Copyright (C) 2014 The Android Open Source Project
30c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen *
40c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Licensed under the Apache License, Version 2.0 (the "License");
50c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * you may not use this file except in compliance with the License.
60c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * You may obtain a copy of the License at
70c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen *
80c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen *      http://www.apache.org/licenses/LICENSE-2.0
90c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen *
100c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Unless required by applicable law or agreed to in writing, software
110c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * distributed under the License is distributed on an "AS IS" BASIS,
120c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * See the License for the specific language governing permissions and
140c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * limitations under the License.
150c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
160c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
170c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/*
180c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * This file defines an NDK API.
190c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Do not remove methods.
200c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Do not change method signatures.
210c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Do not change the value of constants.
220c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Do not change the size of any of the classes defined in here.
230c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Do not reference types that are not part of the NDK.
240c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Do not #include files that aren't part of the NDK.
250c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
260c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
270c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen#ifndef _NDK_MEDIA_CODEC_H
280c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen#define _NDK_MEDIA_CODEC_H
290c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
300c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen#include <android/native_window.h>
310c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
32050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen#include "NdkMediaCrypto.h"
33e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissen#include "NdkMediaError.h"
340c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen#include "NdkMediaFormat.h"
350c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
360c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen#ifdef __cplusplus
370c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissenextern "C" {
380c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen#endif
390c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
400c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
410c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissenstruct AMediaCodec;
420c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissentypedef struct AMediaCodec AMediaCodec;
430c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
440c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissenstruct AMediaCodecBufferInfo {
450c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen    int32_t offset;
460c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen    int32_t size;
470c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen    int64_t presentationTimeUs;
480c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen    uint32_t flags;
490c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen};
500c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissentypedef struct AMediaCodecBufferInfo AMediaCodecBufferInfo;
51050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissentypedef struct AMediaCodecCryptoInfo AMediaCodecCryptoInfo;
520c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
530c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissenenum {
540c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen    AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM = 4,
5586aa02ce274826dc80ffa00766b16172c47503fdMarco Nelissen    AMEDIACODEC_CONFIGURE_FLAG_ENCODE = 1,
560c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen    AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED = -3,
570c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen    AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED = -2,
580c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen    AMEDIACODEC_INFO_TRY_AGAIN_LATER = -1
590c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen};
600c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
610c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
6286aa02ce274826dc80ffa00766b16172c47503fdMarco Nelissen * Create codec by name. Use this if you know the exact codec you want to use.
6386aa02ce274826dc80ffa00766b16172c47503fdMarco Nelissen * When configuring, you will need to specify whether to use the codec as an
6486aa02ce274826dc80ffa00766b16172c47503fdMarco Nelissen * encoder or decoder.
650c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
6686aa02ce274826dc80ffa00766b16172c47503fdMarco NelissenAMediaCodec* AMediaCodec_createCodecByName(const char *name);
670c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
680c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
690c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Create codec by mime type. Most applications will use this, specifying a
700c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * mime type obtained from media extractor.
710c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
7286aa02ce274826dc80ffa00766b16172c47503fdMarco NelissenAMediaCodec* AMediaCodec_createDecoderByType(const char *mime_type);
730c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
740c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
750c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Create encoder by name.
760c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
7786aa02ce274826dc80ffa00766b16172c47503fdMarco NelissenAMediaCodec* AMediaCodec_createEncoderByType(const char *mime_type);
780c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
790c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
800c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * delete the codec and free its resources
810c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
82e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodec_delete(AMediaCodec*);
830c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
840c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
850c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Configure the codec. For decoding you would typically get the format from an extractor.
860c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
87e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodec_configure(
88050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        AMediaCodec*,
89050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        const AMediaFormat* format,
90050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        ANativeWindow* surface,
91050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        AMediaCrypto *crypto,
92050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        uint32_t flags);
930c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
940c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
950c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Start the codec. A codec must be configured before it can be started, and must be started
960c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * before buffers can be sent to it.
970c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
98e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodec_start(AMediaCodec*);
990c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
1000c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
1010c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Stop the codec.
1020c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
103e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodec_stop(AMediaCodec*);
1040c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
1050c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/*
1060c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Flush the codec's input and output. All indices previously returned from calls to
1070c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * AMediaCodec_dequeueInputBuffer and AMediaCodec_dequeueOutputBuffer become invalid.
1080c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
109e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodec_flush(AMediaCodec*);
1100c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
1110c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
1120c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Get an input buffer. The specified buffer index must have been previously obtained from
1130c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * dequeueInputBuffer, and not yet queued.
1140c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
1150c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissenuint8_t* AMediaCodec_getInputBuffer(AMediaCodec*, size_t idx, size_t *out_size);
1160c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
1170c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
1180c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Get an output buffer. The specified buffer index must have been previously obtained from
1190c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * dequeueOutputBuffer, and not yet queued.
1200c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
1210c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissenuint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size);
1220c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
1230c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
1240c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Get the index of the next available input buffer. An app will typically use this with
1250c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * getInputBuffer() to get a pointer to the buffer, then copy the data to be encoded or decoded
1260c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * into the buffer before passing it to the codec.
1270c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
1280c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissenssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec*, int64_t timeoutUs);
1290c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
1300c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
1310c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Send the specified buffer to the codec for processing.
1320c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
133e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodec_queueInputBuffer(AMediaCodec*,
1340c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen        size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags);
1350c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
1360c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
137050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen * Send the specified buffer to the codec for processing.
138050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen */
139e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*,
140050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        size_t idx, off_t offset, AMediaCodecCryptoInfo*, uint64_t time, uint32_t flags);
141050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen
142050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen/**
1430c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen * Get the index of the next available buffer of processed data.
1440c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
1450c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissenssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec*, AMediaCodecBufferInfo *info, int64_t timeoutUs);
1460c3be875376adaee8d8e8dd917c64926e1513b29Marco NelissenAMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*);
1470c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
1480c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen/**
14979e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * If you are done with a buffer, use this call to return the buffer to
15079e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * the codec. If you previously specified a surface when configuring this
15179e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * video decoder you can optionally render the buffer.
1520c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen */
153e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render);
1540c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
15579e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen/**
15679e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * If you are done with a buffer, use this call to update its surface timestamp
15779e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * and return it to the codec to render it on the output surface. If you
15879e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * have not specified an output surface when configuring this video codec,
15979e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * this call will simply return the buffer to the codec.
16079e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen *
16179e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * For more details, see the Java documentation for MediaCodec.releaseOutputBuffer.
16279e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen */
16379e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissenmedia_status_t AMediaCodec_releaseOutputBufferAtTime(
16479e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen        AMediaCodec *mData, size_t idx, int64_t timestampNs);
1650c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
166cdb42cdc5ccb785edabe1ee6407134fbae5662a9Marco Nelissen
16779e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissentypedef enum {
168050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen    AMEDIACODECRYPTOINFO_MODE_CLEAR = 0,
169050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen    AMEDIACODECRYPTOINFO_MODE_AES_CTR = 1
17079e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen} cryptoinfo_mode_t;
171050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen
172050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen/**
17379e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * Create an AMediaCodecCryptoInfo from scratch. Use this if you need to use custom
174050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen * crypto info, rather than one obtained from AMediaExtractor.
17579e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen *
17679e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * AMediaCodecCryptoInfo describes the structure of an (at least
17779e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * partially) encrypted input sample.
17879e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * A buffer's data is considered to be partitioned into "subsamples",
17979e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * each subsample starts with a (potentially empty) run of plain,
18079e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * unencrypted bytes followed by a (also potentially empty) run of
18179e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * encrypted bytes.
18279e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * numBytesOfClearData can be null to indicate that all data is encrypted.
18379e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * This information encapsulates per-sample metadata as outlined in
18479e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * ISO/IEC FDIS 23001-7:2011 "Common encryption in ISO base media file format files".
185050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen */
186050eb3280d7305b84f723d515be2dc9606dc39d1Marco NelissenAMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new(
187050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        int numsubsamples,
188050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        uint8_t key[16],
189050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        uint8_t iv[16],
19079e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen        cryptoinfo_mode_t mode,
191050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        size_t *clearbytes,
192050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen        size_t *encryptedbytes);
193050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen
194050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen/**
195829e097f832b4c4c41733f9b77121888204d993eMarco Nelissen * delete an AMediaCodecCryptoInfo created previously with AMediaCodecCryptoInfo_new, or
196050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen * obtained from AMediaExtractor
197050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen */
198e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*);
199050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen
20079e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen/**
20179e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * The number of subsamples that make up the buffer's contents.
20279e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen */
203050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissensize_t AMediaCodecCryptoInfo_getNumSubSamples(AMediaCodecCryptoInfo*);
20479e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen
20579e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen/**
20679e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * A 16-byte opaque key
20779e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen */
208e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodecCryptoInfo_getKey(AMediaCodecCryptoInfo*, uint8_t *dst);
20979e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen
21079e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen/**
21179e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * A 16-byte initialization vector
21279e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen */
213e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodecCryptoInfo_getIV(AMediaCodecCryptoInfo*, uint8_t *dst);
21479e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen
21579e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen/**
21679e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * The type of encryption that has been applied,
21779e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * one of AMEDIACODECRYPTOINFO_MODE_CLEAR or AMEDIACODECRYPTOINFO_MODE_AES_CTR.
21879e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen */
21979e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissencryptoinfo_mode_t AMediaCodecCryptoInfo_getMode(AMediaCodecCryptoInfo*);
22079e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen
22179e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen/**
22279e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * The number of leading unencrypted bytes in each subsample.
22379e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen */
224e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodecCryptoInfo_getClearBytes(AMediaCodecCryptoInfo*, size_t *dst);
22579e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen
22679e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen/**
22779e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen * The number of trailing encrypted bytes in each subsample.
22879e2b622702fb148ccff12d6f38643466555c4ebMarco Nelissen */
229e419d7cd5c62b4b5866a45d59c5770bb470193c1Marco Nelissenmedia_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst);
230050eb3280d7305b84f723d515be2dc9606dc39d1Marco Nelissen
2310c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen#ifdef __cplusplus
2320c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen} // extern "C"
2330c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen#endif
2340c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen
2350c3be875376adaee8d8e8dd917c64926e1513b29Marco Nelissen#endif //_NDK_MEDIA_CODEC_H
236